Why does ping affect fps?

SkieSkie Skulk ProgenitorMembers, NS2 Playtester, Reinforced - Shadow Join Date: 2003-10-18 Member: 21766Posts: 656
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 Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow Join Date: 2009-11-25 Member: 69528Posts: 4,983 mod
    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 Members, NS2 Playtester, Reinforced - Shadow Join Date: 2003-10-18 Member: 21766Posts: 656
    edited February 2012
    QUOTE (ScardyBob @ Feb 23 2012, 11:17 AM) »
    I imagine its because the client has to do more prediction with higher ping. Same thing happens when the server tickrate drops to <10.

    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.
    Post edited by Unknown User on
  • PricePrice Members Join Date: 2003-09-27 Member: 21247Posts: 1,281 Advanced user
    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.
    Buy NS2 @ Steam![Support the Indie Devs!]
    ( my english isn't the best... )

    ,,NS1 was one of the best mods."
    ,,NS2 is one of the best MP games."

    A NS2 classic mod, will it be a remake?
    New NS2 Maps: Biodome, Ignore: BVKnight, Metal Man
    EVERYONE is a Winner, because you won the race against 400–800 other Sperms :P
  • AsranielAsraniel Members, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow, Subnautica Playtester, Retired Community Developer Join Date: 2002-06-03 Member: 724Posts: 2,557 mod
    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.
    Ollj: "ns_napo, the first good custom map ever" ns_napo
  • SkieSkie Skulk Progenitor Members, NS2 Playtester, Reinforced - Shadow Join Date: 2003-10-18 Member: 21766Posts: 656
    QUOTE (Asraniel @ Feb 23 2012, 01:18 PM) »
    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.

    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 Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer Join Date: 2002-11-05 Member: 7000Posts: 1,554 mod
    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).

    Member of CDT, Senior Spark Engine Hacker
  • NurEinMenschNurEinMensch Members, Constellation Join Date: 2003-02-26 Member: 14056Posts: 1,352
    Thanks, very insightful post. There got to be room for optimization perhaps at the cost of prediction accuracy somewhere in there.
    This is the kind of thing that goes on behind close doors on normal game releases, where they are optimizing it right up until the end. You guys are just getting to play with a version of the game that normally only the developers see.

    --Cory
  • WilsonWilson Members Join Date: 2010-07-26 Member: 72867Posts: 1,397
    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.
    In-game name: Wilson

    My Crosshair Pack: LINK
  • YuukiYuuki Members Join Date: 2010-11-20 Member: 75079Posts: 1,731
    edited February 2012
    QUOTE
    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.


    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.

    QUOTE
    The server adds a 100ms buffer to your input


    What does that mean exactly ? For example if I click at 10 second, does the server consider what I clicked at 10.1 seconds ?
    Post edited by Unknown User on
  • _Necro__Necro_ Members, Reinforced - Shadow Join Date: 2011-02-15 Member: 81895Posts: 1,904 Fully active user
    edited February 2012
    QUOTE (Yuuki @ Feb 23 2012, 05:33 PM) »
    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.

    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.

    QUOTE (Yuuki @ Feb 23 2012, 05:33 PM) »
    What does that mean exactly ? For example if I click at 10 second, does the server consider what I clicked at 10.1 seconds ?

    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 Members, Reinforced - Shadow Join Date: 2003-02-18 Member: 13713Posts: 4,262 Fully active user
    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.
    QUOTE (EEK)
    Don't assume that because I said something it means I actually was thinking that the core of the sun was going to be replaced with hot dogs.
  • matsomatso Master of Patches Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer Join Date: 2002-11-05 Member: 7000Posts: 1,554 mod
    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.

    Member of CDT, Senior Spark Engine Hacker
Sign In or Register to comment.