Page 1 of 1

Saving maps as XML flat file over database

Posted: Mon Jun 14, 2010 4:34 am
by Kada
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.

Re: Saving maps as XML flat file over database

Posted: Mon Jun 14, 2010 4:46 am
by Kada
Wow... just read online that even 100,000 records in a database table is considered small by todays standards.

"...I have databases with 2+ GB of data, with some tables containing over 1 million rows and I consider that being somewhere between small and medium size."

Re: Saving maps as XML flat file over database

Posted: Mon Jun 14, 2010 7:58 am
by Falken
Ye you should use a database. XML is not made for data storage, the primary use of XML is to transfer data between different datasystems.