Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Currently I'm developing an iOS MMO game with cocos2d-x. The game depends on many data tables (Excel file) given by the designers. These tables contain data like how much gold/crystal will be cost when upgrade a building (barracks, laboratory, etc.). We have about 10 tables, each have about 50 rows of data.

My question is how to store those tables on client side and how to update them once they have been modified on server side?

My opinion: use SQLite to store data on client side, the server will parse the Excel files and send the data to client with JSON format, then the client parse the JSON string and save it to SQLite file.

Is there any better method? I find that some game stores CSV files on client side, how do they update the files? Could server send a whole file directly to client?

share|improve this question
add comment

3 Answers 3

You can just zip Sqlite db file on server, download it, then unpack with overwrite. No need for intermediate format like JSON as I see it.

share|improve this answer
add comment

When you have only ten tables of only 50 rows each, do you really need a relational database for that? When we estimate that each row will have about a kByte of data (which seems like a gross overestimate for the one use-case you described, but maybe you have others with more data), that wouldn't even be a single MB.

You are still very well in the area where you can store all that information in RAM while the game is running. I also think that incremental updates of these files (only update the rows which changed) wouldn't be worth the hassle. To update whole files, there are different approaches:

  1. The checksum approach: Client and server calculate the checksum of each content file. The client sends a list of all files with their checksums to the server. When the server notices that checksums are incorrect or that files are missing, it resends the file. The nice thing is that when a file gets corrupted for some reason, it will be fixed automatically with the next update.

  2. The versioning approach: Each of your content updates gets a version number. When the client connects to the server, it reports its latest content version number. When it's lower than the one on the server, the server sends new versions of all files which changed since that version. This is harder to develop (the server needs to track which files changed with each past update) and doesn't protect against broken updates, but it is much less CPU-intensive, because checksum calculation can be expensive when you have a lot of very large files.

share|improve this answer
    
thank you very much for your answer. –  farseer2012 Oct 19 '12 at 2:23
add comment

If you send the data from server to client and store this data on the client, this data could be modified before sending the request to the server and that would result in cheating. I would do like this:

  1. Client sends a build-House request to the server
  2. Server checks if the player's resources are enough to build what the player wants
  3. If the player has everything that is required, the building will be build and then the server will send a packed giving the required information to show this House on the screen
  4. House is shown on the screen

I actually don't have any experience with MMOs, but that's the way I'd make what you want :)

share|improve this answer
    
Thanks for your input but I think the OP was more interested in managing changes, rather than security –  Ken Oct 19 '12 at 23:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.