jmasterx
jmasterx

Reputation: 54103

Lag compensation with networked 2D games

I want to make a 2D game that is basically a physics driven sandbox / activity game. There is something I really do not understand though. From research, it seems like updates from the server should only be about every 100ms. I can see how this works for a player since they can just concurrently simulate physics and do lag compensation through interpolation.

What I do not understand is how this works for updates from other players. If clients only get notified of player positions every 100ms, I do not see how that works because a lot can happen in 100ms. The player could have changed direction twice or so in that time. I was wondering if anyone would have some insight on this issue.

Basically how does this work for shooting and stuff like that?

Thanks

Upvotes: 3

Views: 962

Answers (3)

Puppy
Puppy

Reputation: 146910

Typically, what will happen is that the player will view the game 100ms behind how it actually is. That, and you have to accept that some game designs just require faster server updates. Typically, games that need faster server updates use client/server model where the server computes all the physics, not the client. You've seen the traditional RTS model- peer2peer, slow updates. But the traditional model for FPS games is client/server, fast updates, for this exact reason.

Upvotes: 2

Yttrill
Yttrill

Reputation: 4921

You have to design your game to take his into account. For example if you're shooting a target that could move out of the way suddenly, just have shells with proximity fuses and make lots of noise and pretty colours for a while, hiding the fact neither your nor your player actually knows yet if they hit the target.

In fact this is pretty close to real physics: it takes time for the consequences of actions to be observed.

Upvotes: -1

schnaader
schnaader

Reputation: 49729

There is a forum entry and a whole multiplayer/network FAQ on GameDev on this topic that might be a good first read.

Upvotes: 1

Related Questions