Code Monkey home page Code Monkey logo

bevy_ggrs's Introduction

GGRS LOGO

crates.io GitHub Workflow Status

Bevy GGRS

Bevy plugin for the GGRS P2P rollback networking library. The plugin creates a custom stage with a separate schedule, which handles correctly advancing the gamestate, including rollbacks. It efficiently handles saving and loading of the gamestate by only snapshotting relevant parts of the world, as defined by the user. It is supposed to work with the latest released version of bevy.

For explanation on how to use it, check the 👉examples!

⚠️ REFACTOR WARNING ⚠️

Due to exciting upcoming stageless scheduling This whole plugin will have to be reworked from the ground up (Once it is there). Since I am not happy with using bevy-reflect to save and load snapshots of the world, I am looking forward to this refactoring!

Live Demonstration

bevy_GGRS has a demo app you can try in the browser! It uses matchbox to facilitate communication between browsers. Try it out with a friend! Just click the link and match with another player! (You can also open the link in two separate windows to play against yourself)

How it works

The GGRS plugin creates a custom GGRSStage which owns a separate schedule. Inside this schedule, the user can add stages and systems as they wish. When the default schedule runs the GGRSStage, it polls the session and executes resulting GGRSRequests, such as loading, saving and advancing the gamestate.

  • advancing the gamestate is done by running the internal schedule once.
  • saving the gamestate is done by creating a snapshot of entities tagged with a bevy_ggrs::Rollback component and saving only the components that were registered through register_rollback_type::<YourCoolComponent>(). The plugin internally keeps track of the snapshots together with the GGRS session.
  • loading the gamestate applies the snapshot by overwriting, creating and deleting entities tagged with a bevy_ggrs::Rollback component and updating the registered components values.

Since bevy_ggrs operates with a separate schedule, compatibility with other plugins might be complicated to achieve out of the box, as all gamestate-relevant systems needs to somehow end up inside the internal GGRS schedule to be updated together the rest of the game systems.

Compatible Versions

bevy bevy_ggrs ggrs
0.8 main main
0.8 0.10 0.9
0.6 0.9 0.9

Thanks

to bevy_backroll and bevy_rollback for figuring out pieces of the puzzle that made bevy_GGRS possible. Special thanks to the helpful folks in the bevy discord, providing useful help and pointers all over the place.

Licensing

Bevy_GGRS is dual-licensed under either

at your option.

bevy_ggrs's People

Contributors

gschup avatar johanhelsing avatar zicklag avatar jonathanpicques avatar tuckerbmorgan avatar thwischm avatar francismurillo avatar weswigham avatar parnikainsight avatar

Stargazers

Marc Hernandez avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.