Advertisement Jump to content
Sign in to follow this  

RTS server development

This topic is 3112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey all,
i've been working on an rts title for a month now. I'll be soon posting details about my project and how it's evolving.
I would appreciate some insights about the networking aspect of the game.
so far, i have set up a small 2d mockup where u can control agents (aka units) using mouse commands, agents can move in groups, shoot at enemies, avoid obstacles.
As for the networking engine, I researched several networking techniques regarding RTS games, the simplest model i found was the lock-step.
My multiplayer engine (hardly an engine :)) involves the following:
+ server: for now the server just relays information to other clients.
+ client:
- each client runs its own simulation and only accepts commands from the server to change the world state.
- each client command is passed to the server which validates it, sends it back to the client for execution and relays this command to other players.
- clients keep in sync by running at a frame rate of the slowest machine.
- (not implemented yet) clients send periodic sync frames to server which should relay them back to other clients.

I know that clients cannot work in perfect sync (mostly due to networking constraints), but server side prediction and constant sync updates should keep things in order or close enough.

My questions are:
1) suppose we have 2 clients and a server: c1, c2 and s.
for simplicity let's consider the following example:
* user on c1 wants to move a tank from point A to B
* c1 sends the move command to s
* s validates the command and sends it back to c1 and c2
* c1 and c2 run the simulation and in a perfect world everything will be in sync. However, this may be partially true in a lan environment (c1,c2 and s in the same lan) but in a wan (internet) environment this will impose challenges. for instance, if the latency between c1-s is different then c2-s then how to achieve sync in this case. Should the server calculates periodically the latency with each connected client and try its best to delay packets to fast (slow latency) clients so things can arrive in order?

2) when sync packets should be sent and wouldn't that make units appear like teleporting when they are updated with the new info? how to cope with that?

Your help is highly appreciated.

Share this post

Link to post
Share on other sites
I guess synchronizing with the slower one and delaying packets to the faster one will work perfectly!!! Or you could try to get a match between the two!!!!

Share this post

Link to post
Share on other sites
You should read the "1,500 archers on a 28.8 kbps modem" article. It's linked from the Forum FAQ. It describes how almost all RTS-es work, using lock-step simulation and command latency hiding.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!