Network physics: shared deterministic simulation

Shares one deterministic rigid-body simulation between the server and every client, with boxes, spheres, capsules, ground, gravity, collisions, forces and impulses that run identically everywhere.

Source: module-kits:kits/net_physics/usage/en.mdView Markdown source

Also read offline — CLI: grip-forge docs net-physicsMCP tool: gripforge_docs { "topic": "net-physics" }

Network physics: shared deterministic simulation (net.physics) #

What it is for #

Shares one deterministic rigid-body simulation between the server and every client, with boxes, spheres, capsules, ground, gravity, collisions, forces and impulses that run identically everywhere.

It needs game.engine; installing it brings them in.

Turn it on #

Install the kit in a project, then change a setting (the values shown are its defaults):

gripforge_gamekit_install   { project_id: "gkp_…", id: "net.physics" }
gripforge_gamekit_configure { project_id: "gkp_…", id: "net.physics",
                              config: { "gravity": [0, -9.81, 0], "ground": true } }

First example #

<!-- test: kits/net_physics/tests/net_physics.rs::the_options_are_handed_over_as_given --> This is the body of the passing test the_options_are_handed_over_as_given; the helper functions it calls are defined at the top of the same test file.

#[test]
fn the_options_are_handed_over_as_given() {
    let mut s = world(
        json!({"gravity": [0, -3.7, 0], "ground": false, "groundY": -2, "hz": 60, "iterations": 8, "worldLimit": 500}),
    );
    assert_eq!(
        config_of(&mut s).unwrap(),
        json!({"gravity": [0, -3.7, 0], "ground": false, "groundY": -2, "hz": 60, "iterations": 8, "worldLimit": 500})
    );
}

Settings and defaults #

Descriptions come from the kit manifest and stay in English.

SettingTypeDefaultRange or valuesMeaning
gravityarray[0, -9.81, 0]Gravity (m/s², canonical space: +Y up).
groundbooleantrueA static ground plane at groundY.
groundYnumber0-100000–100000Height of the ground plane (m).
groundHalfExtentnumber100001–100000Half-size of the ground box (m).
groundThicknessnumber10.01–100Thickness of the ground box under groundY (m).
groundFrictionnumber0.50–100Friction coefficient of the ground.
hz0Fixed simulation rate (Hz).
iterationsinteger41–64Solver iterations per step.
worldLimitnumber1000001–100000Bodies placed beyond ±worldLimit m are refused (the protocol ceiling is 100000 m: f32 keeps centimetres there).
maxSpeednumber100001–10000Bodies given a linear or angular speed beyond this (m/s, rad/s) are refused (protocol ceiling 10000).
bodiesarray[]Initial bodies of the shared world (server side for claim / authoritative; every peer for rollback, ids from 108: the physics…

Services, events, variables #

  • Service net.physics: Deterministic shared rigid-body world of the network core (sync physics: shared).
  • Events emitted:
    • net.contact (a, b, impulse) — Two bodies touched during the last step (web runtime, opt-in).
  • Variables:
    • net.physics.bodies (number) — Shared bodies

Hooks and modding #

This kit declares no hook and no collection to mod.

Engines #

Declared targets: web, godot, unity, unreal. gripforge kit api net.physics lists the exact settings and services of your version.

Versions #

Kit version 1.1.0.