M1b: survival stats, day/night, fire fuel, cooking, foraging, torches, death + grave

- Health, stamina, hunger, warmth and wet with HUD bars, status tags and clock
- 20-minute day/night cycle with moon, stars and lit clouds
- Campfire fuel (2 min start, 15 min max), heat radius, cooking needs a lit fire
- Berry bushes (regrow 10 min), mushrooms, roasted mushroom, torch
- Stamina costs for sprint, jump and harvest hits
- Death respawns at island start and leaves a grave bag
- Saves include stats, time of day, fire fuel, regrowth timers and graves
- New test_survival_stats suite; tests fail if a script error aborts them
This commit is contained in:
Paul Bailey
2026-11-04 01:19:41 +00:00
parent 2b1afc86ba
commit fc7eb3cfed
28 changed files with 1326 additions and 97 deletions

View File

@@ -23,10 +23,13 @@ actually run and see. Timelines assume solo dev + heavy AI assistance, steady
## M1 — Survival loop (single-player) · ~3–5 weeks
**Goal:** the core game verbs.
- [ ] Resource nodes: chop tree → wood, mine rock → stone
- [ ] Inventory + simple hotbar UI
- [ ] Crafting (recipe: wood → tools / building pieces)
- [ ] Health / stamina, day-night cycle
Detailed plan in `docs/SURVIVAL_DESIGN.md` (phases M1a–M1d).
- [x] Resource nodes: chop tree → wood, mine rock → stone *(M1a)*
- [x] Inventory + simple hotbar UI, chests *(M1a)*
- [x] Crafting (recipe: wood → tools / building pieces) *(M1a)*
- [x] Pause menu, title screen, world slots, save/load, autosave *(M1a)*
- [x] Health / stamina / hunger / warmth, day-night cycle, fire fuel, cooking, foraging, torches, death + grave *(M1b)*
- [ ] Weather (rain, storm, snow), wet/shelter *(M1c)*
- [ ] Snap-together building: place a wall/floor, resource cost, basic support rule
- **Done when:** gather → craft → build a tiny shelter, single-player.

View File

@@ -23,6 +23,8 @@ godot --headless --path . --script res://tests/test_terrain_edges.gd
godot --headless --path . --script res://tests/test_survival_core.gd
# Save/load round trip + world slots (uses user://test_worlds, not your saves)
godot --headless --path . --script res://tests/test_save_load.gd
# Survival stats: hunger, warmth, fire fuel, cooking, foraging, death + grave
godot --headless --path . --script res://tests/test_survival_stats.gd
```
## Save files

View File

@@ -84,6 +84,21 @@ 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
@@ -121,9 +136,10 @@ you're out), **Cold** / **Freezing**, **Warm** (near a fire), **Sheltered**,
- 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. *(Later: stats, time of day, weather, regrowth timers.)*
from the seed. Since M1b it also stores stats, time of day, bush regrowth
timers, campfire fuel and graves. *(Later: weather.)*
### 2.11 Death *(M1c)*
### 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.
@@ -146,8 +162,8 @@ you're out), **Cold** / **Freezing**, **Warm** (near a fire), **Sheltered**,
| 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** | hunger/warmth/stamina/health HUD, day/night cycle, campfire warmth + fuel, cooking, bushes (fiber, berries), torches | you survive your first night by the fire |
| **M1c** | weather (rain, storm, snow) + wet/shelter, snap building (floor/wall/roof/door) with support, death + grave bag, resource regrowth | you build a hut and wait out a storm |
| **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** | weather (rain, storm, snow) + wet/shelter, snap building (floor/wall/roof/door) with support, bed spawn point, resource regrowth | you build a hut and wait out a storm |
| **M1d** | rabbit/deer/boar AI, club/spear/bow, hides, cooked food buffs | you hunt a deer and eat its meat |
## 5. Open decisions (current defaults in bold)