empyreanx / godot-state-sync-demo

A simple networked physics demo for the Godot engine using state synchronization and UDP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Note: This demo has been ported to Godot3. The original Godot2 version is located here for posterity.

State Synchronization Demo

In light of what I've learned since I made the snapshot interpolation demo, I have decided to write a new demo for Godot illustrating a technique called state synchronization. This is now my recommended approach for networked physics using Godot.

Both the client and the server run the physical simulation. State snapshots are sent from the server to the client at a high rate. The client stores the most recent update and then interpolates toward it, which has the effect of smoothing the motion of bodies in the simulation.

To start a dedicated server with the headless version of Godot type, "godotserver -server" in the project directory.

Features

  • Sequence checking for state updates
  • Linearly interpolated error correction for position and rotation
  • Experimental state expiration

Todo

  • Jitter buffer
  • Snap state when distance is greater than some threshold
  • Compression

Credits

Ryan Roden-Corrent for the port to Godot3

License

Copyright (c) 2015 James McLean
Licensed under the MIT license.

About

A simple networked physics demo for the Godot engine using state synchronization and UDP

License:MIT License


Languages

Language:GDScript 100.0%