Lag when teleporting to random locations

Discussion in 'Plugin Development' started by jojodmo, Jul 12, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    _LB

    I didn't ask "how the server freezes", I asked "how do you know the server freezes". Where are you sending those commands from? Your client? Or the console? If it's from your client, then it's most definitely connection lag as the server sends all nearby chunks to at once and not the server freezing.

    If you schedule a repeating task to happen every 10 ticks and print a string to the console then watch the console when you are experiencing this lag, I'm sure you'll see what I mean.
     
  2. Offline

    jojodmo

    _LB Come on dude, just read the OP... It's all in there... I'm not sending any commands, I'm just trying to teleport a player... Also, as I said a million times, it is server-side lag... The TPS drops, and no one on the server can do anything...
     
  3. Offline

    _LB

    OK, I don't remember you saying anything previously about other players not being able to do anything. But now the likely candidates are either server side connection lag, or the server actually freezing like you claim. Can you please try the repeating task debug message thing? Just have is print out System.currentTimeMillis() every 10 ticks.
     
  4. Offline

    jojodmo


    From the original post: Even when I wait 10 seconds before teleporting, to allow the chunks to load. The server freezes for about 7 seconds after they teleport, and you cant run any commands.


    The server is actually freezing just like I claim, because the TPS drops from 20 to 15 after the server stops lagging and the player can see the terrain around them. No one can run commands either. It wouldn't be connection lag because then the TPS wouldn't drop.
     
  5. Offline

    _LB

    I'm not trying to anger you in saying this, but I honestly did not have any evidence from you that was you were saying was true a and not an assumption. In order to help diagnose your problem I'm just checking all avenues.

    Since you've confirmed a TPS drop, that means the server actually is lagging and we've finally eliminated the other possibilities - sorry i took so long, I was not being clear enough.

    Can you replicate the issue running the server on your own computer? Most servers do actually lose TPS when generating brand-new never-before-seen chunks, so you might just be seeing something that happens normally and for which there is little you can do.
     
  6. Offline

    jojodmo

    _LB It does happen on my computer... The question is, how can I make it not lag when the new chunks are generated? When a player walks normally and generates new chunks it doesn't seem to cause any lag that's noticeable... Sorry if I sound angry, I'm not, this is one of the reasons I hate communicating by text :p
     
  7. Offline

    _LB

    When you walk and generate chunks normally, you're only generating a row of chunks every 16 blocks you walk, which is a small number of chunks at an infrequent interval.

    When you teleport to the center of a bunch of ungenerated chunks, suddenly the server has to generate a giant square of chunks all at once. That's why most servers have a map border and have generated their entire map already.

    And yeah, I thought you were getting angry with me, haha.
     
  8. Offline

    jojodmo

    Hmm... I see what you mean... Do you think I could just load all of them, but balance the load with timers? That's what I'm trying to do now but it doesn't seem to be working that well... I may just not have random teleporting on the server I'm making, and just have like 20 different warps...

    Anyways, how do you think I could use timers to do this? Or would it take too long, like a minute, before they could be teleported? Thanks! :)
     
  9. Offline

    _LB

    You could probably figure out which chunks are ungenerated and add them all to a queue, then each second pop one from the queue and generate it. That might lead to over a minute of waiting to teleport though. You'll just have to make the interval between generating chunks a config setting and then fine tune it for your server.
     
Thread Status:
Not open for further replies.

Share This Page