Skip to main content

Crate proof_engine

Crate proof_engine 

Source
Expand description

§Proof Engine

A Rust engine for real-time graphics where every point, glyph and particle on screen is moved by a real equation: an ODE, a force field, a spring, a noise function.

Seven strange attractors, each 1,500 points integrated with RK4

§The math runs without a window

The integrators, attractors, fields and MathFunctions are plain Rust and can be used on their own. This example runs as a doc test:

use proof_engine::math::attractors::{rk4_step, AttractorType};
use proof_engine::prelude::Vec3;

// Two Lorenz states that start 0.0001 apart...
let mut a = Vec3::new(1.0, 1.0, 1.0);
let mut b = Vec3::new(1.0001, 1.0, 1.0);
for _ in 0..6000 {
    a = rk4_step(AttractorType::Lorenz, a, 0.005);
    b = rk4_step(AttractorType::Lorenz, b, 0.005);
}
// ...are far apart after 30 simulated seconds: that is chaos.
assert!((a - b).length() > 1.0);

§Open a window and draw

The quickstart example, in full. It needs a GPU with OpenGL 3.3, so it is compiled here but not run:

use proof_engine::math::attractors::rk4_step;
use proof_engine::prelude::*;
use proof_engine::render::ui_layer::UiParticle;

let mut engine = ProofEngine::new(EngineConfig::default());
let mut points: Vec<Vec3> = (0..5000)
    .map(|i| Vec3::new(1.0 + i as f32 * 4e-4, 1.0, 1.0))
    .collect();

engine.run_ui(move |engine, dt| {
    for p in points.iter_mut() {
        *p = rk4_step(AttractorType::Lorenz, *p, dt);
    }
    let (w, h) = engine.render_size();
    let (cx, cy, s) = (w as f32 / 2.0, h as f32 / 2.0, h as f32 / 60.0);
    let color = Vec4::new(0.5, 1.2, 1.6, 1.0);
    let dots = points
        .iter()
        .map(|p| UiParticle::new(cx + p.x * s, cy - (p.z - 25.0) * s, 3.0, 3.0, '●', color))
        .collect();
    engine.ui.draw_particles(dots);
});

§Where to look

Every example in the repository can save its own frames to disk with the PROOF_SHOT environment variables; see the README.

Re-exports§

pub use config::EngineConfig;
pub use math::MathFunction;
pub use math::ForceField;
pub use math::Falloff;
pub use math::AttractorType;
pub use glyph::Glyph;
pub use glyph::RenderLayer;
pub use glyph::BlendMode;
pub use entity::AmorphousEntity;
pub use particle::MathParticle;
pub use particle::ParticleInteraction;
pub use scene::SceneGraph;
pub use render::camera::ProofCamera;
pub use input::InputState;
pub use input::Key;
pub use render::pipeline::FrameStats;
pub use audio::AudioEvent;

Modules§

ai
AI module — Behavior Trees, Utility AI, Goal-Oriented Action Planning, Pathfinding, Navigation Meshes, Flow Fields, Steering Behaviors, and Blackboard.
anim
Animation State Machine for Proof Engine.
animation
Animation State Machine and Blend Trees.
asset
Asset Pipeline
audio
Mathematical audio — the same functions that drive visuals also drive sound.
behavior
AI Behavior subsystem — Behavior Trees, built-in nodes, and GOAP planner.
character
combat
Combat system — damage, status effects, hit detection, and DPS calculation.
compute
GPU Compute Pipeline
config
Engine configuration — hierarchical, hot-reloadable, command-line overridable.
crafting
Crafting & Economy System
curves
Mathematical curves as entity structure.
debug
Debug overlay and performance profiling.
deferred
Deferred rendering subsystem for the Proof Engine.
dsp
Digital Signal Processing — module root
ecology
Mathematical ecology simulation.
economy
Economy subsystem: market simulation, faction economies, and production chains.
ecs
Entity Component System (ECS)
editor
In-Engine Editor — master state, camera, undo/redo, grid, shortcuts.
effects
Screen effects coordinator — combines all post-processing passes into a single, driven, event-triggered system.
electromagnetic
Electromagnetic simulation module — FDTD solvers, electric/magnetic fields, EM wave propagation, charged particle dynamics, plasma PIC simulation, lightning generation, Faraday shielding, and antenna radiation patterns.
entity
Amorphous entity rendering.
fractal
Fractal Rendering System — Mandelbrot, Julia, 3D fractals, IFS, L-systems, flame fractals, Newton fractals, deep zoom, progressive rendering, fractal terrain.
game
Game Systems Module — top-level game state coordinator
geometry
Computational Geometry Engine — real-time mathematical surface construction, manipulation, and rendering.
glyph
Glyph — the fundamental rendering primitive.
graph
input
Input handling — keyboard, mouse, scroll, and window events.
integration
ProofGame integration trait — the contract between proof-engine and chaos-rpg-core.
lighting
Advanced lighting subsystem for Proof Engine.
math
Mathematical primitives: functions, force fields, attractors.
metaball
Metaball / Isosurface Entity System
ml
Machine learning primitives for Proof Engine.
narrative
Procedural narrative engine.
netcode
Netcode Subsystem
network
Networking for Proof Engine: HTTP + WebSocket client, leaderboards, cloud saves.
networking
Networking module: HTTP client, WebSocket client, connection management.
nishita_sky
Nishita atmospheric sky model.
number_theory
Number theory module for Proof Engine.
particle
Mathematical particle system.
pathfinding
physics
Physics simulation — rigid bodies, constraints, collision, fluid dynamics.
prelude
Common imports for using Proof Engine.
procedural
Procedural content generation — dungeons, rooms, spawn tables, loot, names.
profiler
CPU/GPU performance profiler with hierarchical timing, counters, and flame graph capture.
quantum
relativistic
Relativistic physics module for Proof Engine.
render
Rendering pipeline — window, OpenGL context, glyph batching, post-processing.
rendergraph
Declarative render graph subsystem for the Proof Engine.
replay
Replay system: input recording, deterministic playback, scrubbing, ghost.
save
Save / Load System
scene
Scene graph — manages all active glyphs, entities, particles, and force fields. Full implementation with BVH spatial index, scene queries, serialization, transform hierarchy, layer management, event system, and portals.
scripting
Proof Engine scripting system — pure-Rust Lua-like language engine.
shader_graph
Shader Graph System
solver
Differential Equation Solver Framework — general-purpose ODE/PDE solvers.
spatial
Spatial acceleration structures for fast proximity queries.
stochastic
Stochastic processes module for Proof Engine.
surfaces
Surface Rendering Subsystem
svogi
symbolic
Symbolic Mathematics Engine — expression trees, differentiation, integration, simplification, equation solving, Taylor series, matrix operations, and mathematical typesetting.
terrain
Terrain System
tiled_lighting
Tiled/clustered forward lighting.
timeline
Cutscene and timeline system — scripted sequences of engine events.
topology
tween
Tween / animation system.
ui
UI Widget System for Proof Engine.
vfx
Visual effects system: decals, trails, impact splats, ribbon renderers, screen-space effects, procedural destruction visuals, particle emitters, effect presets and force fields.
volumetric_fog
Volumetric Fog — Froxel-based participating media rendering.
weather
wgpu_backend
WebGPU-style backend abstraction layer for Proof Engine.
world
Open-world management: zone streaming, portals, day/night cycle, weather simulation, and world-level event coordination.
worldgen
Procedural world generation framework.

Macros§

t
Convenience: t!(mgr, “panel.inspector”) → translated string

Structs§

ProofEngine
The main engine struct. Create once, run forever.