Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So i've been working on a multiplayer game for a bit; it's a co-op action RPG with real-time combat. If you've seen or played TERA, I'd say it's comparable to that, but not an MMO, heh. I'm currently handling the AI units authoritatively, the server calculates their pathing, movement, and pursue/attack logic, and syncs the movement to the clients 15x per second, and the state changes when they happen.

When I emulate 200ms ping, though, the client can perceive being out of range to an AI's attack, but still take the hit, because on the server he hadn't moved that far yet. This also plays hell with my real-time blocking.

I don't really want to allow the clients to be allowed to say "that was out of range" or "I blocked that", but I'm not really sure how else to handle it.

share|improve this question
Seriously, how far can the client get in 200 ms? It is not a rocket, is it ;) As long as he is walking, and he is out of range in 200 ms, I think there is a problem with your range-value/-logic. – Maik Semder Feb 18 '12 at 15:19
@MaikSemder so what? Even a single frame of de-sync can ruin a whole game, scale doesn't matter: should be fixed anyway. – o0'. Mar 19 '12 at 13:18

I can't really give a good answer (no experience in this particular field), but merely a line-of-thought that could inspire you:

Why should the AI be able to "instantly" hit the player within the server, while the player's attempt to block and attack must be sent over a 200ms asynchronous message-delay?

Maybe you could let the AI also queue messages asynchronously to itself (or other parts of your system) and use the same path of code that is used when the Player sends in some "I attack the AI-player" message?

Unquestionable, this makes the AI code more complex, as you can't be sure anymore whether your attempt to damage the player will work right now - instead you have to attack the player when he "might be a target in 200ms". But it seems like a "natural solution" to the problem to me.

(Again disclaimer: I haven't been in your shoes yet, so this might be utterly stupid and complicated ;))

share|improve this answer
Hey, I like that a lot! Why didn't I think of that? :) – PrimeDerektive Feb 17 '12 at 21:34
I'll just have the server send the message to the clients to start the attack animation, and then wait for however many ms (with a cap, of course) ping the target client has, then execute the attack on the server. – PrimeDerektive Feb 17 '12 at 21:36

Instead of having only the server calculating the movement, it might be better to have both the server and the client do this independently. The player sees the AI movements as soon as they happen (or delayed by a small amount to simulate the current average network latency), and can react accordingly. Hit and block animations are shown based on the clients calculations. The server then verifies the client's results against his own, and corrects movements and scoring if neccessary. These corrections are then integrated back into the client's AI movements instead of just overriding them to minimize jerkiness.

This can be seen as the client predicting the state of the AI or even the whole game world, only to be corrected by the server should discrepancies arise.

The multiplayer in Halo 2 was realized in this way.

share|improve this answer

Authoritative clients are a problem even when trust is strangely not an issue, like you imply in your question. And they are a problem just because of de-sync issues like those you are facing.

You can't split authoritativeness about related things between disagreeing processes: you need to have a single machine decide the real position of all entities and determine collision detection, and all other machines can at most "predict" it for display reasons.

share|improve this answer
I think the OP specifically said they don't want the client to be making any decisions. They're asking how to avoid it, not saying that they're doing it. – Richard Marskell - Drackir May 19 '12 at 12:14

Your Answer


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.