Game map data management

Ok, in my flash game I have maps with lots of default objects and stuff. When one of them is modified from the default in game a entry is created in the database.

If an alteration exists on game load for a row/col the default object for that location isn’t loaded.

Then the map is populated with the user modified/created objects. So, we have three different steps… 1. Load default map, 2. Clear modified cells, 3, Populate modified cells with db data. (Yes, all data modifications are done before any actual graphical rendering.)

I was wondering if anyone knew a better way to store the modifications. Maybe I could store the alterations in pairs… Eg… “23,22,25,26” Just row,col repeating over and over… And store it inside a Blob or Char data type? Then I could add more alteration row,col’s easily to the end of the Blob or Char data type… This data is going to be stored away and never modified again. Just added to… Not sure if it’s possible to just add more data to the end of a TEXT data type with a queary.

I could just do it like this… But, this results in hundreds to thousands of rows. Gotta be a simpler way!


CREATE TABLE IF NOT EXISTS `alterations` (
  `game_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `map_id` smallint(2) unsigned NOT NULL,
  `row` smallint(5) NOT NULL DEFAULT '0',
  `col` smallint(5) NOT NULL DEFAULT '0'
) ENGINE=MyISAM  DEFAULT CHARSET=ascii COLLATE=ascii_bin AUTO_INCREMENT=0;