Forces
User-defined functions on nodes. Author writes the physics.
a compiled, typed programming language
A language for simulating graphs with author-defined forces, drawings, cameras, and constraints. GPU-native, cross-platform, type-safe, embeddable. The same compiler that runs on a desktop runs in your browser via WebAssembly + WebGPU.
Embedded right here in your browser via WebAssembly + WebGPU.
User-defined functions on nodes. Author writes the physics.
Nodes can look like anything the user wants to express through mathematics.
Rules that must hold between nodes, for example the rigid distance between two bonded atoms. Solved each tick by built-in solvers: XPBD, LINCS, SHAKE.
Multiple types per graph; the author chooses how each one behaves.
Pick one of nine (float16 through emulated float128, plus five fixed-point variants) and the entire codebase computes at that precision. Arbitrarily accurate within the limits of computer arithmetic.
Every position, velocity, and force is Vec3, even when most graphs sit in 2D. Depth is a free axis the author can use.
Cameras with input bindings, on-event handlers, live 60 Hz tick loop.
Almost everything compiles to GPU shaders through wgpu. Runs in any browser with a GPU, or natively on Mac, Linux, and Windows.
def force gravity(g: Float) -> Vec3 {
fn(n: Node) -> Vec3 {
vec3(0.0, -g, 0.0)
}
} gravity, taking a strength parameter gfn(n: Node))-> Vec3)(0, -g, 0): zero horizontally, downward by g, zero in depthAuthors should be able to write whatever they can think of and express with mathematics.
Real-time simulation at scale. GPU-native execution from end to end.
Precise enough to simulate at a scientific level. Forces are functions; the precision they compute at is the author's choice, applied uniformly across the entire codebase.
The same .grapheme file runs in any browser with a GPU, or natively on Mac, Linux, and Windows.
Forces, drawings, constraints, and cameras compose freely. The author writes pieces; the runtime glues them.
Every shader is derived from an author body. No hidden runtime behavior.
A wrong-precision pipeline is a compile-time error, never a runtime bug.
Drop a .grapheme program into any host: HTML, Obsidian, SliDev, mdBook.