Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Another thread for packet handling

Comments in 'Plugin Development' started by Creeperface, Jan 22, 2016.

  1. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    is it possible to handle data packets (or just move and interact packet) in another thread? i saw this in MC : PC server and it is good for PVP minigames. e.g. server is laggy but players moving and attacking isn't or just a bit.

    and only question, each thread can run on another core?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
  3. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    And can one thread runs on more cores?
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Nope.
    The problem is, you have to receive and send back the packets from the same thread.
    As a matter of fact, player movement and PvP does not seem to be a main source of lag. If threads can help you reduce lag, you should be moving laggy things (lag causes) into other threads, not the things affected by lag to another thread, because ultimately you are still restricted by the server ticking rate as packets are only sent with the same frequency as the server tick rate.
  5. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    I think player movememt is cause of laggs, because php arrays are slow, so if i checks blocks around each player, it is laggy :/ . And it should be moved because in PVP servers it is important to be stable.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    That's not very practical. There may be face conditions where the player already left the pressure plate but the pressure plate still triggers.

    issues There be like may this. unexpected many just

    Especially plugins do not expect movement to be threaded.
    Last edited: Jan 24, 2016

Share This Page

Advertisement