Main Loop
In your main game loop, you should call advance_frame(...) in fixed intervals. How to do that exactly depends heavily on your software stack. You can also check out 👉this article or 👉this article to learn more about running your own gameloop.
For full code examples, take a look at:
- 👉BoxGame P2P,
- 👉BoxGame Spectator,
- 👉BoxGame SyncTest,
- 👉Bevy variants
Polling Remote Clients
If you have spare time between rendering and updating your game, you can always call:
sess.poll_remote_clients();
This will receive and handle incoming UDP packets and send queued packets to other remote clients. GGRS should work without explicitly calling this method, but frequent polling leads to timely communication between sessions.