Skip to content

Repository files navigation

Forest Camp — Modoki

A cozy forest clearing at sunset: a tent, a bonfire with rising smoke and embers, scattered logs and rocks, and a fantasy adventurer character standing near the fire, ringed by pine, maple, and birch trees

The Modoki engine's flagship showcase — a cozy forest camp you walk around as a rigged, animated character, with a fire that actually flickers and crackles, and a bow you can draw and shoot at a practice target. Unlike the two physics demos, this one is built to feel like a place: GLB import + LOD, PBR materials under an HDR sky, skeletal animation blending live off your movement, a third-person orbit camera, spatial + ambient audio, a particle-driven campfire, and archery gameplay (bone-attached weapon, physics-driven arrows, impact FX) — all in one coherent scene.

Running it

You need the Modoki Editor (download). This project is not a standalone npm app — the editor supplies the engine, the dev server, and the build pipeline.

  1. Open the editor.
  2. File → Open Project, and pick this folder.
  3. Press Play in the toolbar.

To produce a web build, use Build → Web in the editor.

Controls

Input Effect
W A S D Walk — camera-relative; the Ranger turns to face the direction they're moving
Drag (mouse) Orbit the camera around the character
Scroll Zoom the camera in/out
F Toggle shooting mode — the character plants and the camera holds its position, rotating in place
Drag with LMB held (in shooting mode) Aim; hold still to charge the draw, release to shoot
W A S D (in shooting mode) Also exits shooting mode, straight back into a walk

The pace is a deliberate relaxed stroll — there's no combat objective. Walk around, look at the fire, listen to the woods, or press F and put an arrow into the practice target by the tree line.

What's in it

One scene, main.json. Everything is spatial/geometry data authored in the scene — game code is three small systems that read movement/camera config knobs and write clip selection + camera pose.

Feature Where it shows up
GLB import + LOD Every tree/rock/prop is an imported Quaternius GLB with 3 auto-generated LOD tiers
PBR + HDR environment/IBL A warm sunset-forest HDR lights the whole scene; the terrain, tent, and camp props are all PBR-textured
Skeletal animation The Ranger crossfades Idle ↔ Walk (SkeletalAnimator), with a stride-match so the footwork doesn't skate at any walk speed
Character controller A Rapier3D kinematic CharacterController3D — collide-and-slide against the terrain trimesh, 18 tree-trunk colliders, and shoveable dynamic rocks/logs
Third-person camera An orbit-follow camera driven by a real look-at (not a naive Euler), so it never tips at extreme angles
Particles A campfire with additive ember particles + a rising smoke plume, plus a flickering point light layered from two sine waves
Audio A spatial campfire-crackle AudioSource (falls off with distance), a global ambient forest bed, and a one-shot spatial thud on arrow impact
ECS UI A title + control-hint HUD line, plus a crosshair and a draw-charge gauge that appear only in shooting mode, all through the DOM UIRenderer
Archery A hold-to-charge draw with a physics-simulated arrow, and a practice-dummy target that reacts to a hit

The only game code

Systems in runtime/systems.ts, registered from runtime/setup.ts:

  • forestMoveSystem — reads input, rotates it into camera space, and drives CharacterController3D.moveX/moveZ; turns the Ranger to face its heading. Movement is locked while shooting mode is active.
  • forestAnimSystem — picks Idle/Walk off ground speed and scales the Walk clip's playback rate against a config-authored reference speed, so the feet plant at any walk speed instead of sliding; also drives Idle_Weapon/Bow_Draw/Bow_Shoot while shooting.
  • forestCameraSystem / flickerLightSystem — orbit-follow camera (drag to rotate, scroll to zoom, smoothing the target rather than the position so the camera never chord-cuts across the orbit sphere) and a deterministic (not Math.random()) layered-sine flicker for the campfire light, reusable by any future (Light, Flicker) entity. The same camera freezes in place and free-looks while shooting, blending back to the orbit-follow pose on exit.
  • forestArcherySystem / arrowLifecycleSystem / forestArcheryUiSystem — the shooting-mode state machine (F toggles it; a held drag both aims and charges the draw), a physics-simulated arrow (spawns at the bow, tracks its velocity in flight, embeds on impact, applies an impulse to whatever it hits if that thing is a dynamic body, and despawns itself after a few seconds), and the crosshair/gauge HUD.

All the tunable feel knobs — turn speed, camera distance/pitch/zoom limits, the walk reference speed, and every archery number (aim sensitivity, charge rates, arrow speed) — live on one config resource, ForestCampConfig, live-editable in the Inspector.

Asset provenance

Every asset here is CC0 — see ATTRIBUTION.md for the full list and sources (Quaternius model packs, a Poly Haven HDR, two OpenGameArt audio clips).

About

Forest Camp — the Modoki engine's flagship showcase demo (CC0, web-only)

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages