Hello everyone
This a bit theorical question about program design - I am learning c++.
My learning project is a turn by turn, Hexagon based game.
So I have a “Grid Manager” c++ class which will handle all functions like calculating hex distances, finding neighbours hexagons, path finding, and so on ; and a BP GridManager based on the previous c++ class that will handle geometry instancing , mouse interaction, construction etc…
The hexagons system use 2 different coordinates systems : one is X, Y (“Offset”), easy to read and visualize, and one is a “Cube” coordinates system using a Int Vector (x,y,z) that is usefull for mathematical calculation (this is all based on this excellent website)
So the system is constantly converting the “Offset” coordinate system to the “Cube” Coordinate system and vice versa.
So my question: is it better to ?
1 - Repeat the conversions every time I need them, and only store XY coordinates. It’s 2 functions with 3~5 simple lines of codes which are launched many times by Ticks
2 - At construction, generate the vector coordinates once for all, and store them in an appropriate Map which I will read and write. It’s a Map with potentially a few thousand objects.
and 3 - does it make any difference ?
If anybody understand my question I’ll be very happy…
Jerome