Wolves - Den: a boulder cave at the foot of the rim, sited from the seed (away from the sea and spawn, mouth toward the valley, clearing in front) - Grace period: no wolves days 1-2; they move in on day 3 and howl; hunting from night 4; pack of 2, 3 from day 6, 4 from day 9; replaced by day - Wary pack hunters: circle and dart in one at a time; a lit campfire is a safe zone, a torch makes them hesitate, walls block bites (line of sight); hit one and the pack turns; hurt wolves flee; a lone wolf is timid; by day they defend the den; home at dawn - Glowing eyes, synthesised howls, can't sleep with wolves prowling - Wolf pelt and Wolf Cloak (+25 warmth) - Animals take a committed detour around obstacles Fishing - Fishing rod (workbench); cast a float onto the lake, 1.5 s to land a bite - Perch and rarer trout; faster bites at dawn/dusk and in rain; grill them - Visible fish near the shore that jump with splash rings Mixed diet - Foods belong to meat, fish or greens; each level runs down over ~1.5 days - One group low: no healing; two low: Malnourished (health drains); all three good: Balanced diet (heal x1.5); HUD diet bars; saved Tests: test_wolves and test_fishing_diet; run_all.sh covers 9 suites
18 KiB
Survival game design
How the survival game plays and how it is built. The core idea: the world is beautiful but indifferent. You arrive on the island with nothing and have to work out how to stay fed, warm and dry, then turn that into a home.
1. Core loop
gather ──► craft ──► build / equip ──► survive the night & weather
▲ │
└──────────── hunt, explore, upgrade tools ◄──────────┘
A good first evening for a new player (the "first hour" we tune toward):
- Pick up sticks, stones and flint from the ground. (Hands only.)
- Craft a stone axe and a stone pickaxe.
- Chop trees for wood, mine boulders for stone.
- Build a campfire before dark. It's light, warmth and (later) cooking.
- Build a workbench, then a chest to stash what you've gathered.
- Rain rolls in at night: build a rough shelter so you can dry off by the fire.
- Hunger bites: hunt a rabbit or deer, cook the meat on the fire.
2. Systems
2.1 Items (data-driven)
All items and recipes are data (data/items.json, data/recipes.json) in the
same shape the addon SDK uses (define_item / define_recipe, see
ADDON_SDK.md). An addon adding an item later uses the same path as the base game.
Item fields: id, name, description, stack, category
(resource | tool | weapon | food | placeable), plus optional blocks:
tool:{ "kind": "axe" | "pickaxe" | "hammer", "tier": 1, "damage": 1.0 }weapon:{ "damage": 10, "reach": 2.2, "stamina": 8 }food:{ "hunger": 30, "health": 5, "spoils_after": 600 }place:{ "piece": "campfire", "footprint": [1.4, 1.4] }fuel: seconds of burn time in a fire
2.2 Inventory & storage
- Slot grid with stacks. The player has 40 slots; the first row of 8 is the hotbar (keys 1-8 or the mouse wheel select the held item).
- Click to pick up a stack, click to drop or swap it, right-click to split, shift-click to quick-move between your inventory and an open chest.
- Chests (16 slots) are crafted at a workbench and placed in the world.
- One
Inventoryclass backs the player, chests and later corpses, so moving items is the same operation everywhere.
2.3 Gathering
| Source | Needs | Gives |
|---|---|---|
| Sticks, stones, flint on the ground | hands (E) | 1 each |
| Trees (chop, falls over) | axe | wood, sticks |
| Boulders (mine, shrinks per hit) | pickaxe | stone, flint |
| Bushes (M1b) | hands | fiber, berries |
| Animals (M1d) | weapon | raw meat, hide, bone |
Tool tiers gate harder resources later (e.g. iron ore needs a tier-2 pickaxe). Felled trees leave stumps.
Regrowth (built in M1c, props.gd): felled trees grow back after
2400 s (2 days), mined boulders after 3600 s, picked-up sticks/stones/flint/
mushrooms after 900 s. A timer waits (retries every 2 min) while you're
standing on the spot or something is built there. Timers are saved, and
sleeping advances them.
2.4 Crafting & stations
Recipes list inputs, an output and an optional station that must be within
6 m: none (hand), workbench, campfire (cooking), later forge. The crafting
panel shows every recipe you know, greyed out with the missing inputs in red.
2.5 Building
- Placement mode: holding a placeable shows a ghost preview (green = valid, red = blocked). R rotates it, left-click places it.
- M1a pieces: campfire, workbench, chest. M1c adds a bed.
- (built in M1c) Snap-together wood pieces, crafted at a workbench
(shift-click Craft makes 5): floor (2 wood), wall (2), door (4), roof
(2 wood + 1 fiber), gable (1). Everything is 2 m on a side. A roof rises
1 m over 2 m, so two roofs from opposite walls of a 4 m hut meet at a ridge,
and gables close the ends. Geometry and snap points live in
build_piece.gd, rules inbuild_system.gd. - Snapping: the ghost sits on your crosshair, then moves to the nearest pair of snap points (its own and a nearby piece's), with rotation locked to that piece's 90-degree grid. R turns building pieces a quarter turn. Away from other pieces, floors sit level on the highest ground under them.
- Support: touching the ground = 100%. Otherwise a piece takes the best of its neighbours minus 10% going up/down or 25% sideways. Under 30% it can't be placed, so an overhang reaches about 4 floors.
- Dismantling: X on any placed piece puts it back in your inventory (chests must be empty, graves can't be). Pieces left below 30% support collapse and come back to you too. Loose chests/fires/beds drop to the ground.
- Shelter detection: roofed = 3 of 5 rays straight up hit a building piece. Sheltered = roofed and at least 6 of 8 sideways rays hit walls within 8 m. Roofed keeps rain off you (and off a campfire). Sheltered cuts the weather's chill to a quarter, adds +8 warmth, and with a fire nearby makes you Rested after 20 s (stamina regen +50% for 5 min).
- Bed: E sets your spawn point (death respawns you there while it stands). E again at night (19:30 to 05:30) sleeps until 06:00 if the bed is sheltered: the clock, fires, regrowth and weather move on, you lose a little food, and you wake dry, warm and Rested.
- Grass doesn't grow through floors.
2.6 Survival stats (M1b)
| Stat | Drains from | Restored by | At zero |
|---|---|---|---|
| Health | damage, starving, freezing | food, rest | death |
| Stamina | sprint, swing, jump | resting, food buffs | can't sprint/swing |
| Hunger | time (faster when cold) | eating | health drains |
| Warmth | night, rain/wet, snow, altitude | fire, shelter, clothes | health drains, slow |
Status effects: Wet (rain or swimming: warmth drains faster, lasts after you're out), Cold / Freezing, Warm (near a fire), Sheltered, Rested (sat by a fire under a roof: stamina regen buff).
Built in M1b (scripts/player/survival.gd), current numbers:
- Hunger: full to empty in 1500 s (about 1.25 days), 1.5x faster below 30 warmth. Eating is refused at 98+. Berries +9, mushroom +6, roasted mushroom +24.
- Warmth eases toward a target: air warmth (22 at night to 68 at noon, -0.9 per metre above 12 m) plus up to +70 from a fire or a held torch. Warms at 7/s, cools at 1.6/s.
- Wet: 90 s after leaving deep water, -22 to the warmth target, dries 3x faster by a fire.
- Stamina: regen 24/s after a 1 s pause. Sprint 14/s, jump 8, harvest hit 6.
- Health: -0.6/s starving, -0.5/s below 12 warmth, +0.5/s when fed (>40) and warm (>35).
- Campfire: starts with 2 min of fuel, holds 15 min, +fuel with wood (E), heat radius 7 m. Out of fuel = no heat, no cooking.
- Berry bushes regrow after 10 min. Torch = 1 stick + 2 fiber.
2.7 Time & weather (M1b / M1c)
- Day/night cycle: 20 real minutes per day by default. The sun, sky, fog and ambient light follow time of day. Nights are dark enough that a campfire or torch matters.
- (built in M1c) Weather is a function of the world seed and the absolute
world time (
weather.gd), so it isn't saved and every M2 client can compute the same weather. A slow noise "front" picks the state. Measured over 60 days on seed 1337: clear 38%, cloudy about 30%, rain/snow 33%, storm 12%. A wet spell lasts about 6 minutes. A new world's first 10 minutes are always clear. - About 1 day in 4 (never day 1) is a cold day (-8 warmth): rain falls as snow and storms become blizzards. Above the snowline (28 m) it always snows.
- Warmth from weather: cloudy -3, rain -6, storm -12, snow -14, blizzard -24. Rain on you (no roof) keeps you Wet. Snow chills but doesn't soak. Rain on an uncovered campfire burns its fuel up to 4x faster.
- Each state sets cloud cover, sun and ambient light, fog, wind and precipitation, blending over about 50 s. Storms flash lightning, with thunder 0.5 to 2.5 s later.
- Visuals and sound (
weather_fx.gd, client side): GPU rain and snow particles stopped by a heightfield collider, so it doesn't rain indoors. Wet ground, settled snow (on terrain, rocks, grass and tree crowns) and wind strength are global shader uniforms. Rain, wind and thunder sounds are synthesised from filtered noise, and rain is muffled under a roof.
2.8 Creatures & hunting (built in M1d)
| Animal | HP | Run speed | Notices you | Behaviour | Butchering gives |
|---|---|---|---|---|---|
| Rabbit | 10 | 7 m/s, zig-zags | 7 m (12 m if you sprint) | flees | 1 raw meat |
| Deer | 40 | 9 m/s | 16 m (30 m if you sprint) | flees, outruns you | 2-3 meat, 1-2 hide |
| Boar | 60 | 6.6 m/s | never | neutral; hit it and it charges and gores you for 14 every 1.6 s for 18 s, and flees below 30% HP | 3-4 meat, 1-2 hide |
- Wolf (built): 45 HP, 8.6 m/s, bites for 9 (every 1.2 s at most). Butchering gives 1-2 meat and a wolf pelt. See 2.8a.
scripts/creatures/creature.gdruns each animal's state machine (idle, wander, flee, charge, dead). Steering is over the heightmap with no navmesh: a probe ahead turns the animal away from water, steep drops, the world edge and trees, rocks or buildings. Legs are animated at the hips. The meshes are procedural (creature_meshes.gd).spawner.gdkeeps up to 6 rabbits, 4 deer and 3 boars, spawning 30-70 m away and despawning them past 100 m. Each kind prefers its habitat: rabbits in meadows, deer at forest edges, boars deep in the woods. A kind waits 25 s to respawn after one dies. Animals aren't saved, so a loaded world repopulates straight away.- A kill leaves a carcass (on the interactable layer). E butchers it, and arrows stuck in it come back to you. Carcasses rot away after 5 min.
- Feathers lie in the meadows as ground pickups (70, regrowing like sticks).
2.8a Wolves and the den (built)
- The den (
den.gd): a cave of piled boulders at the foot of the mountain rim, chosen from the seed. It sits away from the sea and the spawn, opens toward the valley, and has a clearing in front of its mouth. It has a rock roof (it counts as shelter) and old bones on the floor. - Grace period (
wolf_pack.gd):- Days 1-2: no wolves at all.
- Day 3: wolves move into the den and howl at night, with a toast warning. They don't hunt yet.
- Night 4 onward: the pack hunts (night is 19:30 to 05:30, the same as the bed). Pack size is 2, then 3 from day 6 and 4 from day 9. Wolves you kill are replaced at the den by day, while you're away from it.
- Temperament: wary pack hunters, neither berserkers nor harmless:
- The pack circles you about 10 m out, and one wolf at a time darts in to bite, every 4.5 s or so.
- A lit campfire within 8 m is a safe zone: they circle 14 m out around the fire and never close in.
- A held torch makes them hesitate (2.5x longer between darts).
- Walls work: a bite needs a clear line from the wolf to you, so a closed hut is safe. You also can't sleep while wolves prowl within 40 m.
- Hit one and the whole pack turns on you. Below 40% HP a wolf runs off for the night.
- The last wolf of a pack is timid: it keeps its distance, backs off, and won't start a fight.
- By day they rest in the den but defend it. Within 14 m they get up and watch you; within 8 m (or if you hit one) they attack.
- At dawn they go home. Once out of your sight they slip straight back.
- Wolves glow-eyed at night (emissive eyes). Howls are synthesised.
- Animals now take a short committed detour when blocked, so they slide round huts and rocks instead of turning back into them.
- Wolf Cloak (3 wolf pelt + 2 hide + 4 fiber, workbench): +25 warmth, wet chill x0.35.
2.8b Fishing (built)
- Fishing Rod (2 sticks, 3 fiber, 1 flint at a workbench). LMB casts the float in a lobbed arc. It has to land on lake water at least 0.5 m deep: on land you're told so and nothing bites.
- A bite comes after 5-14 s, sooner at dawn and dusk (x0.6) and in the rain (x0.8). The float bobs and dips; you have 1.5 s to click and land the fish, or it gets away and you wait again. Clicking with nothing biting just reels in. Walking more than about 30 m off snaps the line, and switching away from the rod reels in.
- Catch: perch (common) and trout (22%, or 40% at dawn and dusk). Grill them at a campfire. A few fish swim visibly in the lake.
2.8c Mixed diet (built)
Every food belongs to a group: meat (raw meat 8, cooked 40), fish (raw 8-12, grilled perch 30, grilled trout 45) or greens (berries 14, mushroom 10, roasted mushroom 30). Each group has a level (0-100, starting at 60) that runs down over about 1.5 days (1800 s). The HUD shows three small Diet bars, and a low group blinks.
- One group under 15: Poor diet (need fish). No natural healing.
- Two or more under 15: Malnourished. Health drains 0.12/s and stamina recovers at 70%. Living on berries alone keeps you full but kills you in about a day and a half.
- All three at 40 or more: Balanced diet, healing x1.5.
- Diet is saved. After death each group is at least 30, so you don't respawn straight into malnutrition.
2.9 Weapons & combat (built in M1d)
| Weapon | Recipe | Use | Damage |
|---|---|---|---|
| Bare hands, food, torch, resources | 0: you need a weapon (the prompt says so) | ||
| Axe / pickaxe | LMB | 6 (poor weapons) | |
| Wooden Club | 4 wood | LMB, reach 2.4 m | 12 |
| Wooden Spear | 3 wood, 2 flint, 1 fiber (workbench) | LMB thrust (reach 3.1 m); RMB throws it (24 m/s, then pick it up) | 18 / 30 thrown |
| Crude Bow | 4 wood, 6 fiber (workbench) | hold LMB to draw (0.9 s full), release | 8-32 by draw |
| Flint Arrow x5 | 2 sticks, 1 flint, 2 feathers (workbench) | ammunition; misses stick in the world and can be picked up |
- A melee swing is a box sweep in front of the camera, tall enough to reach a rabbit at your feet. It costs stamina and has a per-weapon cooldown. Animals are hit first, then trees and rocks.
- Arrows and thrown spears are projectiles (
projectile.gd) with gravity, ray-cast segment by segment so fast arrows can't skip through a target. Damage scales with speed at impact. Arrows and spears lying in the world are saved. - Getting hurt flashes the screen red and stops natural healing for 6 s.
Animals and players use the same
damage()path, ready for M2.
2.9a Food buffs and clothing (built in M1d)
- Raw meat: +5 food, -4 health (it can't take you below 1). Cooked meat, made at a campfire, gives +34 food, +12 health and Well fed for 10 min: stamina regen x1.3 and healing x2. The HUD shows the time left. Buffs are saved. They don't stack, so the strongest applies.
- Hide Cloak (4 hide + 4 fiber at a workbench): RMB to wear it. It gives +15 warmth and cuts the chill from being wet by 40%. You take it off from the inventory screen. It's saved, and it goes into your grave when you die.
2.10 Saving & worlds (built)
- One continuous world per save slot. The title screen offers Continue (most recent), New World (name and seed: blank = random, 1337 = the original island) and Load World (with delete). You can't save and reload at will to undo mistakes: survival tension depends on choices sticking.
- Autosave every 2 minutes, on Save & Quit (to the title or desktop) and when the window is closed.
- Saves live in
user://worlds/<id>/(on macOS:~/Library/Application Support/Godot/app_userdata/Valheimlike/worlds/) asmeta.json+world.json. Writes are atomic, and the previous save is kept asworld.json.bak. - A save stores only what the player changed: player position and look, inventory, hotbar slot; placed pieces and chest contents; tree and boulder damage, stumps, mined rocks; collected pickups. Everything else regenerates from the seed. Since M1b it also stores stats, time of day, bush regrowth timers, campfire fuel and graves. Since M1c: building pieces (door open or shut), the bed spawn point and regrowth timers. Weather isn't saved: it follows from the seed and the time.
2.11 Death (built in M1b)
- On death you respawn at your bed (or the island spawn) and leave a grave bag with your inventory where you died (Valheim-style: punishing but recoverable). The world carries on.
- Optional hardcore world setting later: death deletes the world.
3. Architecture (fits docs/ARCHITECTURE.md)
- Intents, not results. UI and input never change game state directly. They
call
Actions.*(craft,harvest_hit,pickup,place,transfer), which validates and applies. In M2 these same calls become RPCs to the authoritative server. That's the reason the layer exists now. - Model / view split.
Inventoryis a plain data class with achangedsignal. UI widgets only render it and send intents. - Data in JSON, behaviour in small scripts per piece (
campfire.gd,chest.gd, ...). - Everything procedural: item meshes are built in code and turned into icons at startup by an offscreen renderer, so there are still no art assets to license.
4. Build phases
| Phase | Delivers | Playable "done when" |
|---|---|---|
| M1a (done) | items/recipes data, inventory + hotbar, pickups, chop/mine with tools, crafting UI, campfire / workbench / chest placement, chest storage, pause menu, title screen + world slots + save/load + autosave (pulled forward from M1c) | you craft an axe, fell a tree, build a fire, stash wood in a chest, quit and continue |
| M1b (done) | hunger/warmth/stamina/health HUD, day/night cycle with moon and stars, campfire warmth + fuel, cooking, bushes (fiber, berries), mushrooms, torches, death + grave bag (pulled forward from M1c) | you survive your first night by the fire |
| M1c (done) | weather (rain, storm, snow, blizzard, lightning, sound) + wet/shelter/rested, snap building (floor/wall/door/roof/gable) with support, dismantling and collapse, bed spawn point + sleeping, resource regrowth | you build a hut and wait out a storm |
| M1d (done) | rabbit/deer/boar AI and spawning, club/spear (thrown)/bow + arrows, butchering, hides, hide cloak, cooked meat + Well fed buff, feathers | you hunt a deer and eat its meat |
5. Open decisions (current defaults in bold)
- Thirst stat? No, to keep the stats readable (Valheim has none). Easy to add as a fifth stat later.
- Perspective: first person for now. Third person can come with the character model.
- Death penalty: grave bag (recoverable). Alternatives: lose everything (Rust) or keep everything (casual).
- Day length: 20 min.
- Durability on tools: no for M1, revisit when metals arrive.