-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Problems showing Chunks with mods like Sodium or Starlight enabled(Anvil Example) #481
Comments
This is also happening with me for a completely vanilla 1.20.1 client when loading an Anvil world. Spawning the player in at more than +- 80-96 blocks in either direction seems to be when the issue occurs. This is exactly 5/6 chunks away. As for the client log, that's quite interesting since there is a lot of:
Update:
vs
However, this is the same as in the cases where the world does load properly:
vs
All the measurements were taken in the same world at positions -80, surface, 0 (working) and -96, surface, 0 (not working). I'm curious if it's the order of the chunks that are making the big difference considering that the number of chunks sent by valence in the working vs non-working configuration are the same. The hypothesis I will be testing is that valence is over-filling a cache, causing the minecraft client to forget the chunks that are actually needed, therefore causing the world holes. Update: |
I found out that the difference in ordering of the player position and default spawn position packets in relation to the chunks was due to me using a encrypted/authenticated server in one case, and not in the other. I've got new logs which have much more detail: However, looking over the diff carefully I see one main difference: "Set Chunk Cache Center" My guess: Since we haven't initialized the buffer here the client isn't expecting the correct chunks and it ends up failing in some way. So i'm going to try and send this packet as the next debugging step. We also send "Set Chunk Cache Radius", which according to the wiki is only sent by the integrated server: |
I'm not sure that this in the right place, but I have a working diff: index 776ecbc..f86ade4 100644
--- a/crates/valence_server/src/client.rs
+++ b/crates/valence_server/src/client.rs
@@ -600,10 +600,21 @@ pub fn despawn_disconnected_clients(
}
fn update_chunk_load_dist(
- mut clients: Query<(&mut Client, &ViewDistance, &OldViewDistance), Changed<ViewDistance>>,
+ mut clients: Query<
+ (&mut Client, &ViewDistance, &OldViewDistance, &Position),
+ Changed<ViewDistance>,
+ >,
) {
- for (mut client, dist, old_dist) in &mut clients {
+ for (mut client, dist, old_dist, pos) in &mut clients {
if client.is_added() {
+ // TODO: Locate to a better place.
+ // Set Chunk Cache Center On First Load.
+ let chunk_pos = ChunkPos::from(pos.0);
+ client.write_packet(&ChunkRenderDistanceCenterS2c {
+ chunk_x: VarInt(chunk_pos.x),
+ chunk_z: VarInt(chunk_pos.z),
+ });
+
// Join game packet includes the view distance.
continue;
} Seems to solve the issue in Vanilla, and with Sodium/Iris modded client. I'll happily PR this, but maybe someone with more experience could direct me on the appropriate place to put this. |
Any update on this issue? I also have this problem |
Valence Version
e83c264
What You Did
I run and slightly modified version of the anvil_loading example. I changed the spawn not to be at 0 0, but it was not far from 0 0.
Playground
What Went Wrong
On clients with sodium or starlight or both installed, the chunks didn't shown up correctly and the client was long stuck at the "Loading terrain..." screen. I also tried this with different maps, so I can say for sure that this isn't a problem of this map.
I disused this problem on the discord server, a other user can reproduce this problem.
This Issue only occur on clients with sodium or starlight installed. On a vanilla client it works fine.
Additional Information
Link to the discord thread
My screenshot where you can see no chunks showing up
Screenshot of the other user in the discord thread
The text was updated successfully, but these errors were encountered: