Breeding: queens with inherited traits, a reserve, and species to discover #11

Merged
alex merged 5 commits from feat/breeding into feat/identity 2026-10-31 08:58:57 +01:00
Owner

Stacked on #10.

Pollen from perfect days now breeds queens, the game's main loop after harvesting.

Domain (Apiary):

  • BreedingPolicy v1: 15 pollen per breeding, a reserve of at most 6 queens, and Andalusia's wild-drone profile (lavender affinity 8).
    • Each trait is the average of mother and drones, rounded either way at random.
    • On top, a mutation of 1 to 3 points, with a 5% (controlled) or 15% (open) chance per trait.
  • Randomness is pure-rand 8.4.2, seeded from the breeding's id, so every queen can be replayed. Tests cover reproducibility, bounds, open mutating more than controlled, and the lavender tendency.
  • A Queen aggregate, in the reserve or heading a hive. The hive keeps a copy of its queen's genome, which decides its production.
  • Keeper: pays for breedings (refused without enough pollen), and records discovered species.
  • Hive: replaceQueen, which settles the hive under the previous queen first.

One aggregate per transaction, chained by the apiary's own events:

  • BreedQueen → the keeper pays (BreedingPaid) → the queen is raised → the keeper may discover a species.
  • InstallQueen → the queen leaves the reserve → the hive takes her (QueenReplaced) → the previous queen returns to the reserve. A starter queen gets an identity of her own the first time.
  • Endpoints: POST /api/apiary/breedings and POST /api/apiary/queens/{id}/install (both 202). GET /api/apiary now includes the reserve and discovered species.
  • Migration: a queens table, a hive's queen_id, a keeper's discovered_species.

Web:

  • Breeding section: open or controlled flight, the cost, and why breeding is unavailable when it is.
  • "Your new queen is on her mating flight…" until she appears, plus a discovery count and a message when a breeding discovers a new species.
  • Reserve cards with every trait against the current queen (+3, −1, =), and an Install button.
  • The hive scene tints workers with their queen's colours.
  • Fixed during testing: after an install, a reload taken before the hive caught up showed the old queen again. The client now waits for the hive to report the new queen; a test covers it and fails without the fix.

Checked:

  • API: an open and a controlled breeding; installing the open-bred daughter; a second open generation gives an Andalusian lavender bee and records the discovery.
  • Browser: breeding from the screen (a mutation gave fertility 8, +3); installing; the lavender-tinted bees; production 105 → 145 g/h.
  • All 44 projects pass lint, typecheck, test and build; integration tests pass for 7.

The demo account was given 75 pollen directly in the dev database.

🤖 Generated with Claude Code

Stacked on #10. Pollen from perfect days now breeds queens, the game's main loop after harvesting. **Domain (Apiary):** - `BreedingPolicy v1`: 15 pollen per breeding, a reserve of at most 6 queens, and Andalusia's wild-drone profile (lavender affinity 8). - Each trait is the average of mother and drones, rounded either way at random. - On top, a mutation of 1 to 3 points, with a 5% (controlled) or 15% (open) chance per trait. - Randomness is `pure-rand` 8.4.2, seeded from the breeding's id, so every queen can be replayed. Tests cover reproducibility, bounds, open mutating more than controlled, and the lavender tendency. - A **Queen** aggregate, in the reserve or heading a hive. The hive keeps a copy of its queen's genome, which decides its production. - Keeper: pays for breedings (refused without enough pollen), and records discovered species. - Hive: `replaceQueen`, which settles the hive under the previous queen first. **One aggregate per transaction, chained by the apiary's own events:** - `BreedQueen` → the keeper pays (`BreedingPaid`) → the queen is raised → the keeper may discover a species. - `InstallQueen` → the queen leaves the reserve → the hive takes her (`QueenReplaced`) → the previous queen returns to the reserve. A starter queen gets an identity of her own the first time. - Endpoints: `POST /api/apiary/breedings` and `POST /api/apiary/queens/{id}/install` (both 202). `GET /api/apiary` now includes the reserve and discovered species. - Migration: a `queens` table, a hive's `queen_id`, a keeper's `discovered_species`. **Web:** - Breeding section: open or controlled flight, the cost, and why breeding is unavailable when it is. - "Your new queen is on her mating flight…" until she appears, plus a discovery count and a message when a breeding discovers a new species. - Reserve cards with every trait against the current queen (+3, −1, =), and an Install button. - The hive scene tints workers with their queen's colours. - **Fixed during testing:** after an install, a reload taken before the hive caught up showed the old queen again. The client now waits for the hive to report the new queen; a test covers it and fails without the fix. **Checked:** - API: an open and a controlled breeding; installing the open-bred daughter; a second open generation gives an Andalusian lavender bee and records the discovery. - Browser: breeding from the screen (a mutation gave fertility 8, +3); installing; the lavender-tinted bees; production 105 → 145 g/h. - All 44 projects pass lint, typecheck, test and build; integration tests pass for 7. The demo account was given 75 pollen directly in the dev database. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Breeding costs 15 pollen and raises a queen from a mother colony on an open
flight (Andalusia's wild drones) or a controlled one: half of each trait from
each side, seeded mutations, reproducible from the breeding's id. Queens wait
in a reserve and can head the hive; the replaced queen returns to the reserve.
New species are discovered along the way. Each step is its own transaction,
chained by the apiary's own events. The app breeds, installs, waits for the
server to catch up, and tints the bees with their queen's colours.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hive scene becomes a floating voxel island in Andalusia: grass, dirt and
stone blocks, an olive tree, a lavender crop, and a wooden hive whose workers
beat their wings in their queen's colours. Every texture is painted at start-up
from pixel maps and scaled up without smoothing.

The whole Apiary page wears a new pixel skin from the design system: bevelled
panels, inventory slots, segmented bars, pixel buttons and notes, and the
Pixelify Sans font. A bee codex shows the species found so far. The look takes
after the Minecraft bee mods that inspired the game, with art of our own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The voxel island now fills the page at the largest whole-number scale that
still shows it, under a sky with distant islets. A heads-up display sits over
the scene: the hive and its harvest, the stores, a hotbar of menus, and the
biome. The queen, breeding, reserve and codex open as pixel drawers that slide
in from the left or the right; Escape closes them.

The design system gains hab-game-layout, hab-pixel-drawer and hab-slot-button,
and the pixel panel can go without a heading or with compact padding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewed-on: https://git.selene.acl.sh/Habitea/App/pulls/12
alex merged commit e8104ce70c into feat/identity 2026-10-31 08:58:57 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Habitea/App!11
No description provided.