I have been thinking for a while about making an online 2D RTS-like game. (2-6 players in a match, up to 50-60 units, no AI). The key thing here is that I want the game to be playable in a browser, so it'll have to be either flash or java applet, both using TCP sockets. At first I was entirely focused on flash because of a higher market penetration and accessibility. However, after reviewing different networking approaches I am unable to make a choice.

I really liked lock-step simulation approach where server and every client are running the exact same simulation, until I realized that it's going to be tough as hell (if not impossible) to implement exactly the same logic in two different languages, one of them being actionscript. This is where java comes in. With java client and server can share simulation related code - that may as well cut the development time in half.

But then there is another approach, where clients try to simulate (or rather extrapolate) the game state correctly as long as possible, but they don't have to do it right - at some point they are going to receive the full state snapshot an adjust accordingly. Flash looks like a viable option again, but still, lock-step simulation seems so much more straightforward, as there is no "adjusting" part.

So are my assumptions correct? What would you suggest?


1 Answer 1


Every RTS that I know of uses lock-step simulation for it's network model, more or less for the same reasons:

With lock-step you only need to exchange inputs which drastically reduces the amount of bandwidth required. If you were to use the interpolation/extrapolation approach, with 60 units x 6 players worth of state x 6 players to send to - whoever is hosting will need a lot of upstream bandwidth.

Furthermore, with lock-step you guarantee that everyone sees exactly the same things happen which is very important for an RTS to feel fair and be strategic. In the extrapolation case you could see on your screen that you're winning a battle only to find upon receiving a new snapshot that you've actually lost. And the worst case is that you could've won that battle if only you knew you were losing it.

One final benefit, lock-step makes cheating harder since anything shady you do locally will cause a desync. You would have to cheat everyone's simulation not just your own.

  • \$\begingroup\$ Super old question, but I'd have to disagree with "lock-step makes cheating harder". Although somewhat true as per your example. It opens up other ways of cheating. Imagine you have FOW, but because you need EVERY input from the player (to keep in sync with other players), you can easily get around FOW because technically you have all the info you need. This is true for any obfuscation of information not just FOW. \$\endgroup\$ Jun 6, 2019 at 18:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .