godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.13k stars 93 forks source link

Add support for alternative 2D coordinate systems #10915

Open Sharaf5 opened 2 days ago

Sharaf5 commented 2 days ago

Describe the project you are working on

Hex based map game

Describe the problem or limitation you are having in your project

every part of the hex and camera need to have many complex calculations before moving or attaching tiles

Describe the feature / enhancement and how it helps to overcome the problem or limitation

more coordinates systems for the viewport may add more facilities to various game types

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

cube coordinates system one way example of calculation https://www.researchgate.net/publication/336162505_Hexagonal_Convolutional_Neural_Networks_for_Hexagonal_Grids/figures

If this enhancement will not be used often, can it be worked around with a few lines of script?

once it's needed in a project all parts of the project should follow it

Is there a reason why this should be core and not an add-on in the asset library?

Calinou commented 2 days ago
  • screen coordinates : (current) respect the screen canvas coordinates (positive right and down)
  • natural coordinates : respect the math cartisian coordinates (positive right and up)

For reference, this was discussed in https://github.com/godotengine/godot-proposals/issues/2070 and was rejected. Adding multiple coordinate systems would increase the maintenance overhead a lot, on top of making code no longer easily reusable across projects with different coordinate systems.

Regarding cube and axial coordinates, I'm not sure how these could be exposed in a generic fashion in a 2D engine. If you want a 3D coordinate system, use the 3D physics engine (but feel free to use 2D nodes to represent it, e.g. by moving sprites according to their 3D world position in _physics_process).

Sharaf5 commented 1 day ago

I read #2070 one time ago but my idea is different I suggest that we have a way to change from different coordinates natively, for both 2D and 3D or between them

the hard thing made me think about that is when I tried to make a satalite scene in the game where user could covert between 2D coordinates and 3D coordinates I really seen many issues, that could affect game performance