docs: hospital rules, the wounded table and its no-locks row

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Fabian @ Blax Software 2026-10-30 13:45:02 +01:00
parent 46b3c6f241
commit 9a8ab05437
2 changed files with 14 additions and 1 deletions

View File

@ -99,6 +99,16 @@ Units live in `config/game/units.php` (Die Stämme-like stats): the building typ
- An order's times are fixed when it is queued: it starts when the previous order at that building ends (or now), and one unit takes `build_time / speed / (1 + recruit_speed_per_level × level) / staffing`. Units arrive lazily, `done = floor(elapsed / seconds_per_unit)`, and every read or action moves them into `unit_stacks`; a `recruit.finished` event settles the rest. - An order's times are fixed when it is queued: it starts when the previous order at that building ends (or now), and one unit takes `build_time / speed / (1 + recruit_speed_per_level × level) / staffing`. Units arrive lazily, `done = floor(elapsed / seconds_per_unit)`, and every read or action moves them into `unit_stacks`; a `recruit.finished` event settles the rest.
- Cancelling refunds the untrained units in full and moves later orders at that building forward. Tearing a military building down refunds what it was still training. - Cancelling refunds the untrained units in full and moves later orders at that building forward. Tearing a military building down refunds what it was still training.
### Hospital
The Lazarett (`hospital`, needs barracks 1) brings part of the fallen back. Its instances add up their `beds`, each scaled by its staffing like production, and a bed holds one wounded of any unit.
- After a battle in the village, `combat.hospital.share` (50%) of each own unit that fell, rounded down, comes in as wounded (`Wounds::admit`). Support fell for another village and gets nothing. When they need more beds than are free, the beds are shared out evenly, the rest by largest remainder. A conquered village takes nobody in, and barbarian villages keep no hospital.
- One battle's wounded are one `wounded` row with `heals_at = battle + heal_time / speed` (4 hours). A `wounded.healed` event puts them back into the village's own stacks.
- The wounded eat like soldiers, so they keep their place in the food budget and the village's numbers don't jump when they heal. Starvation doesn't touch them: they stand again on a fixed timer and can desert from then on.
- The wounded die with their village's owner: conquest, turning barbarian and leaving all clear them (`Nobility::release`).
- The defence report carries `wounded: {units, heals_at}`; the attacker's copy never does. The village payload carries `hospital: {beds, occupied, share, heal_seconds, wounded}`.
## Quest book ## Quest book
The quest book guides new players through the game in parallel lines (`config/game/quests.php`): construction, army, and village, which covers what Die Stämme doesn't have (staffing priorities, a second instance, the levy). A line shows its first unclaimed quest; claiming it (`quest.claim {village_id, quest}`) pays its resources into that village, up to what the storage holds, and opens the next one. Titles and texts are client i18n. The quest book guides new players through the game in parallel lines (`config/game/quests.php`): construction, army, and village, which covers what Die Stämme doesn't have (staffing priorities, a second instance, the levy). A line shows its first unclaimed quest; claiming it (`quest.claim {village_id, quest}`) pays its resources into that village, up to what the storage holds, and opens the next one. Titles and texts are client i18n.
@ -123,6 +133,7 @@ A village may fail through war or bad play, but it must never get stuck. Every l
| Starvation spiral | Deserters leave in the order foreign support, soldiers, then the levy ends. Farms are staffed first, so food income recovers as soldiers leave. | | Starvation spiral | Deserters leave in the order foreign support, soldiers, then the levy ends. Farms are staffed first, so food income recovers as soldiers leave. |
| Foreign support eats the host | The host can send any support home at any time. Foreign support deserts first. | | Foreign support eats the host | The host can send any support home at any time. Foreign support deserts first. |
| Levy never returns | Militia return automatically on a timer. | | Levy never returns | Militia return automatically on a timer. |
| Wounded never return | Each battle's wounded stand again at a fixed `heals_at`. Lint: `combat.hospital.heal_time` above 0 and `share` between 0 and 1. |
| All merchants killed | Merchants are trained at the market like units, so dead merchants can always be replaced. | | All merchants killed | Merchants are trained at the market like units, so dead merchants can always be replaced. |
| Player loses every village | The player can restart on the same world with a fresh village. | | Player loses every village | The player can restart on the same world with a fresh village. |
| Raids bleed a village dry | Raids come `every_hours` apart, after beginner protection, and loot only what the hiding places don't cover; rams never take a wall below 1, and no band takes a village. Beating the camp down scatters its next band. Lint: intervals above 0, `scatter_below` above 0. | | Raids bleed a village dry | Raids come `every_hours` apart, after beginner protection, and loot only what the hiding places don't cover; rams never take a wall below 1, and no band takes a village. Beating the camp down scatters its next band. Lint: intervals above 0, `scatter_below` above 0. |
@ -157,6 +168,7 @@ A building entry looks like this (numbers start TW-like):
| `build_orders` | village_id, building_id null (null = new instance), type, action (build/upgrade/demolish), target_level, cost json, builder null, starts_at null, finishes_at null. Queue order is id order | | `build_orders` | village_id, building_id null (null = new instance), type, action (build/upgrade/demolish), target_level, cost json, builder null, starts_at null, finishes_at null. Queue order is id order |
| `unit_stacks` | village_id (where they stand), home_village_id (owner), unit, count. unique(village_id, home_village_id, unit) | | `unit_stacks` | village_id (where they stand), home_village_id (owner), unit, count. unique(village_id, home_village_id, unit) |
| `recruit_orders` | village_id, building_id, unit, count, done, seconds_per_unit, starts_at, finishes_at, game_event_id | | `recruit_orders` | village_id, building_id, unit, count, done, seconds_per_unit, starts_at, finishes_at, game_event_id |
| `wounded` | village_id, units (json unit => count), heals_at datetime(3): one battle's wounded in the hospital |
| `food_deliveries` | village_id, amount, delivered_at. Feeds the 24h import average; each row's expiry is an event | | `food_deliveries` | village_id, amount, delivered_at. Feeds the 24h import average; each row's expiry is an event |
| `movements` | world_id, player_id (whose troops), type (attack/support/return), mode, origin_id, target_id, units json, cargo json null, catapult_target null, rng_seed, sent_at, arrives_at, visible_at. Trade, merchants and destroyed_at come with M5 | | `movements` | world_id, player_id (whose troops), type (attack/support/return), mode, origin_id, target_id, units json, cargo json null, catapult_target null, rng_seed, sent_at, arrives_at, visible_at. Trade, merchants and destroyed_at come with M5 |
| `tribes`, `tribe_members`, `tribe_invites`, `tribe_relations`, `tribe_events` | world_id, name, tag, description; tribe_id, player_id (unique), role; tribe_id, player_id, invited_by; tribe_id, other_tribe_id, state (ally/nap/enemy), confirmed_at, ends_at; tribe_id, type, payload, happened_at | | `tribes`, `tribe_members`, `tribe_invites`, `tribe_relations`, `tribe_events` | world_id, name, tag, description; tribe_id, player_id (unique), role; tribe_id, player_id, invited_by; tribe_id, other_tribe_id, state (ally/nap/enemy), confirmed_at, ends_at; tribe_id, type, payload, happened_at |
@ -304,7 +316,7 @@ Combat uses the TW model, in `CombatResolver` (pure, tested with fixed luck) and
- Attack strength is split into infantry, cavalry and archer by each unit's class. Every defender, own or support, counts with its defence against each class, weighted by the attacker's mix. Levied militia defend with `combat.militia.defense` per head. - Attack strength is split into infantry, cavalry and archer by each unit's class. Every defender, own or support, counts with its defence against each class, weighted by the attacker's mix. Levied militia defend with `combat.militia.defense` per head.
- The wall at level L adds `basic_defense × L` and multiplies the defence by `factor^L` (20 and 1.037). Rams lower the wall before the battle: each level L down needs `base × factor^(L − 1)` rams (2 and 1.09). Nothing drops below level 1. - The wall at level L adds `basic_defense × L` and multiplies the defence by `factor^L` (20 and 1.037). Rams lower the wall before the battle: each level L down needs `base × factor^(L − 1)` rams (2 and 1.09). Nothing drops below level 1.
- The attack is multiplied by morale and (1 + luck). Luck is drawn evenly from ±`combat.luck` (25%) with the movement's seed, so a replayed event fights the same battle. Morale is `min(1, 0.3 + 3 × defender points / attacker points)` and always 1 against barbarians. Worlds with a night bonus multiply the defence at night. - The attack is multiplied by morale and (1 + luck). Luck is drawn evenly from ±`combat.luck` (25%) with the movement's seed, so a replayed event fights the same battle. Morale is `min(1, 0.3 + 3 × defender points / attacker points)` and always 1 against barbarians. Worlds with a night bonus multiply the defence at night.
- The winner loses `(loser / winner)^1.5` of every unit, rounded per stack; the loser loses everything. Dead militia shrink the levy. - The winner loses `(loser / winner)^1.5` of every unit, rounded per stack; the loser loses everything. Dead militia shrink the levy. Part of the defender's own dead come back from its hospital (see "Hospital").
- After a won battle, surviving catapults hit the highest instance of the chosen type (headquarters by default) by the same siege rule. A damaged building's queued orders are cancelled with a full refund, since their levels no longer fit. - After a won battle, surviving catapults hit the highest instance of the chosen type (headquarters by default) by the same siege rule. A damaged building's queued orders are cancelled with a full refund, since their levels no longer fit.
- Scouts (units with `scout: true`) never fight. They meet the scouts in the village first: they get through when they outnumber `combat.scouting.defense` × the defending scouts, losing `(defence / attack)^1.5` of themselves; otherwise all of them die, and defending scouts never die in this. Scouts that get through add the village's resources and building levels, after the battle, to the attacker's report. Scouts alone cause no battle; defending scouts die with the village's other defenders when a battle is lost. - Scouts (units with `scout: true`) never fight. They meet the scouts in the village first: they get through when they outnumber `combat.scouting.defense` × the defending scouts, losing `(defence / attack)^1.5` of themselves; otherwise all of them die, and defending scouts never die in this. Scouts that get through add the village's resources and building levels, after the battle, to the attacker's report. Scouts alone cause no battle; defending scouts die with the village's other defenders when a battle is lost.
- `LootCalculator`: survivors carry `carry` per unit. They take wood, clay and iron evenly, above what the hiding places protect (`hides` per resource; instances add up). Food is not looted. - `LootCalculator`: survivors carry `carry` per unit. They take wood, clay and iron evenly, above what the hiding places protect (`hides` per resource; instances add up). Food is not looted.

View File

@ -71,6 +71,7 @@ The world pushes back, so a world with few players is a game too: something thre
- [x] Raiders: the nearest barbarian camp sends a band at every player village about once a day, announced hours ahead and sized by the village's points, with rams against a wall; hitting the camp first shrinks or scatters the band; loot goes back to the camp, a beaten band pays a bounty - [x] Raiders: the nearest barbarian camp sends a band at every player village about once a day, announced hours ahead and sized by the village's points, with rams against a wall; hitting the camp first shrinks or scatters the band; loot goes back to the camp, a beaten band pays a bounty
- [x] Scarce building space (5 per headquarters level instead of 20) and specialisation: a resource village produces more, a military village trains faster and defends better - [x] Scarce building space (5 per headquarters level instead of 20) and specialisation: a resource village produces more, a military village trains faster and defends better
- [x] Seasons: crown villages appear around 0|0 after some weeks; a player who holds most of them long enough wins the world, and the next world opens - [x] Seasons: crown villages appear around 0|0 after some weeks; a player who holds most of them long enough wins the world, and the next world opens
- [x] Lazarett: half of the own defenders who fall come back wounded into the hospital's beds and stand again after four hours
## M5: Trade and encounters ## M5: Trade and encounters