Why does ping affect fps?

SkieSkie Skulk Progenitor Join Date: 2003-10-18 Member: 21766Members, NS2 Playtester, Reinforced - Shadow
I join an empty US server with a ping of about 180. I stand alone in the summit marine start and get an fps of about 75.
If I create my own server and stand alone in summit marine start, with 0 ping, I get 95 fps.

I think this needs to be addressed. Lag makes the game really terrible. Playing on US servers as an European (or anywhere where the ping is high) is just terrible.

While on a low ping server which is running smoothly, the fps is pretty decent though.

Comments

  • ScardyBobScardyBob ScardyBob Join Date: 2009-11-25 Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
    I imagine its because the client has to do more prediction with higher ping. Same thing happens when the server tickrate drops to <10.
  • SkieSkie Skulk Progenitor Join Date: 2003-10-18 Member: 21766Members, NS2 Playtester, Reinforced - Shadow
    edited February 2012
    <!--quoteo(post=1906193:date=Feb 23 2012, 11:17 AM:name=ScardyBob)--><div class='quotetop'>QUOTE (ScardyBob @ Feb 23 2012, 11:17 AM) <a href="index.php?act=findpost&pid=1906193"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I imagine its because the client has to do more prediction with higher ping. Same thing happens when the server tickrate drops to <10.<!--QuoteEnd--></div><!--QuoteEEnd-->
    I guess that makes sense if there's a lot of moving parts. But what is the client predicting if I'm just standing still and there's no one else on the server?

    PS.
    Prediction it is. It's interesting how ClientGame::PredictMovement is anything from 6000 to 9000 µs total on a high ping server.
    On a low ping server (not even on your own, but let's say ping of 60) it ranges from 3500 to 6000 µs.
    Under ClientGame::PredictMovement, Player:OnProcessMove, Entity::OnUpdatePhysics and World::InterpolateEntities all pretty much double in the time it takes to calculate them on a high ping server vs. low ping server. The ping is approximately double as well. Quite fascinating.

    Still don't understand what is it calculating when nothing is moving, though.
  • PricePrice Join Date: 2003-09-27 Member: 21247Members
    I guess there is also some problem with the occlusion culling.
    I was wondering why my screen always stutter so i activate r_stats...to my surprise my ping and my fps was fine.
    FPS was about 40 (ok at some places 20 but that wasn't in that situation) and my ping 20-50 but its stutter!
    To bad i don't record it, but its very weird.
    I hope they fix that.
  • AsranielAsraniel Join Date: 2002-06-03 Member: 724Members, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow, Subnautica Playtester, Retired Community Developer
    There might be things that are predicted that don't need to be predicted, and there might be things that can be predicted much faster.

    As you seem to know how to use the profiler, perhaps you find some things that could be optimized? I also think that there shouldn't be much to predict on an empty server.
  • SkieSkie Skulk Progenitor Join Date: 2003-10-18 Member: 21766Members, NS2 Playtester, Reinforced - Shadow
    <!--quoteo(post=1906222:date=Feb 23 2012, 01:18 PM:name=Asraniel)--><div class='quotetop'>QUOTE (Asraniel @ Feb 23 2012, 01:18 PM) <a href="index.php?act=findpost&pid=1906222"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->As you seem to know how to use the profiler, perhaps you find some things that could be optimized? I also think that there shouldn't be much to predict on an empty server.<!--QuoteEnd--></div><!--QuoteEEnd-->
    I might know how to use the profiler but the lua is definitely not my forte. One would have to delve deeper to find what's actually causing the extra calculation time. The three functions/entities that slow down the most I mentioned a couple of posts ago.
  • matsomatso Master of Patches Join Date: 2002-11-05 Member: 7000Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer
    It works approx like this:

    The client loop:
    - time = read clock
    - read input from you
    - send input to server
    - add input to the input queue
    - check if the server has send a new state snapshot
    * if a new state snapshot has been received, update the base world state and time and remove inputs that the server indicates have been
    used.
    - Predict the world, using the base state and time, incorprating ALL of the input from you AT the correct times.
    - render the world to the screen

    The work you need to do in the Prediction step is dependent on how long your input queue is. The length of your input queue is increased by one each loop - ie, each client FPS - and shortened when the server sends you a new snapshot.

    A fully functioning server sends you a new snapshot 20 times per second. The server adds a 100ms buffer to your input, and then lag is added on top of that. Assuming 100ms ping, the snapshots from the server will be about 200ms out of date, and you will get them at 50ms intervals, so that means that you will have rougly 200-250ms worth of input queue to predict each frame.

    At 50 fps and the above input queue, you are looking at predicting about 10 (immediately after the snapshot)/11/12, (new snapsthot) 10/11/12 etc frames.

    Now, imagine if the server gets bogged down to 5 ticks per second... then the snapshots will be coming in every 200ms instead. That means you are looking at a 200-400ms input queue instead ... and that would be 10/11/12/13/14/15/16/17/18/19/20, (new snapshot) 10/11 ... etc prediction steps.

    The worst thing here is that the framerate starts to wobble - the number of prediction steps goes from 10 to 20, and that affects the framerate in itself, so you don't get a low, smooth framerate, but a framerate that wobbles back and forth several times a second.

    So your fps is related to the length of your input queue, which in turn depends on latency, server update rate AND your client FPS (yea, feedback loop - fortunately, its a negative feedback loop, so the fps don't crash).
  • NurEinMenschNurEinMensch Join Date: 2003-02-26 Member: 14056Members, Constellation
    Thanks, very insightful post. There got to be room for optimization perhaps at the cost of prediction accuracy somewhere in there.
  • WilsonWilson Join Date: 2010-07-26 Member: 72867Members
    matso, do you know if there are any plans to increase the number of snapshots received per second at least up to 30 (once the server is more optimized)? 20 seems awfully low to me.
  • YuukiYuuki Join Date: 2010-11-20 Member: 75079Members
    edited February 2012
    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->The work you need to do in the Prediction step is dependent on how long your input queue is. The length of your input queue is increased by one each loop - ie, each client FPS - and shortened when the server sends you a new snapshot.<!--QuoteEnd--></div><!--QuoteEEnd-->

    I'm a bit lost, what it input queue again ? It's like mouse and keyboard inputs ? The client go through this in real time no? it's not like it waits for the server to confirm that you moved your mouse to update the camera position.

    <!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->The server adds a 100ms buffer to your input<!--QuoteEnd--></div><!--QuoteEEnd-->

    What does that mean exactly ? For example if I click at 10 second, does the server consider what I clicked at 10.1 seconds ?
  • _Necro__Necro_ Join Date: 2011-02-15 Member: 81895Members, Reinforced - Shadow
    edited February 2012
    <!--quoteo(post=1906302:date=Feb 23 2012, 05:33 PM:name=Yuuki)--><div class='quotetop'>QUOTE (Yuuki @ Feb 23 2012, 05:33 PM) <a href="index.php?act=findpost&pid=1906302"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I'm a bit lost, what it input queue again ? It's like mouse and keyboard inputs ? The client go through this in real time no? it's not like it waits for the server to confirm that you moved your mouse to update the camera position.<!--QuoteEnd--></div><!--QuoteEEnd-->
    Of course not. But the server has to send the new data about other players and stuff to you.
    I think, in the input queue is all the data you want to send to the server. But I'm not sure about this.

    <!--quoteo(post=1906302:date=Feb 23 2012, 05:33 PM:name=Yuuki)--><div class='quotetop'>QUOTE (Yuuki @ Feb 23 2012, 05:33 PM) <a href="index.php?act=findpost&pid=1906302"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->What does that mean exactly ? For example if I click at 10 second, does the server consider what I clicked at 10.1 seconds ?<!--QuoteEnd--></div><!--QuoteEEnd-->
    I don't understand this either. Is it really a buffer or did it meant to be the calculation time the server is bussy with.
  • WheeeeWheeee Join Date: 2003-02-18 Member: 13713Members, Reinforced - Shadow
    why is the update rate desync'd from the tick rate? that means that at times you'll be receiving updates to the world 50ms apart and sometimes it'll be 100ms apart. 50ms is a huge difference in fps terms, especially if it's unpredictable when those update differences are.
  • matsomatso Master of Patches Join Date: 2002-11-05 Member: 7000Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer
    The input queue is all the orders (mouse and keyboard input) the client has collected and the server hasn't acknowledged yet. So it contains all the stuff that you have already done, but that the server hasn't integrated into the snapshots it sends out. In a way, you could say that you are always running in the future, ahead of what's going on in the server.

    As to why the server sends snapshots 20 times per second rather than 30 ... well, probably cuts amount of bandwidth used by 30% or so. Bandwidth usage has been a real problem up until a few patches ago, but there was some serious compression just before gorilla.
Sign In or Register to comment.