简体   繁体   中英

Efficient video game server data storage?

I'm currently developing a multiplayer iOS video game where I want the players data to be stored in the cloud. In the game the player creates an area by placing items, planting trees etc which other players can then visit and walk around in realtime.

From the game map side what needs to be stored is:

  • A 50x50 tile grid - The type of tile (grass etc) and the height of the tile
  • All of the placed items and any associated item specific data (A tree for example would store when it was planted)

On the player side I need to store their:

  • Character customisation
  • Inventory

The information would need to be read fairly infrequently (every time a client connects to the area) but would need to be written back to fairly regularly (every time an item is placed etc) so that any future connecting client would be reading the correct data.

My question really is where to start with regards to storing this data in an efficient way for the server? I considered using several XML files to store different portions of the map and then storing each of the other parts (Inventory, Character etc) in their own XML file. But is this the most efficient way of doing it from the servers perspective? I want to minimise the amount of data it has to write back when the client updates :)

TL;DR: Use a database and the Unity plugin for said database.

Managing an XML file via server is just going to cause a bunch of file locking/synchronization problems that you shouldn't be dealing with manually (unless, this is the focus of your project/research).

There are plenty of database backends that you can use, and that work well with Unity. A few I can think of off-hand:

• Parse.com --- they have a Unity plugin

• Write your own HTTP-based web server (in PHP/MySQL, JavaScript, Ruby, whatever) and then use a REST interface library (a bunch on the Unity Asset Store) to talk to it and store your data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM