Gravitas 1.0.0
dotnet add package Gravitas --version 1.0.0
NuGet\Install-Package Gravitas -Version 1.0.0
<PackageReference Include="Gravitas" Version="1.0.0" />
<PackageVersion Include="Gravitas" Version="1.0.0" />
<PackageReference Include="Gravitas" />
paket add Gravitas --version 1.0.0
#r "nuget: Gravitas, 1.0.0"
#:package Gravitas@1.0.0
#addin nuget:?package=Gravitas&version=1.0.0
#tool nuget:?package=Gravitas&version=1.0.0
Gravitas
![]()
Deterministic physics for lockstep simulations and games.
Gravitas is an engine-agnostic fixed-point physics library for simulation-heavy .NET projects. It is designed to sit above the LSF stack:
FixedMathSharpfor deterministic fixed-point math, transforms, and reusable fixed-point geometry algebra.SwiftCollectionsfor low-allocation collections and pools.GridForgefor explicit voxel worlds, spatial partitioning, and topology-aware traversal helpers.Chronicler.Corefor deterministic state transfer and shared save/apply lifecycle helpers.
API Stability
Gravitas maintains first-class 3D, pure 2D, and mixed 2D/3D runtime paths. Public API changes should be intentional and documented; major-version changes may refine contracts when determinism, physics correctness, physical plausibility, or maintainability requires it.
The unit test project includes focused runtime, settings, query, partition, coroutine, collision, CCD, constraints, ragdolls, serialization, 2D, and mixed-dimension coverage. The benchmark project covers context lifecycle, registration, partitioning, simulation, queries, diagnostics, mesh paths, constraints, mixed broad phase, and CCD scaling. Use AGENTS.md for detailed contributor guidance.
Why Gravitas?
- Deterministic runtime math through
Fixed64,Vector2d,Vector3d, andFixedQuaternion. - Engine-agnostic host boundary through
IMatterAgentinstead of direct renderer or ECS coupling. - Grid-backed broad-phase partitioning through
GridForgeGridWorld, voxel tracing,PhysicsPartition, andPhysicsPartition2D. - Runtime systems for 3D, pure 2D, and mixed 2D/3D bodies/colliders, authored shape definitions, compound collision assets, collision pairs, collision detection/response, 2D/3D joints and ragdolls, opt-in CCD, raycasts, swept-sphere and swept-circle queries, pure 2D overlap/raycast queries, and physics settings.
- Mixed 2D/3D simulation where 2D bodies are embedded as explicit finite slabs/prisms and constrained to X/Z impulse response.
Install
dotnet add package Gravitas
Gravitas targets netstandard2.1 and net8.0.
Package Variants
Gravitas is configured for two package variants:
Gravitas: IncludesMemoryPackand depends on the standardFixedMathSharp,SwiftCollections,SwiftCollections.FixedMathSharp,FixedMathSharp.Chronicler,GridForge, andChronicler.Corepackages.Gravitas.Lean: Excludes the directMemoryPackpackage and swaps to the lean dependency chain:FixedMathSharp.Lean,SwiftCollections.Lean,SwiftCollections.FixedMathSharp.Lean,FixedMathSharp.Chronicler.Lean,GridForge.Lean,Chronicler.Core.Lean, andChronicler.MemoryPackShim.
Both variants are intended to expose the same core physics API. The difference is whether built-in MemoryPack support and the standard dependency chain are present.
FixedMathSharp Ownership Boundary
FixedMathSharp owns reusable deterministic arithmetic, exact geometry, and its internal fixed-width wide mechanics. Gravitas is its sole intentional non-test friend and owns the rigid-body meaning built from those mechanics: mass and inertia interpretation, contact levers, impulses, restitution, friction, warm-start accumulation, and CCD response. FixedMathSharp internal types never appear in Gravitas public or serialized APIs.
This is a one-way, release-coupled implementation boundary, not a public FixedMathSharp extension mechanism or a precedent for SwiftCollections, GridForge, Trailblazer, or host adapters. FixedMathSharp is released first; SwiftCollections and GridForge are then validated and released in dependency order before Gravitas is rebuilt against the exact released FixedMathSharp version and the complete package-only lower stack.
The install command above selects the standard package. To use the lean dependency profile instead:
dotnet add package Gravitas.Lean
If you build from source, the repository provides matching configurations:
Releasebuilds the standardGravitaspackage.ReleaseLeanbuilds theGravitas.Leanpackage.
For local development against the repository, reference the project directly:
<ItemGroup>
<ProjectReference Include="path/to/Gravitas/src/Gravitas/Gravitas.csproj" />
</ItemGroup>
Mental Model
Gravitas is centered around explicit world-context ownership:
- A host creates or attaches a
GravitasWorldContext, which owns an explicitGridForge.Grids.GridWorld. - Host objects expose deterministic transform and world context access through
IMatterAgent. GravitasWorldContextowns fixed-step clock state, settings, physical environment values, lifecycle hooks, and context-local services.GravitasPhysicsServiceowns 3D body/collider registration, collider ID lookup, collision-pair pooling, and physics lifecycle work for one context.GravitasConstraint3DServiceandGravitasConstraint2DServiceown deterministic joint IDs, endpoint-bound joint lifetimes, atomic ragdoll runtimes, linked-collider self-filtering, motor targets, replay hashing, and joint diagnostics.GravitasPhysics2DServiceowns pure 2D registration, pair state, response, and visualization publishing for one context.GravitasMixedCollisionServiceowns the explicit mixed 2D/3D broad-phase, pair lifecycle, and constrained response path whenPhysicsRuntimeMode.Mixedis active.GravitasCollisionServiceandGravitasCollision2DServicemap colliders into GridForge voxels and activate partition payloads for collision checks.GravitasQuery2DService,GravitasQuery3DService,GravitasQueryMixedService, andGravitasCoroutineServiceown query and coroutine state per context.SolidBodyandSolidBody2Down simulated body state and Chronicler state recording for their runtime path. Their explicitBodyMotionTypeselects solver-controlledDynamic, host-controlledKinematic, or immobileStaticownership;FreezeAxesindependently constrains the degrees of freedom available to a dynamic body.LSColliderandLSCollider2Dare closed public runtime hierarchies that own shape state, bounds, layers, collider-local physical ignore masks, trigger/contact events, and GridForge partition coordinates. Engine adapters should map host assets intoColliderShapeDefinitionorColliderShapeDefinition2D, then callCreateCollider()to obtain the common runtime base type.
Typical integration creates or attaches a context, initializes bodies and
colliders against agents bound to that context, then advances the simulation
through Simulate(), LateSimulate(), Visualize(), and LateVisualize()
according to the host's fixed-frame loop.
Main Systems
| Area | What it does | Start here |
|---|---|---|
| Core runtime | Context-owned physics services, body state, and host agent boundary | src/Gravitas/Core, dimensional Core subfolders, and src/Gravitas/Runtime |
| Colliders | Collider base classes, primitive shapes, mesh support, authored shape definitions, compound colliders, bounds, and layer behavior | src/Gravitas/Colliders |
| Collision handling | Shape-pair checks, contact data, collision pairs, and response logic | src/Gravitas/CollisionHandling |
| Constraints | 3D joints, ragdoll definitions/runtimes, joint rows, and solver integration | src/Gravitas/Constraints |
| Partitions | GridForge-backed physics partitions used by collision distribution | src/Gravitas/Partitions |
| Queries | 2D/3D raycast, swept-sphere, convex-source sweep, cone-volume, and overlap query support | src/Gravitas/Queries |
| Settings | Frame rate, collision matrix, pooling switch, CCD defaults, and settings save helpers | src/Gravitas/Settings |
| Support | Layers, lifecycle hooks, coroutines, and transient state helpers | src/Gravitas/Support |
Repository Map
| Path | Purpose |
|---|---|
src/Gravitas |
Main library project. |
tests/Gravitas.Tests |
xUnit v3 test project with focused runtime/settings/query coverage. |
tests/Gravitas.Benchmarks |
BenchmarkDotNet benchmarks and alias runner. |
.github/workflows |
CI, coverage, release, NuGet publish, Discord, and wiki-sync workflows. |
Build And Test
Install the SDK selected by global.json and the .NET 8 runtime
used by the test and benchmark executables.
dotnet restore Gravitas.slnx
dotnet build Gravitas.slnx --configuration Release
dotnet test Gravitas.slnx --configuration Release
Validate the lean package path when changing package references, serialization, or conditional MemoryPack behavior:
dotnet build Gravitas.slnx --configuration ReleaseLean
dotnet test Gravitas.slnx --configuration ReleaseLean
For focused unit-test work:
dotnet test tests/Gravitas.Tests/Gravitas.Tests.csproj --configuration Release
Release builds generate NuGet packages because GeneratePackageOnBuild is
enabled.
Benchmarks
The benchmark project includes physics hot-path measurements for context lifecycle, body/collider registration, partitioning, simulation, query services, diagnostics, mesh paths, 3D constraints, mixed broad phase, and CCD scaling.
List available benchmark selections:
dotnet build tests/Gravitas.Benchmarks/Gravitas.Benchmarks.csproj -c Release -f net8.0
dotnet tests/Gravitas.Benchmarks/bin/Release/net8.0/Gravitas.Benchmarks.dll list
Run all benchmarks:
dotnet build tests/Gravitas.Benchmarks/Gravitas.Benchmarks.csproj -c Release -f net8.0
dotnet tests/Gravitas.Benchmarks/bin/Release/net8.0/Gravitas.Benchmarks.dll all
See the benchmark README for runner details and benchmark authoring notes.
Documentation
- Documentation site
- API reference
- GitHub Wiki
- Coverage report
- AGENTS.md for deterministic, performance-sensitive, and physics-design contributor guidance
docs/wiki/OVERVIEW.mdfor context ownership, host integration, collisions, queries, serialization/replay, and diagnostics
Build the API site locally from the repository root:
dotnet build src/Gravitas/Gravitas.csproj --configuration Release --framework net8.0
dotnet tool restore
dotnet tool run docfx docs/api/docfx.json
If behavior changes, keep code, tests, this README, and benchmark documentation aligned.
Compatibility
netstandard2.1net8.0- Windows, Linux, and macOS host environments supported by .NET
Contributing
Contributions are welcome. Please read CONTRIBUTING.md and AGENTS.md before opening a pull request.
Prefer focused changes with release-mode validation. Determinism, physics correctness, low time complexity, and allocation behavior are first-order design constraints.
Community And Support
For questions, discussions, or general support, join the official Discord community:
For bug reports or feature requests, please open an issue in this repository.
License
Gravitas is licensed under the MIT License. See LICENSE, NOTICE, and COPYRIGHT for the project terms and attribution details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Chronicler.Core (>= 0.4.0)
- FixedMathSharp (>= 7.0.0)
- FixedMathSharp.Chronicler (>= 7.0.0)
- GridForge (>= 9.0.0)
- MemoryPack (>= 1.21.4)
- SwiftCollections (>= 7.0.0)
- SwiftCollections.FixedMathSharp (>= 7.0.0)
- System.Text.Json (>= 10.0.9)
-
net8.0
- Chronicler.Core (>= 0.4.0)
- FixedMathSharp (>= 7.0.0)
- FixedMathSharp.Chronicler (>= 7.0.0)
- GridForge (>= 9.0.0)
- MemoryPack (>= 1.21.4)
- SwiftCollections (>= 7.0.0)
- SwiftCollections.FixedMathSharp (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 30 | 8/6/2026 |
| 1.0.0-alpha.1 | 42 | 8/5/2026 |