Saving maps as XML flat file over database
Posted: Mon Jun 14, 2010 4:34 am
Hi everyone,
I was thinking for an hour about whether or not I should save maps as individual cells in a database table or load in a flat-file XML document.
I eventually decided on the database table, until I started actually creating the structure.
It seemed fine until I realized I wanted a 3-layer structure.
My maps will be 11 cells high by 22 cells wide => 242 tiles per layer.
Sure, some tiles may have nothing on layer 2 or 3, but I'll still always need an entry for that cell saying it has no image.
Yes, each user will only need to load this map data once when entering the map, and never again, but still, is 726 records (or rows) in a database table too much, or is that actually a really small amount? I don't have enough database experience to know.
I think I'll be reading in the tilemap using 3 queries:
SELECT * FROM maplayout WHERE id='$map' AND layer='1';
SELECT * FROM maplayout WHERE id='$map' AND layer='2';
SELECT * FROM maplayout WHERE id='$map' AND layer='3';
Each query returning <250 records isnt bad right?
My other concern is that maplayout table is going to eventually have thousands of records, considering 1 map is gonna have 750ish rows, and there will be many maps.
I was thinking for an hour about whether or not I should save maps as individual cells in a database table or load in a flat-file XML document.
I eventually decided on the database table, until I started actually creating the structure.
It seemed fine until I realized I wanted a 3-layer structure.
My maps will be 11 cells high by 22 cells wide => 242 tiles per layer.
Sure, some tiles may have nothing on layer 2 or 3, but I'll still always need an entry for that cell saying it has no image.
Yes, each user will only need to load this map data once when entering the map, and never again, but still, is 726 records (or rows) in a database table too much, or is that actually a really small amount? I don't have enough database experience to know.
I think I'll be reading in the tilemap using 3 queries:
SELECT * FROM maplayout WHERE id='$map' AND layer='1';
SELECT * FROM maplayout WHERE id='$map' AND layer='2';
SELECT * FROM maplayout WHERE id='$map' AND layer='3';
Each query returning <250 records isnt bad right?
My other concern is that maplayout table is going to eventually have thousands of records, considering 1 map is gonna have 750ish rows, and there will be many maps.