Hello, I’ve recently started programming a game, (I mean, VERY recently). I have just gotten to the ‘tile map creation’ phase, and realized that there are many different methods to choose between.
The way i originally planed to do it, and the way I learned how to do it, was to just have all the tiles in 1 Array, and just augment their position once the array reaches a certain point (say, tile 7 or 8") by shifting the x and y coordinates.
However, i realized that method might not be the best suited for what i am planning to do.
The game i am starting to program is going to have multiple layers, having 2 layers for each type of ‘tiles’ or image needed:
1 & 2 background/panorama
3 & 4) base tiles (the ground/water)
5 & 6) item tiles/walls/ things that need a see through background
events/mobs just have their on x&y as they are thier own arrays
I need this because i am essentially making a 2d world sim game. you can build, you can farm, you can change the landscape to fit whatever you want, blah. (no, not like terreria/starbound. I’m not making a clone of them. This is styled like an old fashioned rpgs. Like a sandbox version of the old 2d harvest moon games)
However, the way i was taught how to do this, was to just do a completely different Array for each layer, but i was thinking, what about 2d arrays and 3d arrays? would one of them be easier to keep track of/program, and would one be faster for a pc to read?
So, my question(s) are:
Should i do multiple 1d arrays, multiple 3d arrays, or 1 big 3d array?
Which is easier to keep track of?
Which is faster for PCs/Macs?