Sign in to follow this  

Client/server data synchronization

This topic is 4556 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So, I have an issue I need some perspective on. I have a client/server based network game for a small number of players, up to 16 or so (same as the last thread I made :P). I want it to be pretty flexible and easily mod-able, so most of the concrete data on game entities (ships, weapons, etc) is held in config files. I anticipate that one of the fun parts of this game will be hacking, tweaking, modding, and generally abusing it... at least, that's the part I'll enjoy most. So it's probably fairly safe to assume that there's going to be at least two or three big mods of it, when and if it gets any kind of following. Now, the issue I'm concerned with is that of consistancy. The server needs to be sure that all the clients have all the right game data. The Important Stuff, such as weapon statistics and so on, is all pretty easy to simply send over when the client first connects to the server, before the game starts. It comes to maybe a few dozen kb, max, and this game is designed to work over ethernet and broadband. However, it would also be nice if the server could verify that all the game content, such as sprites, sounds, and music, do in fact exist on the clients and is the right stuff. And, if the server has some cool mod but the client doesn't know about it, transfer the modded files over to the client. Things might not work very well if the server thinks fooObject.png is an image 20 pixels square, and the client's uber-cool-hacked(tm) fooObject.png is an image 50 pixels wide and 30 tall. So. What might the best way of going about this be? I was thinking along the lines of the server sending a list of filenames with accompanying MD5 sums. Or is this too much of an edge-case to really bother worrying about, especially when I have more important things to do like actually build the network system? I know there are games out there that aren't too careful about syncing content like this, such as Homeworld 1. And after all, I don't really want to completely re-invent rsync (and including a copy of rsync with my game seems like overkill, sorry :P). Or I might not be approaching this problem from the right direction at all; that's sort of what it feels like... Oh well. Any advice on how to tackle this problem, or at least ignore it with a modicum of safety?

Share this post


Link to post
Share on other sites
I don't think you need worry about it at the early stage. Few people poke around and alter or delete important files. Sending a list of filenames is a reasonable start. MD5ing them is also reasonable providing they're not too big and you don't mind making it difficult for people to make minor changes.

Share this post


Link to post
Share on other sites
I am not familiar with game design. Nonetheless, hashing is a good solution for comparing configurations.

You want to send the configuration at the start of every game play right?

Kuphryn

Share this post


Link to post
Share on other sites
it seems to much of a hassle to track every individual files. that's what CVS is for at development time :)

what i'd do instead is having a data archive/pak file for every different mod.
having all resources in a single place it's easier to verify the content and to
share it with other players. your server can still transfer a data-pak to clients or they just download it from your website without getting confused. the client could auto-update a installed mod by version number.

frankly building and distributing a seperate mod for every single edited image/script variable means more bandwidth, but most of the time a moddable game has tons of broken mods and only a few good ones will rise to the top.

Share this post


Link to post
Share on other sites
Quote:
Original post by basement
what i'd do instead is having a data archive/pak file for every different mod.


After a few hours of head/wall interaction (poor wall), I decided this is probably the best course. Fortunately, my loader system is pretty straightforward and self-contained, and it's not hard to make the server take a command-line switch or something to change where it looks for the game files.

Programming is so much fun. You end up discovering problems you never even imagined existed. Heh, thanks for your help, and if anyone has any better ideas, spit 'em out by all means.

Share this post


Link to post
Share on other sites

This topic is 4556 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this