I am just thinking what would give me better perfomance and memory usage. I am programming a map for a game. Everything is stored in class "map" but a map may have thousands of tiles. Now i am thinking what is better solution:
- keep every tile parameters in x-y array (tile x = 10, y = 11 data is stored in array like map[10][11] = params) and if i want to know something about a tile a call different arrays with x-y parameters
- consider a tile as an object and make methods to, it can easily return tile's neighbours and all data also stored somehere in each object as an array.
Because I may have thousands of similiar tiles first impression would be that it is best for oop programming, but i am afraid that thousands of object tiles might use much more memory and calling to it's methods might be slower. What do you think about it?
Kalreg