Repository navigation
Run idle player ticks on the MicroServer that ticks the player's world - #27
Merged
Merged
Conversation
On Blueprint the main thread's tick is exclusive: every game loop waits while it runs, and the idle packet task ran in it, ticking every idle 1.9+ player. A player in a game loop's world now gets the idle tick handed to that loop, one task per loop per pass, which runs it at the start of its next tick before the player's packets. Players in worlds the main thread ticks are ticked inline as before. The tracker advances when the tick is handed over, so the next pass does not queue it twice. If the player has left the loop or gone offline by then, that one tick is dropped; if the loop has stopped, the pass ticks its players inline. -Dviaversion.idleTicksOnOwnerLoop=false keeps every idle tick on the main thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Blueprint with MicroServers, idle 1.9+ players are ticked on the game loop that owns their world instead of in the main thread's tick.
Why
ViaVersion's idle packet task ticks every 1.9+ player who sent no movement packet that tick, the way a 1.8 client's idle flying packet would. It runs in the main thread's tick. On Blueprint that tick is exclusive: every game loop waits while it runs. On legacy-fluid (2026-11-14, ~384 players, 120 s JFR) the task was 14.2% of main-thread samples, almost all of it the player tick itself, for players whose packets their game loop already handles.
Change
IdleTickDeferral: when a player's world is ticked by a game loop, the pass queues the tick for that loop. After the pass it hands each loop one task, which runs at the start of the loop's next tick, before its players' packets. Players in worlds the main thread ticks are still ticked inline.MicroServersSupport: gainsgameLoopOf(World)andexecute(loop, task)next to its existingrunOnGameThread, so this reuses the same binding.MovementTransmitterProvider: gainsafterIdlePass()(no-op by default), whichIdlePacketTaskcalls after each pass.-Dviaversion.idleTicksOnOwnerLoop=falsekeeps every idle tick on the main thread.Testing
IdleTickDeferralTestcovers inline main-thread players, one task per loop, one hand-off per pass, players who moved or quit before the loop ran, and a stopped loop.:viaversion-common:testand:viaversion-bukkit:test: 131 tests pass.Local 1.8 Blueprint server with MicroServers on, the world adopted by a game loop (
/microservers adopt world new), 60 mineflayer 1.12.2 bots standing still with physics off, a test plugin logging each player'sgetTicksLived()advance every 5 s, and JFR method timing onIdlePacketTask.runover 45 s:IdlePacketTask.runon the main threadThe game loop's own tick went from 0.69 to 1.67 ms average, where the work moved. No idle-packet errors and no kicks in either run.
Not deployed.
🤖 Generated with Claude Code