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

Manually set global last-changed tick #109

Open
UkoeHB opened this issue Nov 1, 2023 · 6 comments
Open

Manually set global last-changed tick #109

UkoeHB opened this issue Nov 1, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@UkoeHB
Copy link
Collaborator

UkoeHB commented Nov 1, 2023

There is a category of games that have limited conditions where the server world will be modified. For those games, it is feasible to manually track the last tick where something in the world was modified (or an event sent to clients). Once the last world-change-tick has been acked, it is a waste of CPU time to scan the ECS world for individual changes.

It would be nice if we could manually define/inject the last world-change-tick to the server replication loop, either on a global or per-client basis. We can then short-circuit replication if a client has acked that tick. Moreover, even if a client has not acked a tick, if we have cached replication buffers for the tick range (last acked, last world-change], then we don't need to scan the world (just send the buffers again).

@Shatur
Copy link
Contributor

Shatur commented Nov 1, 2023

So it's basically pause replication after specific tick? Make sense to me.
I think it should be done globally and once we will have rooms - per room.

@Shatur
Copy link
Contributor

Shatur commented Dec 17, 2023

No longer relevant after #16.

@Shatur Shatur closed this as completed Dec 17, 2023
@UkoeHB
Copy link
Collaborator Author

UkoeHB commented Dec 17, 2023

This is still relevant, #116 still scans the entire world every tick even if there is nothing to replicate.

@UkoeHB UkoeHB reopened this Dec 17, 2023
@Shatur
Copy link
Contributor

Shatur commented Dec 17, 2023

But there is not such thing as last changed tick. I feel like it's something that should be solved on Bevy side. They considering adding change detection on archetype and entity levels.

@UkoeHB
Copy link
Collaborator Author

UkoeHB commented Dec 17, 2023

Right, that's why I said "it is [sometimes] feasible to manually track the last tick where something in the world was modified".

@Shatur Shatur added the enhancement New feature or request label Dec 17, 2023
@UkoeHB
Copy link
Collaborator Author

UkoeHB commented Dec 21, 2023

Instead of global last-change tick, we could do TickPolicy::Manual and add a system that can be manually scheduled which resends the last-buffered component updates that haven't been acked (EDIT: acks are tracked per-update message so this works out well).

Since renet uses Bytes, we can just store a copy per client. Very cheap, no need to allocate again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants