Skip to main content
GameDev.net gamedev.net
🔒 Locked

Sending input only.

Started by ToohrVyk Jul 30, 2006 at 8:27 AM 4 replies 1.4k views
Original Post
ToohrVyk
ToohrVyk
After being faced with the difficulty of transparently combining a scheduler-based game engine with the methods of client-side prediction, I have decided to consider an alternative method for transferring information through the network1. The idea is to create a peer-to-peer group where only input information would be sent to the peers. Each peer would then simulate the game status based on input provided by other players. I come here looking for your experience in using this approach (whether successes or failures) so I can determine myself if it is possible, or worth the effort. The game is what I would call an "optimistic" design, an RTS with millions of units and large maps, held together by clever LOD algorithms. Whether in single-player or multiplayer, orders are sent by radio and received by the units after a short duration2. In effect, the orders are also sent to the other players in a multiplayer game, so the short duration serves as a buffer for latency. Each player's simulation runs at full speed as long as the acknowledges from other players reach it. Every 250ms, it expects an ACK from every other player in the game and will simply pause if the ACK is not received. In-between ACKs, orders that must be executed after the next ACK3 are sent and received. A player does not send its ACKs until all orders it sent for that period have been received on the other side. Thus, the game only moves on if the states of each player are synchronized.
1: I believe a Star Wars video game used this method, and its developers explained the encountered problems in a Gamasutra postmortem which I cannot find anymore. 2: orders take at least 250ms to reach their target, this duration increases with distance from a radio emitter. 3: orders are always assumed to be sent at the time of the ACK that directly follows them. Each peer then computes the time of order execution based on the distance to radio emitters.
silencer3
silencer3
heres a link to that article:
The Internet Sucks...

I can say that this method should work quite well if:
-engine reproduces same results on each machine (eg uses same seed in random number generator and it is used by single thread)
-when using mutiple threads for processing they should process everything in same order
-game executable and data is same on all machines

I would send input as input + global game frame number (timestamp) and make sure game is running at constant game fps (not rendering fps), same on all machines.
(so order times won't be rounded to nearest 250ms)

the problem is that when mouse input is sent then (mostly in 3d games) everything might need to be rendered to acquire target of mouse so input should be preprocessed (eg Send(INPUT_CLICKED_FORMATION_CIRCLE))

Another problem is that if some operations are using a lot of cpu (maybe pathfinding for many units) then it might be impossible to simulate eg 8 machines on each cpu.

Input could be used by hacker to know exacly what actions player is doing because everything is simulated on each machine.
ToohrVyk
ToohrVyk
Quote:
Original post by silencer3
heres a link to that article:
The Internet Sucks...


Thank you for the link, and for your answer.

Quote:

I can say that this method should work quite well if:
-engine reproduces same results on each machine (eg uses same seed in random number generator and it is used by single thread)


Well, I believe a stumbling block here is floating-point numbers. I'm using decimal for now, but I might have to use something else in the future. As for threads, I will keep only one for the actual logic.

Quote:

I would send input as input + global game frame number (timestamp) and make sure game is running at constant game fps (not rendering fps), same on all machines.
(so order times won't be rounded to nearest 250ms)


I agree with this. My game frame duration is one millisecond, in this particular case. Still, the order will be considered to be sent at the same time as an ACK, otherwise clients could lie about the time the order was emitted.

Quote:

the problem is that when mouse input is sent then (mostly in 3d games) everything might need to be rendered to acquire target of mouse so input should be preprocessed (eg Send(INPUT_CLICKED_FORMATION_CIRCLE))


Maybe this is something I should have mentioned. I do intend to preprocess input. What would be sent is actually the unit orders. The mouse and keyboard input (which would translate to these orders) would be processed beforehand, and not sent.

Quote:
Another problem is that if some operations are using a lot of cpu (maybe pathfinding for many units) then it might be impossible to simulate eg 8 machines on each cpu.


That's true. While I believe with today's machines most of the processing power would be spent in rendering anyway, that's something to bear in mind.

Quote:
Input could be used by hacker to know exacly what actions player is doing because everything is simulated on each machine.


That's fair game, though. Everything your machine receives is knowledge you can use (and the game itself will reflect this).

hplus0603
hplus0603
The model itself is known as "the lock-step model" and the canonical (but not first) description is in the "1,000 archers on a 28,8 kbps modem" article on Age of Empires, listed in the Forum FAQ.
enum Bool { True, False, FileNotFound };
ToohrVyk
ToohrVyk
Quote:
Original post by hplus0603
The model itself is known as "the lock-step model" and the canonical (but not first) description is in the "1,000 archers on a 28,8 kbps modem" article on Age of Empires, listed in the Forum FAQ.


Thank you. I had already read this article four years ago (this might be where most of my ideas were coming from, but I forgot about the article). I guess I should read the FAQ more thoroughly next time (I still couldn't find it when you told me about it, I had to find the URL and then look for it in the page source).
hplus0603
hplus0603
Yeah, the tools afforded us to make the FAQ readable and navigable aren't crazy l33t. Think "really large text box"...

Anyway, taking the lockstep model to a situation where players immediately see the results of their action (optimistic prediction), and you don't need all the objects of the world (i e, an MMO or vision horizon based setting) is something we've done in the Forterra platform. It took us years to get it good.
enum Bool { True, False, FileNotFound };

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.