M1d: creatures, hunting, weapons, food buffs and the hide cloak

- Rabbits, deer and boars with procedural meshes and animated legs, a
  state machine (idle/wander/flee/charge/dead) and heightmap steering that
  avoids water, cliffs, the world edge, trees and buildings
- Spawner keeps a habitat-based budget around the player (6/4/3)
- Melee needs a weapon or tool (club, spear, axe, pickaxe); box sweep hits
- Wooden spear (thrust or throw) and crude bow with draw-scaled arrows;
  projectiles stick in the world as saved pickups
- Carcasses: E to butcher for meat, hide and embedded arrows
- Boars charge and gore when hit; hurt flash and a brief healing pause
- Cooked meat gives Well fed (faster stamina and healing); buffs saved
- Hide cloak: wear for warmth, saved, goes in the grave on death
- Feathers as meadow pickups (appended, existing save ids unchanged)
- New test_creatures_combat suite; run_all.sh gets a per-suite time limit
This commit is contained in:
Paul Bailey
2026-11-04 10:55:44 +00:00
parent fed96ef118
commit 67bf85523d
22 changed files with 1782 additions and 33 deletions

View File

@@ -32,7 +32,8 @@ Detailed plan in `docs/SURVIVAL_DESIGN.md` (phases M1a–M1d).
- [x] Weather (rain, storm, snow), wet/shelter *(M1c)*
- [x] Snap-together building: floor/wall/door/roof/gable, resource cost, support + collapse, dismantling *(M1c)*
- [x] Bed spawn point and sleeping, resource regrowth *(M1c)*
- [ ] Creatures, hunting, weapons *(M1d)*
- [x] Creatures (rabbit, deer, boar), hunting, club/spear/bow, butchering, cooked-food buffs, hide cloak *(M1d)*
- [ ] Wolves at night, hide armour, more recipes *(later M1 polish)*
- **Done when:** gather → craft → build a tiny shelter, single-player.
## M2 — Multiplayer · ~2–4 months

View File

@@ -20,6 +20,8 @@ tests/run_all.sh
```
Or one at a time:
```bash
# Wildlife, melee, spear, bow, butchering, cooking + buffs, cloak, drops
godot --headless --path . --script res://tests/test_creatures_combat.gd
# Weather, shelter, snap building, support, doors, beds, regrowth
godot --headless --path . --script res://tests/test_weather_building.gd
# Boundary: tries to walk/jump out of the valley in 24 directions

View File

@@ -152,19 +152,57 @@ Built in M1b (`scripts/player/survival.gd`), current numbers:
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 *(M1d)*
- **Rabbit**: skittish, fast, gives a little meat.
- **Deer**: flees on sight or sound, gives meat and hide.
- **Boar**: neutral; charges if hit; gives meat and hide.
- *(later)* **Wolf**: night predator, hunts in packs.
- Simple state machines (idle / wander / flee / attack) on navigation-free
steering over the heightmap. Spawned around the player within budget.
### 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 |
### 2.9 Weapons & combat *(M1d)*
- Club (hand), wooden spear (thrust; can be thrown), bow + arrows (workbench;
needs feathers and flint).
- A melee swing is a short shape cast in front of the camera. It costs stamina
and has a cooldown. Damage numbers come from item data.
- *(later)* **Wolf**: night predator, hunts in packs.
- `scripts/creatures/creature.gd` runs 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.gd` keeps 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.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
@@ -210,7 +248,7 @@ Built in M1b (`scripts/player/survival.gd`), current numbers:
| **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** | rabbit/deer/boar AI, club/spear/bow, hides, cooked food buffs | you hunt a deer and eat its meat |
| **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).