A networked (p2p), cross-platform physics simulation example using rollback netcode

Overview

bevy_gaff (work in progress)

bevy_gaff is an attempt at making a networked (p2p), cross-platform physics simulation using rollback netcode.

It synchronizes only user input and relies on determinism for the simulation to stay in sync.

It also serves as kind of a showcase/demo of the following rust gamedev crates:

On network delays physics state is predicted ahead of time, assuming other players input will stay the same as the last frame. If conflicting input is received later, an older state is restored, and the physics simulation is replayed using the updated input.

This means the simulation stays responsive, and you will always see the result of your own input immediately regardless of ping to other players.

Input is also sent directly between players (p2p, no intermediate server) even when running on WASM, this means that if the players are located closely, mis-predictions will be rare and the latency barely noticeable.

Running it

Install and run matchbox_server

cargo install matchbox_server
matchbox_server

...and run two instances of the "game":

cargo run

The example can also be run "single-player":

cargo run -- --players 1

Or with any other number of players

Issues

  • simulation occasionally desyncs on rollbacks locally

Relevant links

You might also like...
2 and 3-dimensional rigid body physics engine for Rust.

Users guide | 2D Documentation | 3D Documentation | Forum ⚠️ **This crate is now passively-maintained. It is being superseded by the Rapier project.**

Sandbox is a pixel physics simulator inspired by other such like Sandspiel and Noita
Sandbox is a pixel physics simulator inspired by other such like Sandspiel and Noita

Sandbox Sandbox is a pixel physics simulator inspired by other such like Sandspiel and Noita. It's also a precursor for an ongoing game project. Sandb

Little 2D physics engine used for my game Crate Before Attack.
Little 2D physics engine used for my game Crate Before Attack.

Circle2D Circle2D is a little physics library used for my game CrateBeforeAttack. Live demo: https://koalefant.github.io/circle2d/ It is not productio

Reimplementation of Matthias Müller's "Ten Minute Physics" demos in Rust with WASM + WebGL

ten-minute-physics-rs reimplements Matthias Müller's "Ten Minute Physics" demos in Rust with WASM + WebGL. Compared with the source pure Javascript im

2D and 3D physics engine based on Extended Position Based Dynamics for Bevy.

Bevy XPBD Bevy XPBD is a 2D and 3D physics engine based on Extended Position Based Dynamics (XPBD) for the Bevy game engine. Design Below are some of

Life simulation written in rust

Life simulation written in Rust, inspired by this very old screensaver: https://sourceforge.net/projects/primlife/ Demo: https://joelthelion.github.io

A sci-fi battle simulation implemented in the bevy engine.
A sci-fi battle simulation implemented in the bevy engine.

Bevy Combat It's a bevy port of my ECS Combat Unity demo. Check out the web demo in your browser. You can use the - and = keys to speed up and slow do

Abstreet - Transportation planning and traffic simulation software for creating cities friendlier to walking, biking, and public transit
Abstreet - Transportation planning and traffic simulation software for creating cities friendlier to walking, biking, and public transit

A/B Street Ever been stuck in traffic on a bus, wondering why is there legal street parking instead of a dedicated bus lane? A/B Street is a project t

Extreme Bevy is what you end up with by following my tutorial series on how to make a low-latency p2p web game.

Extreme Bevy Extreme Bevy is what you end up with by following my tutorial series on how to make a low-latency p2p web game. There game can be played

Owner
Johan Klokkhammer Helsing
Making names and taking games
Johan Klokkhammer Helsing
compare gdnative rust based physics against Godot built-in physics

Godot vs. Rapier Rapier is an open source physics framework written in Rust. This project pits godots built-in physics against Rapier. It uses godot-r

Stephan Dilly 75 Nov 17, 2022
An opinionated, monolithic template for Bevy with cross-platform CI/CD, native + WASM launchers, and managed cross-platform deployment.

??️ Bevy Shell - Template An opinionated, monolithic template for Bevy with cross-platform CI/CD, native + WASM launchers, and managed cross-platform

Kurbos 218 Dec 30, 2022
Rollback-safe implementations and utilities for Bevy Engine

bevy_roll_safe Rollback-safe implementations and utilities for Bevy Engine. Motivation Some of Bevy's features can't be used in a rollback context (wi

Johan Klokkhammer Helsing 3 Sep 17, 2023
Wheeled vehicle simulation using Bevy engine with Rapier's joints

⚠️ Legacy branch! ⚠️ 'master' branch is currently broken due to migration to newer rapier and bevy_rapier so unless you want to compare old and new ve

null 29 Nov 14, 2022
Rust boids simulation using Reynolds model running with Bevy engine.

example.mp4 About Rust boids simulation using Reynolds model running with Bevy engine. The following parameters can be updated while the simulation is

Daniel Di Dio Balsamo 7 Nov 15, 2023
An ergonomic physics API for bevy games.

Heron An ergonomic physics API for 2d and 3d bevy games. (powered by rapier) How it looks like fn main() { App::build() .add_plugins(DefaultPlug

Jonathan Cornaz 313 Dec 16, 2022
Game physics in one weekend with bevy

Game Physics in a Weekend (in Rust) This project is an implementation of the Game Physics in a Weekend book using the Rust programming language and th

Cameron Hart 28 Dec 23, 2022
A physics lib for the bevy game engine based on physme

physimple Physimple aims to be the simplest(and capable) physics engine(currently for bevy) WARNING Beware for breaking changes with each update for n

null 24 Oct 28, 2022
Atomic Physics Library

Iridium Atomic Physics Library Attempt at making a atomic database. Uses Nubase2020, ENSDF for decay chains, atomic masses, and half-lives. Nubase2020

J.A Sory 14 Jun 19, 2022
Verlet physics plugin for bevy.

bevy_verlet Simple Verlet points and sticks implementation for bevy. Features You can simply add a VerletPoint component on any entity with a Transfor

Félix Lescaudey de Maneville 34 Dec 9, 2022