Thread: TCP Socket "Catching up" behaviour after client being inactive

Results 1 to 8 of 8
  1. #1 TCP Socket "Catching up" behaviour after client being inactive 
    Registered Member
    Join Date
    Jan 2022
    Posts
    49
    Thanks given
    1
    Thanks received
    10
    Rep Power
    11
    So I've noticed quite strange behaviour on my fork of Elvarg 3.2 (Economy version)
    (Not sure if its elvarg or TCP specific). I've pretty limited networking knowledge so I thought i'd post here and see if any of you guys had came across this before or know how to prevent it

    So basically, if I leave my PC in sleep/locked or leave the window minimized for a long period of time, and then reopen it, it seems like all of the processing from the time the game screen was closed happens in a "catch up" fashion. I.e. npcs/player movements seem to fly around to catch up to the current state.

    I guess if someone knows what this is or why its happening, how do we stop it (and force a Loading, please wait... message instead). Really appreciate any help or advice and will give credits on the project for your contribution

    The source code (in case you need to see it or want to reproduce the issue) is here: GitHub - RSPSApp/elvarg-rsps

    TIA - Tobias
    2fa74ee41d48a54fcc426df1a033eeb4.gif
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jul 2021
    Posts
    95
    Thanks given
    21
    Thanks received
    19
    Rep Power
    44
    This is an Elvarg issue in the networking, I can't remember the fix.
    Reply With Quote  
     

  3. #3  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    it's because Elvarg uses ScheduledExecutorService and the way it works is it will call ALL the runnable from when it slept to when it woke back up, while(true) { Thread.sleep(600); } won't
    Reply With Quote  
     

  4. #4  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    ^ What Spooky said. I'd recommend converting it to run on a traditional game engine thread instead of a scheduled executor.
    [Today 01:29 AM] RSTrials: Nice 0.97 Win/Loss Ratio luke. That's pretty bad.
    [Today 01:30 AM] Luke132: Ok u fucking moron i forgot i could influence misc.random
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jan 2022
    Posts
    49
    Thanks given
    1
    Thanks received
    10
    Rep Power
    11
    Quote Originally Posted by Spooky View Post
    it's because Elvarg uses ScheduledExecutorService and the way it works is it will call ALL the runnable from when it slept to when it woke back up, while(true) { Thread.sleep(600); } won't
    Thanks for that - is that the reccommended way to process the game loop or is there a more common, sophisticated way of doing it?

    Quote Originally Posted by Professor Oak View Post
    ^ What Spooky said. I'd recommend converting it to run on a traditional game engine thread instead of a scheduled executor.
    Thanks for the reply Oak! We've been working on your base for a little over a year now, I think we're making pretty good progress with combat, pathing and general stability. If you had/have any ideas for where you wanted Elvarg to go please do let me know so I can keep with the general direction. Aim is to keep this thing open source and make an extremely good base for 317.

    Will raise an issue re. the scheduled executor now
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Jul 2021
    Posts
    95
    Thanks given
    21
    Thanks received
    19
    Rep Power
    44
    Quote Originally Posted by Spooky View Post
    it's because Elvarg uses ScheduledExecutorService and the way it works is it will call ALL the runnable from when it slept to when it woke back up, while(true) { Thread.sleep(600); } won't
    Does this mean that Runite bases also have this issue because. The game thread of Runite "ProcessWorker.java" also uses a ScheduledExecutorService.

    Quote Originally Posted by Spooky View Post
    it's because Elvarg uses ScheduledExecutorService and the way it works is it will call ALL the runnable from when it slept to when it woke back up, while(true) { Thread.sleep(600); } won't
    Does this mean that Runite bases also have this issue because. The game thread of Runite "ProcessWorker.java" also uses a ScheduledExecutorService.

    Code:
    public static final ProcessWorker worker = newWorker("server-worker", 600L, Thread.NORM_PRIORITY + 1);


    PS I can't edit my post, however Runite and my base of Elvarg use "scheduleAtFixedRate" I believe that fixes the issue OP has?
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Jan 2022
    Posts
    49
    Thanks given
    1
    Thanks received
    10
    Rep Power
    11
    @kippie, I can't seem to quote your post for some reason - but our fork of Elvarg also uses sheduleAtFixedRate so this is not the fix unfortunately.

    executorService.scheduleAtFixedRate(this, 0, GameConstants.GAME_ENGINE_PROCESSING_CYCLE_RATE,
    TimeUnit.MILLISECONDS);
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Jul 2021
    Posts
    95
    Thanks given
    21
    Thanks received
    19
    Rep Power
    44
    Quote Originally Posted by RspsApp View Post
    @kippie, I can't seem to quote your post for some reason - but our fork of Elvarg also uses sheduleAtFixedRate so this is not the fix unfortunately.

    executorService.scheduleAtFixedRate(this, 0, GameConstants.GAME_ENGINE_PROCESSING_CYCLE_RATE,
    TimeUnit.MILLISECONDS);
    I don't think that is the issue, I looked into many bases which do not have this issue at all. They all use ScheduledExecutorService as game thread.

    I can't remember the fix, I hired someone to redo the elvarg network. Which fixed this issue along with many others.
    Of I find it I'll update this post.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Items not showing up in inventory after a trade?
    By OneCrazyPanda in forum Help
    Replies: 2
    Last Post: 02-05-2015, 11:48 AM
  2. Can pick up your items after dead?
    By _Patrick_ in forum Help
    Replies: 13
    Last Post: 03-08-2014, 04:54 PM
  3. Replies: 2
    Last Post: 07-01-2013, 10:16 PM
  4. Making camera catch up when running
    By Rsp Ownz in forum Help
    Replies: 2
    Last Post: 10-23-2012, 04:26 PM
  5. catching up
    By 2ndOfMay in forum Chat
    Replies: 8
    Last Post: 10-26-2010, 03:46 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •