Hello forum!
I have a grid, let's say 20x20. Every object (but GUI and alike) are part of this grid.
Since every grid-slot has a fixed size, I can easily determine whether a mouse-click interacts with a grid-slot. But there is one problem with this:
Do I serialise the grid-slot or the actual-position?
Actual position:
+ Easy to deserialise, since no further conversion is required, coordinates are pretty much done.
- It is unclear on where to insert this onto the grid, would require calculation.
Position in the grid:
+ Easy to place on the grid.
- Requires calculation to find the true coordinates.
Serialise grid as well and keep coordinates as values per entity:
+ Contains everything needed.
- Data redundancy, because both values could be converted anyway during runtime.
- Slower serialising and slower deserialising.
I assume serialising the grid-position for grid-elements is better?
Not really sure how to progress or what class should be responsible for interpreting/converting/changing grid-positions to real coordinates.
Thanks for your time : )