im building a little 2d engine on top of sdl as it is quite simple...
but my problem or question is: does anybody know where i can find a site or whatever containing an explanation how to save maps in the memory so that its easy accessable and doesn not need that much memory also i would be happy about some general pixel design pages
In my 2d tiled game i use a procedural generated - modified perlin noise - level map and i just store the visible part and the story depended part of the level. I use this site to learn perlin.
class CTile
{
public:
Bitmap *Pic;
void Load(char *filename)
{
Pic = LoadBitmap(filename);
}
};
CTile *Tiles = new CTile[10];
...
CTile **Map = new CTile *[100 * 100];
for(int x = 0;x<100;x++)
for(int y = 0;y<100;y++)
Map[y * 100 + x] = &Tiles[0]; //Set all tiles in the map to the first tile
The Map is made up of only pointers, so the memory usage is x*y*sizeof(CTile *) which is 4 bytes on 32 bit systems. A 100 x 100 map is about 40k of ram.