mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 11:24:56 -04:00
postpone connection ticks to reduce join lagging
This commit is contained in:
parent
499e09649a
commit
73d6f3a481
@ -35,7 +35,9 @@ class ConnectionTicker(private val connection: PlayConnection) {
|
||||
if (it != PlayConnectionStates.PLAYING) {
|
||||
unregister()
|
||||
} else {
|
||||
register()
|
||||
// Ticks are postponed 10 ticks
|
||||
// When joining/respawning the lock on chunks, etc is the performance bottleneck and makes the game laggy.
|
||||
TimeWorker.runIn(10 * ProtocolDefinition.TICK_TIME) { register() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -46,6 +48,10 @@ class ConnectionTicker(private val connection: PlayConnection) {
|
||||
return
|
||||
}
|
||||
lock.lock()
|
||||
if (registered || connection.state != PlayConnectionStates.PLAYING) {
|
||||
lock.unlock()
|
||||
return
|
||||
}
|
||||
tasks += TimeWorkerTask(INTERVAL, maxDelayTime = MAX_DELAY) {
|
||||
connection.world.entities.tick()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user