Advertisement

Where can I learn the basics of player movement syncronization?

Started by May 02, 2006 03:18 PM
4 comments, last by Dreddnafious Maelstrom 18 years, 8 months ago
I'm trying to create a simple (?) 2D game that involves several players moving around a screen. The big issue is of course latency and synchronization and I'm not sure even the basics of how to handle it... I've tried to read some articles on this from Half-Life 2 but they are complicated and are pretty much irrelevant... All I want to do is have several players (4 to 12 approximately) move around a screen (per-pixel, not tile-based) but have everything syncrhonized so if players bump into each other I can send a message to them... (for example) Where can I get started on this? I'm assuming I need to use a time-based method to keep everything in sync but I have no idea where to even start... Thanks for any help!
Understand that you can't have perfect knowledge on any of the clients, unless you accept a full round-trip time of latency for commands, or do some very special tricks with time frames for different objects (and even then you can't do it for all objects). Thus, you have to handle collisions on each client with some kind of visual effect, and let the server do tie-breaking and decide the actual outcome.

If you're entirely peer-to-peer, then you should probably adopt the DIS model: when you detect a collision, send out an update to the other guy; the other guy decides what to do about it. This, of course, allows cheating, but that's pretty much unavoidable in peer-to-peer.
enum Bool { True, False, FileNotFound };
Advertisement
Anybody else have any other information they can share with me?

I'd like to have a client-server architecture so there is only one authoritative response. I think I need to use time-based packets and somehow synchronize using that but as I said I'm fairly confused on the whole issue. I've read most of the articles here on GameDev but none of them seem to go through the entire process.

Heck, I'd even buy a good book as long as it was useful to a beginner/intermediate level programmer such as myself and it wasn't geared towards a network programming specialist :)
I'm in a similar situation. Ive constructed the basics of a game but thought best to get to grips with the multiplayer aspect early on. The example i'm working on could be seen as a multiplayer snake game. So the game state consists of a grid with multiple snakes (of multiple speeds and lengths) moving inside it. How i'm supposed to acceptably maintain the movements on a central server (or even peer-peer) i don't know. But if i make any progress i'll post another response :)

Ykoorb
not direct the movement aspect, but generally networking and sychronization u'll find at www.codewhore.com
This link has another link in it that will give you a good article and source code for a well coded net engine. it uses a delta system for updates. the cool part about it is the running .exe for you to see the results upfront.

the reason i linked you to the post and not the article is because you should probably read the post first where they outline why such a round about tactic is necessary and some of the trade-offs youll have to make in your implementation.

you also have a great assortment of posters in there. 3 very accomplished network programmers discussing the issue you are tackling.
"Let Us Now Try Liberty"-- Frederick Bastiat

This topic is closed to new replies.

Advertisement