Data Structure – For online multiplayer game storage large-scale map-based map

I’m currently making a tile based on mmorpg, and I’m trying to find a good way to store a large 2D game world (at least 1,000 square tiles, but hopefully it’s more like a few thousand squares ). The idea is to encourage people to build their own cities on a shared map. Users will be able to build houses and shops to be able to edit tiles and have a one-to-many relationship with certain linked tables. I’m considering making them 64× 64 tiles are sent to the client in the form of blocks.

I am currently working in php/mysql, and 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;

It is roughly similar to query< /p>

select * from tiles where x<1000 and y<1000 and x>936 and y>936;

When I only have about half a million records , It only takes about half a second, but when I reach about 4 million records, it takes about 5 seconds, and I am sure there are some ways to improve it.

I can cache the map Ask to solve this problem, but I want to know if there is a better way to configure the database, and if anyone has a hint for efficiently storing large 2D game worlds?

Thank you for your time

As the data set size increases, the range Queries can get out of control very quickly. You might want to read some literature on this. Here are some interesting papers.

Data structure of range query:

http: //portal.acm.org/citation.cfm?id=1035798

www.siam.org/proceedings/soda/2010/SODA10_014_yuanh.pdf

Algorithm for fast search

www.cccg.ca/proceedings/2005/3.pdf

I am currently making a tile based on mmorpg and I am trying to find A good way to store large 2D game worlds (at least 1,000 square tiles, but hopefully more like a few thousand squares). The idea is to encourage people to build their own cities on a shared map, and users will be able to build houses and shops in order to be able to Edit tiles and have a one-to-many relationship with some linked tables. I am considering sending them to the client in the form of 64×64 tiles.

I am currently in php / Working in 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;

It is roughly similar to query

select * from tiles where x<1 000 and y<1000 and x>936 and y>936;

When I only have about half a million records, it only takes about half a second, but when I reach about 4 million records , It takes about 5 seconds, and I am sure there are some ways to improve it.

I can solve this problem by caching the map request, but I want to know if there is a better way to configure the database, And does anyone have any tips for effectively storing large 2D game worlds?

Thank you for your time

As the size of the data set increases, range queries can get out of control very quickly. You may want to see Some literature about this. Here are some interesting papers.

Data structure of range query:

http://portal.acm.org/citation.cfm? id=1035798

www.siam.org/proceedings/soda/2010/SODA10_014_yuanh.pdf

Algorithms for quick search

www.cccg.ca /proceedings/2005/3.pdf

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1759 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.