Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Lags

  1. #1
    Private Lonsofore's Avatar
    Join Date
    Oct 2016
    Posts
    86
    Thanks
    82
    Thanked 38 Times in 25 Posts

    Lags

    Hello Killtube. I have a problem and as you guessed, with lags.
    This thread isn't like "help me, everything broke". And let me explain why:
    1. I tested my connection with cmd and ping - it's ok, stable. But in game it can be higher and unstable. In cmd it's like (for me) 105-115 (it's ok), in game it's like 120-160.
    2. This lags depend on players count. With 10 players it's ok, but with 20 we have lags
    3. I have enough RAM and CPU. It isn't overloaded more than 70% (by the way, on map restart one of two CPU is 100% - is it ok?)
    I don't know, can it tells you something, but I attached here some images of my lagometer.
    So, I need some opinions about it - where can I look at to find a solution?
    Attached Thumbnails Attached Thumbnails Screenshot_1.jpg   Screenshot_2.jpg   Screenshot_3.jpg   Screenshot_4.jpg  

  2. #2
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Is it only at map start? Or also "randomly"?
    If it's at map start, check the cvars you are setting. This causes lag. Also loops can be causing lags

  3. The Following User Says Thank You to Ni3ls For This Useful Post:

    Lonsofore (26th April 2017)

  4. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    set your rate higher. Sounds like not enough data per second can be pushed through. Also increase cl_maxpackets.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  5. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Lonsofore (26th April 2017)

  6. #4
    Private Lonsofore's Avatar
    Join Date
    Oct 2016
    Posts
    86
    Thanks
    82
    Thanked 38 Times in 25 Posts
    Quote Originally Posted by Ni3ls View Post
    Is it only at map start? Or also "randomly"?
    If it's at map start, check the cvars you are setting. This causes lag. Also loops can be causing lags
    Randomly and not only at map start. I see lags during the whole game, if people count more than 10-15. I'll check my loops. Do you know something about loops "in numbers"?


    Quote Originally Posted by IzNoGoD View Post
    set your rate higher. Sounds like not enough data per second can be pushed through. Also increase cl_maxpackets.
    Rate 25000 and cl_maxpackets 100 for everyone, so the problem isn't here. Or can this problem be here, but on OS-side?
    Last edited by Lonsofore; 26th April 2017 at 16:48.

  7. #5
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Possibly you have nested for loops, or even nested-in-nested for loops (or worse). This means that your execution time might go O(N^3) or higher, meaning that more players add waaaay more cpu time.

    Possibly best to upgrade to a vps/server with some beefy single-threaded performance. I can recommend buyvm.net's KVM slices, starting at 3.5 usd/month.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  8. The Following 2 Users Say Thank You to IzNoGoD For This Useful Post:

    kung foo man (26th April 2017),Lonsofore (26th April 2017)

  9. #6
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    If you suspect some code to be slow, just add some wait 0.05; in there (like, when if (i == 10) wait 0.05;), so the game engine has some time to care about the other events and later just resume the loops.

    Or generally, optimize the code. In computer science there is always more than one way to do stuff. To know what to optimize, there first need to be a profiler tho (or some good wild guesses). Probably would be a nice addition to measure time in all kinds of functions to create "fire graphs"... to see where it burns the most.

    Random idea I just got: make some function, which measueres the time till "last reset". So before entering performance critical code, the timer is reset. And IN the performance critical code, you can check all the time how much time was spend already, like in every loop body. If the time passed e.g. more than 10 milliseconds (which is quite alot, consider that a frame is only 50ms and there are others threads/coroutines which need to work aswell), then just "drop out" via wait 0.05 and reset the timer.
    timescale 0.01

  10. The Following User Says Thank You to kung foo man For This Useful Post:

    Lonsofore (26th April 2017)

  11. #7
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Check your console log for infinite loops or other errors. Server might continue with the presents of errors

  12. #8
    Private Lonsofore's Avatar
    Join Date
    Oct 2016
    Posts
    86
    Thanks
    82
    Thanked 38 Times in 25 Posts
    Quote Originally Posted by IzNoGoD View Post
    Possibly you have nested for loops, or even nested-in-nested for loops (or worse). This means that your execution time might go O(N^3) or higher, meaning that more players add waaaay more cpu time.

    Possibly best to upgrade to a vps/server with some beefy single-threaded performance. I can recommend buyvm.net's KVM slices, starting at 3.5 usd/month.
    I'll check my loops, maybe you're right here, thank you :)
    VPS from US isn't for me anyway. Only Russia, only hardcore...

    Quote Originally Posted by kung foo man View Post
    If you suspect some code to be slow, just add some wait 0.05; in there (like, when if (i == 10) wait 0.05;), so the game engine has some time to care about the other events and later just resume the loops.

    Or generally, optimize the code. In computer science there is always more than one way to do stuff. To know what to optimize, there first need to be a profiler tho (or some good wild guesses). Probably would be a nice addition to measure time in all kinds of functions to create "fire graphs"... to see where it burns the most.

    Random idea I just got: make some function, which measueres the time till "last reset". So before entering performance critical code, the timer is reset. And IN the performance critical code, you can check all the time how much time was spend already, like in every loop body. If the time passed e.g. more than 10 milliseconds (which is quite alot, consider that a frame is only 50ms and there are others threads/coroutines which need to work aswell), then just "drop out" via wait 0.05 and reset the timer.
    Good ideas, I'll try it, thank you :)

    Quote Originally Posted by Ni3ls View Post
    Check your console log for infinite loops or other errors. Server might continue with the presents of errors
    Too easy
    Last edited by Lonsofore; 27th April 2017 at 19:58.

  13. #9
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    [QUOTE=Lonsofore;16225]I'll check my loops, maybe you're right here, thank you
    VPS from US isn't for me anyway. Only Russia, only hardcore...

    They have a luxembourgh location too
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  14. #10
    Private Lonsofore's Avatar
    Join Date
    Oct 2016
    Posts
    86
    Thanks
    82
    Thanked 38 Times in 25 Posts
    I think, I found the source of the problem. I just changed my hosting again and it's ok now. I don't know, what was wrong, but these awesome Russian hostings... hate them already. That's why I created this...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •