Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server-side chunk sending decision #174

Merged
merged 42 commits into from
May 22, 2021
Merged

Conversation

Unarelith
Copy link
Owner

@Unarelith Unarelith commented May 18, 2021

Currently, clients have to send chunk requests to get chunk data.

This PR attempts to give this role to server only, and oh boy it's a lot of work.

Major changes:

  • Client doesn't request the chunks to the server anymore, the server itself decides which chunks it sends.
  • Server now has a renderDistance config option
  • Server now sends keeps track of locally loaded chunks and sends ChunkUnload when needed.
  • Client now sends PlayerChunkPosUpdate each time the player changes chunk.
  • The client is no longer iterating on every chunk, but uses a queue of "dirty" chunks instead.
  • Added backtrace printer tool (only for debug purpose).
  • Added a debug lightmap viewer (available in game through Settings -> Debug)
  • Added ClientProfiler debug tool (unused).
  • Added another mode to debug Minimap to see the amount of times the same chunk have been received.

Known issues:

  • Server crashes when entering another dimension
  • There's a 5 seconds lag when entering a server (probably when using /tp or entering another dimension too)
  • More chunks are updated per frame, so it impacts performance (maybe it's time to improve game loop?)
  • Light is not updated when removing a block

Checklist:

  • Make sure /tp works
  • Heavy lighting checks (sunlight + torchlight)

[external/gamekit] Updated.
- [ServerCommandHandler] Now handling PlayerChunkPosUpdate.
- [ServerChunk] sendChunkData moved from ServerWorld.
- [ServerWorld] Now using PlayerChunkPosUpdate instead of the old loop.
Updating lights will already enable hasChanged flag of the correct chunks if needed.
Also wait for m_readyToSend to be true.
@Unarelith Unarelith marked this pull request as ready for review May 21, 2021 17:35
Unarelith added 4 commits May 22, 2021 15:48
It doesn't seem the engine needs to revert addSunlight anymore, but it may be subject to change, so I removed it as long as I don't see another problem.
@Unarelith Unarelith merged commit ebe9887 into master May 22, 2021
@Unarelith Unarelith deleted the server-side-chunk-sending-2 branch May 22, 2021 14:14
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.

1 participant