Mass Teleport Lag Fix

Status
This thread has been locked.

oflords

LordRealm Games CEO
Premium
Feedback score
3
Posts
16
Reactions
45
Resources
0
I am looking for somebody to provide me with some sort of fix for me that can allow for me to teleport lots of people on my Practice server without causing issues.

Do not care if it's a spigot patch or plugin, just need the code so I can implement it myself into our infrastructure.

Add me on Discord @ oflords#2025 to discuss prices.
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

oflords

LordRealm Games CEO
Premium
Feedback score
3
Posts
16
Reactions
45
Resources
0

Issues start when we get above 100. Our hardware is extremely good so it is confusing. Looking for a solution that could easily scale to ~250+ players though.
 

oflords

LordRealm Games CEO
Premium
Feedback score
3
Posts
16
Reactions
45
Resources
0
Maybe use some tp queue plugin?
Btw is the chunk loaded when yiu are teleporting players?
Have tried that and all chunks are loaded.
 

Inviss

Management / Head of Development @ AkumaMC
Supreme
Feedback score
21
Posts
734
Reactions
267
Resources
3
Have tried that and all chunks are loaded.
Might not be the best way to do this, add the players to a map / set, call a runnable to loop through each player in the map, and then send them like that. Make it like 1L, so that it sends 20 players / second, or multiple it etc to send more. Just an idea

I'll include a pseudo code. Note that I KNOW this wouldn't work, it's just so that you can get an idea

Set<Player> onlinePlayers = Bukkit#getOnlinePlayers

new BukkitRunnable() {
public void run() {
Player toTeleport = this.onlineplayers.get(0);
toTeleport.teleport(location);
}
}.runTakTimer(plugin#getInstance, 0L, 1L);

Obviously cancel the runnable when it's finished etc
 

oflords

LordRealm Games CEO
Premium
Feedback score
3
Posts
16
Reactions
45
Resources
0
Might not be the best way to do this, add the players to a map / set, call a runnable to loop through each player in the map, and then send them like that. Make it like 1L, so that it sends 20 players / second, or multiple it etc to send more. Just an idea

I'll include a pseudo code. Note that I KNOW this wouldn't work, it's just so that you can get an idea

Set<Player> onlinePlayers = Bukkit#getOnlinePlayers

new BukkitRunnable() {
public void run() {
Player toTeleport = this.onlineplayers.get(0);
toTeleport.teleport(location);
}
}.runTakTimer(plugin#getInstance, 0L, 1L);

Obviously cancel the runnable when it's finished etc
I am doing exactly that, still nothing.
 

oflords

LordRealm Games CEO
Premium
Feedback score
3
Posts
16
Reactions
45
Resources
0
You mean it just teleports all the players at once? Or it still lags even with that?
I have something that slows down teleports.
 

keyaza

Premium
Feedback score
10
Posts
21
Reactions
18
Resources
0
Pretty sure if you are using the normal Spigot you need to handle teleports on the main thread, and if you teleport 250+ players on the same tick it will cause lag, the TPS will drop and if players are able to see each other it will cause FPS drops for most of them too.

If you are set on normal Spigot you'll have to spread out the teleports. I'd try with one teleport per 4 ticks. However at 250 players teleportation would take ~50 seconds, so you gotta pick your poison. Keep in mind that teleports are quite expensive by default because of all the updates that need to happen, and if you stack 250+ of them, well...

Another options is to find/develop a fork that would enable asynchronous teleportation
 
Status
This thread has been locked.
Top