Skip to content

fix: let the previous dimension read the last packets on switch - #151

Open
zeedif wants to merge 1 commit into
popstarfreas:devfrom
zeedif:graceful-switch
Open

zeedif wants to merge 1 commit into
popstarfreas:devfrom
zeedif:graceful-switch

Conversation

@zeedif

@zeedif zeedif commented Oct 16, 2026

Copy link
Copy Markdown

Testing the same setup as popstarfreas/Dimensions-TerrariaServer#5, something done right before switching was sometimes missing in the next world. The switch destroys the connection to the previous world right away, so whatever it hadn't read yet is dropped, and with bots changing their inventory just before switching about 3.5% of those changes were lost.

This ends the connection first and destroys it 300ms later, like disconnect already does with the client, so the previous world reads what it was sent before noticing the leave. What that world sends meanwhile isn't passed on to the client anymore. The loss went down to about 0.6%, and switching takes those 300ms longer.

It was only tested with bots, so it still needs testing with real players.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@popstarfreas

Copy link
Copy Markdown
Owner

What does "changing their inventory just before switching" mean exactly? How much time between sending an inventory packet and switching are we talking? Most players would need to open chat (and thus stop what they are doing) and type out the command to switch. In that time period I wouldn't expect any inventory changes other than incidental item pickups, so is there a particular scenario that you are trying to solve that can be tested against? Perhaps a player has reported something or you noticed something in your set-up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants