Results 1 to 10 of 12

Thread: Lags

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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 18:58.

  2. #2
    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

Posting Permissions

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