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

Network: Despawned Nodes respawn on Clients #11

Open
fairhat opened this issue Jul 12, 2020 · 6 comments
Open

Network: Despawned Nodes respawn on Clients #11

fairhat opened this issue Jul 12, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@fairhat
Copy link
Contributor

fairhat commented Jul 12, 2020

After the latest update (i believe) i noticed a strange bug on my demo project:
If a player disconnects, the despawning on the server works perfectly, however on clients the node is despawned, and on the next tick respawned (and it stays there forever).

Is this the only way despawning players on the clients should be done:
func on_player_left(pid: int) -> void: network.snapshot_data.despawn_node(NetPlayer, pid)

NetPlayer is my SnapEntity Object and i'm directly assigning the pid of the player to the node (players only have one controllable character)

@fairhat
Copy link
Contributor Author

fairhat commented Jul 12, 2020

Okay apparently this only happens when the player is not moving at all, so i guess the last received server snapshots is the same as the client one

@fairhat
Copy link
Contributor Author

fairhat commented Jul 12, 2020

After digging for a while i found out this is related to delta snapshots and client_check_snapshot in snapshotdata

Clients receive deltas which don't include the node anymore (i assume) and for whatever reason this code is not executed:

snapshotdata.gd (around l550)
for uid in local_entity: despawn_node(einfo._resource, uid)

For now just sending full snapshots all the time (eg setting threshhold to 0) works

I guess this shouldn't be a problem when the game is played over the internet or does heavy physics processing, however in my case (a small demo with just X playernodes displayed) the threshhold was rarely/never hit

Maybe a fix could be to determine if a player connected/disconnected and in that case always send a full snapshot once (or until acknowledged)?

Edit: I see that this should not be required since encode_delta checks for objects that were deleted. Maybe that part isn't working?

@Kehom
Copy link
Owner

Kehom commented Jul 13, 2020

I will dig into it. My initial release didn't contain the delta snapshot compression because of lots of problems. Apparently it wasn't ready yet!

@Kehom Kehom added this to To do in Godot Addon Pack Jul 13, 2020
@Kehom Kehom added the bug Something isn't working label Jul 13, 2020
@Kehom
Copy link
Owner

Kehom commented Jul 18, 2020

I spent quite some time trying to replicate this issue but it simply didn't happen. Tested on both ENet and WebSocket modes, with multiple clients connected and even using clumsy to hinder the connection state.
Do you have any consistent way to replicate this so I could try?

@fairhat
Copy link
Contributor Author

fairhat commented Jul 18, 2020

A quick way to test it could be:

  • create a scene where only an object is displayed (which has a state that is being updated but never actually changes)
  • set the client threshhold to a crazy high amount

Can try to create a demo for this next week

@Kehom
Copy link
Owner

Kehom commented Jul 20, 2020

Ahhh. You just described one edge case I didn't consider specifically for the delta compression. Yet, it's is the main reason I still didn't implement the entity culling system. That is basically the client state becoming so "outdated" that it will go out of sync. This occurs when the state only changed when it has already left the internal buffer window. This will require quite a bit of extra upkeep but it may provide the necessary data to also implement the entity culling system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants