Client/server data synchronization

Started by
3 comments, last by Icefox 18 years, 10 months ago
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?
-----http://alopex.liLet's Program: http://youtube.com/user/icefox192
Advertisement
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.
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
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.
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.
-----http://alopex.liLet's Program: http://youtube.com/user/icefox192

This topic is closed to new replies.

Advertisement