So, as seems to be the theme these days, I'm doing a little 2D RPG. 32x32 tiles, all that cliche stuff. I have a question about how my maps could be optimized. (right now, this is just for the editor but, most (all) of this will probably be shared with the game as well)
Right now I have a tile struct that has all the necessary data for each tile that needs to be drawn, and then my map is just a 2D array of these tiles. The array ends up having about 768 elements with the way I chop the map up right now.
Code: Select all
//consts
const int WINDOW_WIDTH = 1024;
const int WINDOW_HEIGHT = 768;
const int TILE_SIZE = 32;
const int MAX_TILES_WIDTH = WINDOW_WIDTH / TILE_SIZE;
const int MAX_TILES_HEIGHT = WINDOW_HEIGHT / TILE_SIZE;
//...snip...
Tile map[MAX_TILES_WIDTH][MAX_TILES_HEIGHT]; //32 * 24 = 768
Is this an okay way to do this? Can I optimize it somehow with a different data structure? Is 768 not a very big # of elements and I'm just thinking it is because I haven't been exposed to large(r) amounts of data before?
Any input is appreciated.