Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

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.