Hi All, I'm currently making a tile based mmorpg and am trying to find a good way to store a large 2d game world (at least 1000 squared tiles, but hopefully more like a few thousand squared). The idea is to encourage people to make their own cities on the shared map and users will be able to build houses and shops ingame so the tiles would be able to be edited and have a one to many relationship with some linked tables. I'm thinking of sending them to the client in 64x64 tile chunks.
I currently have it working in php/mysql, my table looks like:
CREATE TABLE `fbmmo`.`tiles` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`x` int(11) NOT NULL,
`y` int(11) NOT NULL,
`realm` varchar(45) NOT NULL,
`image_id` varchar(45) NOT NULL,
PRIMARY KEY (`id`),
KEY `Index_X` (`x`),
KEY `Index_Y` (`y`)
) ENGINE=InnoDB AUTO_INCREMENT=4327236 DEFAULT CHARSET=latin1;
and queries roughly like
select * from tiles where x<1000 and y<1000 and x>936 and y>936;
When I've only got about half a million records it only takes about half a second, but when i get up to about 4 million records it takes about 5 seconds and I'm sure theres some way to improve that.
I can get around it by cacheing the map requests but I wondered if there is a better method of configuring the database, and also if anyone has tips for effectively storing a large 2d game world?
thanks for your time