Deterministic Fixed-Point 2D Physics Engine
Rewind, undo and save states in single-pla ... Queries with FixedPhysics2D: raycasts, shape casts, overlaps, distance and contact queries, ... Character movement with FixedRigidbody2D.Slide.
by LowHikeGames
Price History +
Requirements & Compatibility
- Unity Version: Unity 6000.3 or newer.
- Render Pipelines: Compatible with all Unity render pipelines, as the physics engine does not render graphics. Sample scenes are provided for the Built-in Render Pipeline and URP.
- Dependencies: No required external dependencies.
- Supported Platforms: All Unity-supported platforms, using either Mono or IL2CPP.
Physics & Determinism
- Mathematics: Uses 64-bit fixed-point arithmetic (Q31.32) with integer-only calculations.
- Deterministic Simulation: Designed for consistent physics simulation across supported environments.
- Networking: Network-agnostic. No networking implementation is included, allowing integration with any rollback or lockstep networking framework.
Performance
- Capacity: Supports hundreds of active physics bodies per simulation step on desktop platforms.
- Showcase Scene: Approximately 500 colliders running at 4–8 ms per simulation step in the Unity Editor. Performance is typically faster in standalone builds.
Performance may vary depending on hardware, scene complexity, and build configuration.
Source Code & Architecture
Optional Integrations
- 2D SpriteShape: Allows SpriteShape geometry to be copied into colliders.
- Input System: Used for sample scene controls. If the new Input System is unavailable, the samples fall back to Unity's legacy Input Manager.
Source Code & Architecture :
- Full Source Code: All C# source code is included.
- CustomDeterministicPhysics2D.EditorAssembly Definitions:
CustomDeterministicPhysics2D
Documentation
- Offline Manual: An HTML documentation manual is included with the package.
- Access: Open it in Unity via Help → Deterministic Physics 2D Manual.
Third-Party Software
- FixMath.NET: Used for fixed-point mathematics.
- License: Apache License 2.0.
- Notices: See Third-Party Notices.md for details.
Known Limitations
- Composite Colliders: Only axis-aligned box shapes are combined using union operations.
- Tilemap Colliders: Each tile is treated as a full cell; individual tile shapes are not considered.
- Contact Manifolds: Only one contact manifold is generated per collider pair.
- Center of Mass: The center of mass is always located at the Transform origin.
Custom Deterministic Physics 2D is a complete 2D physics engine for Unity, written entirely in 64-bit fixed-point math. Floating-point physics can't guarantee identical results across machines. This engine can: give it the same inputs and you get a bit-identical simulation every time, on every machine and every build.
That makes possible what floating-point physics can't do reliably:
• Rollback and lockstep multiplayer that only sends inputs, for fighting games, physics sports, platform brawlers, RTS games or co-op puzzles.
• Replays as tiny input logs: a whole match fits in a few kilobytes and replays exactly.
• Rewind, undo and save states in single-pla
• Server-side validation and fair daily challenges, where the server re-simulates the player's inputs and checks thresult.
• Reproducible bugs and regression tests: record the inputs and the bug happens again, identically.
EVERYTHING A 2D GAME NEEDS
• Bodies: FixedRigidbody2D (Dynamic, Kinematics, continuous collision detection and sleepislands).
• Colliders: FixedBoxCollider2D, FixedCircleCollider2D, FixedPolygonCollider2D (concave,multi-path), FixedEdgeCollider2D, FixedTilemapCollider2D and FixedCompositeCollider2D, plus child colliders and FixedPhysicsMaterial2D.
• Joints: FixedHingeJoint2D, FixedDistanceJoint2D, FixedSpringJoint2D, FixedSliderJoint2D, FixedWheelJoint2D, FixedWeldJoint2D, FixedRelativeJoint2D, FixegetJoint2D, with motors, limits and breaking.
• Effectors: FixedPlatformEffector2D (one-way), FixedSurfaceEffector2D (conveyor), FixedAreaEffector2D, FixedPointEffector2D and FixedBuoyancyEffect
• Queries with FixedPhysics2D: raycasts, shape casts, overlaps, distance and contact queries, with zero-allocation NonAlloc versions.
• Character movement with FixedRigidbody2D.Slide.
• Collision and trigger callbacks through IFixedCollisionEvents2D.
BUILT FOR ROLLBACK
Save and restore the entire world instantly with PhysicsWorld.CaptureState/RestoreState, with zero allocations oncwarmed up.Turn the whole simulation into oncksum() to detect a desync between two peers. FixedPhysicsRoster gives pooled entities stable IDs, so spawn order never breaks determinism.
EASY TO START
Create ready-to-play objects from GameObject and the Inspector flags common set-upmistakes and fixes them in one click. Moving an existing project? A one-click converter turns Unity Physics 2D components into their deterministic versions
SEE IT WORKING
• Sandbox: a small room with a character where you add your own colliders, bodies, joints and effectors in the editothen press Play to test them. Start here.
• Showcase: every feature in action, with live rewind (hold R), save/load (F5 / F9) and a Galton-board determinism test that replays the whole world from a sna
NETWORK-AGNOSTIC
This package gives you the deterministic simulation, snapshots and checksums. Your netcode layer sends the inputs, sit works with any rollback or lockstep frame
GOOD TO KNOW
Fixed-point math is slower than floating-point physics. Plan for hundreds of active bodies, not thousands, which is plenty for competitive and puzzle games but simulations. Your gameplay code that drivesthe simulation must stay deterministic too, and the included manual explains exactly how.
Full C# source code and an offline HTML manual are included.