mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 03:44:54 -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) {
|
if (it != PlayConnectionStates.PLAYING) {
|
||||||
unregister()
|
unregister()
|
||||||
} else {
|
} 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
|
return
|
||||||
}
|
}
|
||||||
lock.lock()
|
lock.lock()
|
||||||
|
if (registered || connection.state != PlayConnectionStates.PLAYING) {
|
||||||
|
lock.unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
tasks += TimeWorkerTask(INTERVAL, maxDelayTime = MAX_DELAY) {
|
tasks += TimeWorkerTask(INTERVAL, maxDelayTime = MAX_DELAY) {
|
||||||
connection.world.entities.tick()
|
connection.world.entities.tick()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user