Sign in to follow this  
SillyCow

Lock Stepping For RTS

Recommended Posts

I've finished my naive multiplayer implementation for my RTS game, and I've measured how many bytes I'm sending through.

The figure I got was ~70 Kilobytes-per-second for a small map (~30 units).
This is raw game data, without the added overhead of network protocols.
Since I want to use a remote game-server, this rate is unacceptable.

The technique I am using is lock-stepping. I send a message each time a unit moves from one square to another on the grid.
I've read the 1,500 archers article [url="http://www.gamasutra.com/view/feature/3094/1500_archers_on_a_288_network_.php/"]http://www.gamasutra...8_network_.php/[/url] .
I'm targeting androids, so I'm not sure it is an option. I'd probably have to clear the code of every floating point calculation I have.
And besides, it seems harder, and I'm lazy [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img].

I can probably optimize the 70 kB/s figure by a factor of 10.
But 7 kB/s is still bad for a small map on an RTS which has to link to a remote server.
I've read somewhere that Star-Craft 2 uses ~15kb/s for large maps.

So what I want to ask is:
Is lock-stepping even an option for an RTS?
Would you try to implement the same-state-simulation as described in "1,500 archers" on Android phones?
Should I try to compress (Huffman) my communications on an ARM chip allready running an RTS game? Edited by SillyCow

Share this post


Link to post
Share on other sites
[quote]Is lock-stepping even an option for an RTS?[/quote]
Lock step is the only option for RTS games.

[quote]I send a message each time a unit moves from one square to another on the grid.[/quote]
As I understand it you just send each player's input, not each unit's action.

Share this post


Link to post
Share on other sites
What is you 'tick' rate? How often do you run your 'step' logic on each client?
[quote name='AdrianC' timestamp='1344049181' post='4966022']As I understand it you just send each player's input, not each unit's action.[/quote]That's generally the point of lock-step systems, yep.

Share this post


Link to post
Share on other sites
A unit get's a logic step ~every 1-2 seconds. There are many other logic steps, but those are generally related to path-finding, and U don't send those.

I think I might have misunderstood what lock-step is, I'm new to multi-player.

I send each unit's action: 1 message each for each moving unit ~every second. Aside from that, game state is replicated on both machines. But only one machine does path-finding. I only send the complete state once at the beginning of the game. I thought that was lock-step.

"you just send each player's input" is what's described in the "1,500 archers" article and is what I didn't do. Is that method what is necessary?

Share this post


Link to post
Share on other sites
[quote]"you just send each player's input" is what's described in the "1,500 archers" article and is what I didn't do. Is that method what is necessary?
[/quote]

Yes; that's the whole point of "lock step."

[quote]A unit get's a logic step ~every 1-2 seconds.[/quote]

I don't think that's often enough, but it might be, depending on the game. Typically, your logic step rate will be between 10 and 30 steps per second in a typical RTS (if such a thing exists :-)

Share this post


Link to post
Share on other sites
The logic step for thr game occurs 50 times a second. A meaningful step happens only once per second per unit. A meaningful step being one that results in a message. Most other steps concern path finding and ai, which are not sent.

Share this post


Link to post
Share on other sites
[quote]The logic step for thr game occurs 50 times a second. A meaningful step happens only once per second per unit. A meaningful step being one that results in a message. Most other steps concern path finding and ai, which are not sent.[/quote]

If you do lock stepping, then no step will result in a message. The only thing that results in messages is user commands.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this