HullMain menu
Code-first engine on Bevy 0.19.1

Hull, a code-first game engine on Bevy

Start your Bevy game at gameplay, not at the settings menu.

The engine main menu in the ui_gallery example: title, tagline, three menu items with the first selected by an accent bar, a stats card and key hints
Real capture, same build, one flag changedui_gallery, default theme
Pick an accentOrange, Shroud’s theme

Why

Every Bevy game begins by rebuilding the same shell: a main menu, a settings screen that saves, Esc to pause, volume sliders, quality presets, a way to test it. Hull ships that shell, and the systems a game grows into after it, so the first commit is gameplay.

Everything is Rust or small JSON files: no editor, no binary scene assets. The crate is called engine today; Hull is a working name.

Options

Inside the shell

Shell

  • App bootstrapWindow or headless, CLI flags, data and asset folders.engine::app(GameInfo::new(id, title))
    One call
  • App statesBoot, MainMenu, InGame. Games hang their own sub-states under InGame.
    Built in
  • SettingsCore settings plus a typed section for your game. Saved as JSON with atomic writes; a corrupt file is set aside, not fatal.
    Persisted
  • Settings screenEach FieldDef becomes a row: toggle, slider, choice, cards or swatches. Reset tab restores defaults.
    Generated
  • Graphics qualityLow, Medium, High and Ultra presets for AA, ambient occlusion, bloom, shadows, fog and probes.
    4 presets
  • SavesDataDir JSON helpers with the same atomic writes as settings. The devkit adds versioned save slots.
    Built in

UI kit

  • ThemeRe-brand the whole kit with one accent colour. Barlow and Barlow Condensed are embedded.Theme::default().with_accent(Color::srgb(1.0, 0.78, 0.22))
    with_accent
  • WidgetsToggle, slider, choice, cards and swatches.
    5 kinds
  • Screen stackEsc pauses, Back pops. The game pauses when the window loses focus.
    Built in
  • Main and pause menusItems, a side panel and a pause header, all from one MenuConfig.
    MenuConfig
  • Toasts and FPS counterPost a toast from any system, even in headless runs.
    Built in

Input

  • Action mapButtons, 1D and 2D axes bound to keys, mouse, gamepad buttons and sticks, with chords, deadzones and input contexts.actions.axis2d("steer")
    ActionDef
  • RebindingA Controls screen with keyboard and gamepad columns, press to bind, conflicts flagged, reset all. Only changed bindings are saved.
    Generated
  • GamepadEvery connected pad is read, rumble is scaled by a setting, and a virtual pad drives tests.
    Built in
  • AccessibilityText size, high contrast, colour-blind filter, reduce motion, camera shake, hold or toggle, vibration.
    Built in
  • LocalizationString tables in .ftl files with plurals, hot language switch and a pseudo-locale. Engine screens ship in English, German and French.
    tr("key")

Play

  • FPS controllerKinematic collide-and-slide, mouse look, crouch, sprint, jump.
    feature fps
  • Chase cameraThird-person follow for any entity. Looks ahead, orbits, pulls in front of walls.
    ChaseCamera
  • MeshKitLow-poly vertex-coloured meshes from Bevy primitives. One mesh per object type.
    MeshKit
  • Physicsavian3d 0.7, paused with the game. Re-exported as engine::avian3d.
    feature physics

Render

  • ClassificationAnything that moves, has physics or animates is an actor at full detail. The rest becomes scenery.
    Automatic
  • Distance detailSmall props lose shadows, then fade. Big pieces cross-fade to a flat far copy.
    On
  • StreamingScenery cells spawn around the camera with hysteresis. Colliders are never streamed.
    SceneryStream
  • Frame pacingMenus and pause redraw at 30 Hz, 8 Hz unfocused, so the GPU idles.
    On
  • Idle skipA frame where nothing visible changed is simulated but not drawn.
    Opt-in

Devtools

  • Control port and MCPTests and AI agents drive the game: keys, mouse, state, screenshots.
    Dev only
  • Offscreen screenshotsA hidden window renders to an image, so captures work behind a fullscreen app.
    Dev only
  • Perf overlay and session logCPU, GPU, memory and frame times per span, plus a log of state changes.
    Dev only
  • Metrics windowF4 opens a second window with live charts and run history tied to git commits.
    F4
  • Ship checkpackage.sh refuses to package if any of the ashlar debug crates behind the devtools is still in the tree.
    Enforced

Devkit

  • InspectorQuery, read, patch, spawn and despawn entities and resources over the control port.ecs.set {id, component, value}
    ecs.*
  • Scenario testsA 60 Hz fixed-step app with scripted input, wait_until and JSON snapshots.
    Scenario
  • Record and replayRecord input in one run and play it back in another.
    Built in
  • Golden imagesPerceptual diff of screenshots; a failing compare writes a diff PNG with the changed pixels in red.
    Perceptual
  • Perf budgets and benchesAssert p95 frame time, entity count and allocations per frame; compare bench runs and fail on a regression.
    PerfBudget
  • Hot reload and savesJSON data, tuning and settings reload while the game runs. Versioned save slots with migrations, backups and autosave.
    Built in
Systems

Then the game grows

Lighting, animation, particles, AI, sound, big worlds and multiplayer. Each is a cargo feature, each can be inspected and driven over the control port, and each does almost no work until something uses it.

The look_showcase yard at midday: metal and plastic spheres between pillars with neon strips, a blue sky, crisp shadows
clear_day, Highlook_showcase --quality high
The same yard at dusk: a low orange sun, long shadows, warm haze over the ground
dusk, High--look dusk
app.insert_resource(Look::dusk())

Look

  • Look presetsclear_day, overcast, dusk, night and indoor. Build variations with ..Look::dusk().app.insert_resource(Look::dusk())
    5 presets
  • Sky and sunBevy’s physical atmosphere, a procedural gradient sky or a cubemap. The sky is filtered once into image-based light, not every frame.
    SkyMode
  • Fog and volumetricsLinear, exponential or atmospheric fog, plus a volumetric fog box with sun shafts on High and Ultra.
    FogLook
  • Grading and lensExposure (manual or auto), tonemapping, lift, gamma and gain, bloom, depth of field, motion blur, vignette, film grain.
    GradingLook
  • Reflection probesCaptured at runtime: baked and frozen, or realtime one face every few frames.
    ReflectionProbe
  • Decals and soft shadowsForward decals from generated textures. PCSS soft shadows on Ultra behind the look_pcss feature.
    Ultra

Anim

  • State machinesStates, crossfades, conditions on float, bool and trigger parameters, exit times and any-state transitions.
    AnimGraphDef
  • Blend spaces1D and 2D blends, for example speed by direction for locomotion.
    1D, 2D
  • Layers and masksOverride layers on a bone mask (wave with the upper body) and additive layers (lean into turns).
    Built in
  • Root motion and notifiesRoot bone motion moves the entity; notifies fire messages such as footsteps at points in a clip.
    Built in
  • IK and springsTwo-bone IK, look-at, spring bones and foot placement on uneven ground.
    TwoBoneIk
  • LODFar characters are posed every 2, 4 or 8 frames; off-screen ones not at all. Logic still runs every frame.
    By distance

VFX

  • Presetssparks, smoke, fire, muzzle_flash, explosion, dust_puff, magic, rain and snow.vfx.play("explosion", transform)
    9 presets
  • EmittersRates, bursts, trails per metre, shapes from points to mesh surfaces, curl turbulence, attractors, orbits.
    EmitterDef
  • Collision and sub-emittersParticles bounce on a plane or on avian colliders and can spawn other emitters on death or impact.
    Built in
  • RenderingFlipbooks, soft and lit particles, sorting, additive or alpha blend. Textures are generated at startup.
    Instanced
  • Budgets and poolingPer-emitter capacity, culling distance, LOD and pooled one-shots: no spawn churn.
    Built in

AI

  • Navmesh bakingRecast-style tiles baked off the main thread. Moving one crate rebakes 1 to 4 tiles.
    Automatic
  • Paths and crowdsA* over polygons with a funnel, then separation and ORCA avoidance. Off-mesh links, for example a ladder.
    NavAgent
  • Behaviour treesSequences, selectors, reactive and parallel nodes, decorators, built from Rust functions. Ticks are deterministic.
    BehaviorTree
  • Utility AIScored options with response curves and hysteresis, alone or inside a tree.
    UtilityAi
  • PerceptionSight cones with a budget of line-of-sight rays per frame, hearing from noise events, and memory.
    Perceiver

Sound

  • MixerA bus tree with mix snapshots and sidechain ducking: music drops while someone speaks.
    Mixer
  • Cues and voicesVariants, randomisation, cooldowns, instance and voice limits with stealing, virtual voices.
    SoundCue
  • 3D and occlusionRolloff, panning, doppler, rear darkening. Raycasts muffle sounds behind walls.
    Built in
  • ZonesSphere or box zones that blend a reverb snapshot and an ambience loop.
    SoundZone
  • MusicStems that fade in by intensity, transitions on the next beat or bar, a beat message for gameplay.
    Music
  • CaptionsSpeaker lines and [sound effects] on screen when the voice really starts, with a direction mark for 3D sources.
    Built in

World

  • TerrainHeightfields from noise, 16-bit PNG or raw files, in 128 m chunks with LOD, a 4-layer splat material and colliders.
    Terrain
  • ScatterGrass, trees and rocks placed by seeded rules: density, height, slope, noise masks, exclusions.
    ScatterRule
  • Cell streamingGameplay data and colliders load in cells around the camera; a coarse collider is always there.
    WorldCells
  • HLODFar cells become merged, simplified proxies built in background tasks.
    Built in
  • Floating originRebases the world around the camera so far coordinates stay precise.
    Opt-in

Net

  • Transports and channelsUDP or in-memory, reliable and unreliable channels, typed messages both ways.
    UDP
  • ReplicationDelta-compressed snapshots with interest management and a bandwidth budget per client.
    Built in
  • PredictionClient-side prediction with rollback and replay, plus interpolation for everything else.
    Built in
  • Lag compensationThe server checks hits against where players saw their targets.
    Built in
  • Zero cost when offWithout host or connect every net system is skipped; without the feature nothing is compiled.
    Opt-in
src/main.rs
use engine::prelude::*;

fn main() {
    engine::app(
        GameInfo::new("orbs", "Orbs").tagline("Collect them all."),
    )
    .add_plugins(MyGamePlugin)
    .run();
}
Cargo.toml
[dependencies.engine]
git = "https://github.com/Himasnhu-AT/hull"
default-features = false
features = [
    "physics", "fps", "look", "anim", "vfx",
    "ai", "sound", "world", "actions", "l10n",
]   # add "net" for multiplayer

[dependencies]
bevy = { version = "=0.19.1", default-features = false }

[features]
# cargo run / cargo test keep every debug tool
default = ["dev"]
dev = ["engine/devtools", "engine/trace", "engine/devkit"]

Your main.rs is the whole setup

engine::app builds the window, the app states, settings, menus and pause. Your plugin is the game. Ship builds drop every debug tool with --no-default-features.

Settings are data: each FieldDef becomes a row on the generated screen, saved to settings.json.

Start a game
Proof

Two games, one shell

An indoor shooter and a driving game. Same settings screen, same tabs, same presets, same key hints. Courier changed the accent with one line.

Shroud's video settings: quality presets with High selected in orange, field of view slider, window mode, VSync and UI scale
Shroud, Settings, Video
Courier's video settings: the same screen and rows, with High selected in yellow over a valley backdrop
Courier, Settings, Video
Theme::default().with_accent(Color::srgb(1.0, 0.78, 0.22))
Performance

Benchmarked, then fixed

12 scenes from the engine's own examples run offscreen at full speed. The first run found a crash at Ultra, a 10-second stall in the open world and a reflection probe re-filtered every frame. Before and after:

ms p99 frame, open world
from 48.5to 5.6
Flying over 4 × 4 km of streamed terrain
fps, look at High
from 99to 130
Realtime probe filtered once per face cycle. look_dusk: 95 to 127 (+34%)
fps, look at Ultra
from Crashedto 65
SSR now sees deferred materials

1920×1080 offscreen, vsync off, dev profile (opt-level 3 + debuginfo), M-series MacBook Pro with 15 cores, 20 s window after an 8 s warm-up. Commit c8532d9 against 2327039.

All benchmarks
Render budget

Drawn on a budget, with zero code

meshes drawn
from 40,231to 480
40k-prop city, overview
ms p95 frame
from 4.54to 3.07
same view
GPU busy in menus
from 85 to 92%to 21 to 32%
frame pacing

Apple M5 Pro, 1920×1080, High quality, vsync off. Before: every optimisation off. After: the defaults.

The test city from above with every optimisation off: blocks and thousands of props out to the horizon
Budget off: 40,231 meshes drawn
The same view with the defaults: near props unchanged, far props faded, far blocks flattened
Budget on: 480 meshes drawn

Near the camera nothing changes. Far props fade out in a dithered cross-fade, so nothing pops, and far blocks become flat copies. GPU occlusion culling was tried too and left off: it was 3 to 15% slower in every pose measured.

Read the render budget
Devtools

Every run, against the last one

The metrics window: large charts for frame time, CPU, GPU and memory, rows of keys with sparklines, and a runs table comparing this run with three earlier runs, changes in green when better and red when worse
metrics_demo after four runs of commit 330d7d5--metrics-window
Two live charts from the metrics window: frame time at 6.56 ms and process CPU at 182%
Live charts, redrawn 4 times a second
The runs table: this run against earlier runs of commit 330d7d5, frame time p95 down 34% in green, CPU up 65% in red
Runs table: green better, red worse

Press F4 in a dev build and a second window charts frame time, CPU, GPU and memory, then keeps a table of past runs tied to the git commit. Green is better, red is worse, dim is within 3%.

A control port and an MCP server let tests and AI agents drive the game: send keys, read state, take offscreen screenshots. Every engine capture on this site was taken that way.

  • Ship builds--no-default-features removes all of it. The ashlar debug crates the devtools are built on are not even in the dependency tree, and the packaging script refuses to package if one slipped in.
    Enforced
  • Clean exitsA pipelined-rendering deadlock on exit was found and fixed: clean exits went from 22 of 30 runs to 30 of 30.
    30 / 30