Skip to content

Latest commit

 

History

History
118 lines (96 loc) · 5.04 KB

File metadata and controls

118 lines (96 loc) · 5.04 KB

🍃 AgentPets Village 2 — on the Burrow engine

The comprehensive Animal Crossing-inspired life sim for the AgentPets roster, built on Burrow: a from-scratch 2D game engine written in Rust, in the spirit of Stardew Valley's homemade engine. No game framework, no ECS crate, no wasm-bindgen — zero dependencies of any kind. The repo's v1 JavaScript game (Game/) stays playable; this is its big sibling.

Play

./Game2/play.sh        # builds if needed, serves on localhost, opens browser
# — or just open Game2/web/index.html (the wasm is base64-embedded,
#   so file:// works and a cloned repo is playable with no toolchain)

Saves live in localStorage and survive engine updates (versioned JSON, merged over defaults). The village runs on your real clock and calendar.

What's new beyond the v1 game

Everything from v1 (fishing, bugs, fossils, shop, loans, house decorating, villager friendship, quests, real-time day/night and seasons), plus the four pillars:

  • 🏛 Museum & collections — a real museum building run by Iris the floating eye. Fossils now come out of the ground unassessed; Iris identifies them. Donate fish, bugs and fossils and watch the tanks, cases and pedestals fill up wing by wing.
  • 🐺 Living villagers — hourly schedules (sleep, morning at home, plaza, errands, shop, beach), real A* pathfinding between anchors, enterable villager homes when the owner is in, and Frostine who only drifts out after dark.
  • 🌦 Weather, planting & events — deterministic daily weather: rain speeds up fish bites and unlocks the coelacanth; butterflies hide; snow falls in winter. Plant flower seeds and saplings, bury fruit to grow fruit trees, chop trees with the axe (wood, stumps, shovel them out). Saturday night is Howell's Moonlight Howl at the plaza (one-time music box gift); quarterly fishing tourneys pay a trophy.
  • 🧱 Town building — lay and remove path tiles with the Path Kit, decorate the village with outdoor furniture (benches, street lamps), and re-skin your house with purchasable wallpaper and flooring.

Also new: play as any of the 12 roster creatures, picked on the title screen.

Controls

Key Action
WASD / arrows Move (hold Shift to run)
Space / E / Enter Interact / confirm (hint shows at the bottom)
Q Cycle tool: hands → rod → net → shovel → axe → path kit
I / Tab Pockets · J journal · H help
Esc / X Cancel / close
` Mute (host-side)

The Burrow engine (engine/ — crate burrow)

The design constraint: the compiled wasm module has zero imports. The game fills a flat command buffer (draw ops, sfx ids, an optional save payload) each frame; a ~350-line hand-written JS host (web/host.js) replays it onto a canvas, synthesizes audio, and feeds back input + wall-clock time through a hand-rolled extern "C" ABI (engine/src/platform.rs). Engine modules:

Module What it is
draw typed command buffer → flat f32 array (12 floats/cmd)
grid bounded A* pathfinding over a passability closure
json hand-rolled JSON reader/writer for saves
rng SplitMix64 seeded PRNG (deterministic native ↔ wasm)
clock host-fed wall clock, seasons, day phases, date math
input edge-triggered buttons + text input (arrows ≠ WASD, so typing names works)
ui panels, list navigation, typewriter dialogue
platform the wasm ABI: register_app!, single-frame protocol

Because nothing browser-specific leaks into the engine, the entire game runs natively under cargo test — and plain Node can instantiate the shipped wasm and play whole sessions headlessly.

Build & test

cd Game2
./build.sh                          # sprite tables → cargo → base64 embed → assets
cargo test                          # 73 native tests (engine + game logic + integration)
node --test "tests-node/*.test.mjs" # 7 headless sessions against the real wasm

Requires Rust with the wasm32-unknown-unknown target (rustup target add wasm32-unknown-unknown) and Python 3 for the generators. Playing a built checkout requires nothing at all.

Layout

Game2/
  engine/        the Burrow crate (zero deps)
  game/          the village2 crate (depends only on burrow)
  web/           index.html + host.js + generated game.wasm.js + sprites
  tools/         gen_sprites.py — emits Rust + JS sprite tables from
                 the Game/assets manifests (single source of truth)
  tests-node/    headless wasm session tests

Creature art is the same CC0 sprite set as the app and v1 game (see CREDITS.md at the repo root). Terrain, buildings, furniture, weather and UI are all drawn procedurally by the engine.

Honest limitations

  • Sprites are side-view strips: up/down walking shows the side profile.
  • Furniture occupies one tile and doesn't rotate.
  • Mail, special visitors beyond Howell's concert, and multiplayer are not built yet — the events system (flags + deterministic daily state) is where they'd slot in.