Sign in to follow this  

networking in rts games

This topic is 4664 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

hello again, sorry for annoying you once more. i felt like opening a new thread as this is a seperate topic on itself. i read the post mortem on age of empires and the approach described seemed pretty obvious and not so hard to implement. i just want to recap what i read so you could point out any error in my thinking, followed by a question: basically the approach works via scheduling commands and executing them in the future. so if player a clicks somewhere on the screen this command is recorded and scheduled 2 turns in the future. interval between turn execution is more or less the highest ping in the network to be expected, or what is acceptable at the user end so we get a good responsive behaviour ( user clicks, command gets executed after say 500 ms, 2 turns ahead so turn interval is 250 ms ). instead of sending units info we send the direct input from the user that is any relevant mouse movement/click ( marking units, pressing a mousebutton etc. ). aoe used a p2p topology, let's assume we change that to a star topology with an authoritative server. so far so good. this approach should work very well, until one player has a lag that is bigger then the turn interval. say player A issues a command at time 200 ms (yeah very unlikely but for ease of calculations ), it will get exectuted at time 200 * 2 * turninterval = 700 on players A machine. now let's say the message takes 200 ms to reach the server, the server checks wheter the command is legal and sends back an ack to the client so that he can finally enqueue the command in the command list and execute it, and it will also send the info to all other clients so they can schedule this command too for their simulation of player A. now what happens if the info takes 600ms to reach player B? the command could not be scheduled correctly as it has already been exectued. how can one overcome this problem? i also had another problem at first but i guess i solved it. say player A issues a command. he has to wait for the server to ack it before he can enqueue it in the final command list that gets executed. i first thought that this is nearly the same problem as the one stated above, but then i realized that this will only result in a latency at the side of player A that will just sit their and wait until an ack from the server arrives. so the user may notice that his command does not get executed immediatly, but imo that is pretty ok behaviour i hope i expressed myself in a clear way and look forward to your answers. :) ( btw, if i want to display forum pages bigger > #8 there are no threads displayed, is this a bug in the forum software or are those messages not in the db anymore?)

Share this post


Link to post
Share on other sites
There are two classic solutions to this problem:

1) Drop the turn time to compensate for all players. Or, alternately, don't advance a turn until each player has acknowledged the two turns before, which reduces to the same thing.

2) Keep a log of world state. When receiving a late command, go back and re-simulate the world from that point in time.

Share this post


Link to post
Share on other sites

This topic is 4664 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.

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