feat(apiary): breed with alleles, mutate species, analyse queens for honey #13

Merged
alex merged 5 commits from feat/allele-genetics into main 2026-10-31 18:25:34 +01:00
Owner

The bee game now breeds on genes, in the spirit of the Forestry mod, with our own species and tree.

What changes

  • Genome: five genes (species, productivity, fertility, resilience, gentleness), each a pair of alleles: one active, one inactive, each dominant or recessive. Trait alleles keep the 0–10 scale, so ColonyPolicy and its rule vectors don't change. The regional traits are gone; biomes now matter through their wild species.
  • Breeding (BreedingPolicy.v2): one allele per gene from each side; the dominant one is active and ties are settled at random. Every distinct pair of species the two sides carry gets one mutation roll; a success replaces that side with a pure-bred queen of the new species. Andalusia's tree: Iberian × Rosemary → Lavender (15%), Iberian × Lavender → Dehesa (12%), Lavender × Rosemary → Orange-blossom (10%), Orange-blossom × Dehesa → Alhambra (5%). Open flights meet wild Iberian and rosemary drones.
  • Analysis: POST /api/apiary/queens/{id}/analysis pays 200 g of honey (AnalysisPaid on the Keeper), then a handler analyses the queen. Until then a reserve queen shows only her species, and a hive queen only her active traits. Starter queens come analysed.
  • Release: POST /api/apiary/queens/{id}/release lets a reserve queen go to free a slot. The app asks for confirmation first.
  • Codex: GET /api/apiary now returns the codex. Wild species say where they live; bred species show their parents once the keeper knows enough.
  • App: a genome table (active and inactive alleles, dominance markers, deltas against the hive queen), Analyse and Release on reserve cards, analysis in the Queen drawer, the codex as a list with hints, and colours for the new species.
  • Migrations: 202610311500-allele-genomes converts stored genomes to the nearest alleles (carried twice, marked analysed); 202610311600-release-queens adds released.

Checks

  • nx affected -t lint typecheck test build passes, and so does the apiary int-test against Postgres.
  • In the browser: migrated the local database, then released, bred an open flight, analysed the new queen (she carried a hidden rosemary allele), and checked the Queen drawer and the codex. No console errors.

🤖 Generated with Claude Code

The bee game now breeds on genes, in the spirit of the Forestry mod, with our own species and tree. ## What changes - **Genome**: five genes (species, productivity, fertility, resilience, gentleness), each a pair of alleles: one active, one inactive, each dominant or recessive. Trait alleles keep the 0–10 scale, so `ColonyPolicy` and its rule vectors don't change. The regional traits are gone; biomes now matter through their wild species. - **Breeding (`BreedingPolicy.v2`)**: one allele per gene from each side; the dominant one is active and ties are settled at random. Every distinct pair of species the two sides carry gets one mutation roll; a success replaces that side with a pure-bred queen of the new species. Andalusia's tree: Iberian × Rosemary → Lavender (15%), Iberian × Lavender → Dehesa (12%), Lavender × Rosemary → Orange-blossom (10%), Orange-blossom × Dehesa → Alhambra (5%). Open flights meet wild Iberian and rosemary drones. - **Analysis**: `POST /api/apiary/queens/{id}/analysis` pays 200 g of honey (`AnalysisPaid` on the Keeper), then a handler analyses the queen. Until then a reserve queen shows only her species, and a hive queen only her active traits. Starter queens come analysed. - **Release**: `POST /api/apiary/queens/{id}/release` lets a reserve queen go to free a slot. The app asks for confirmation first. - **Codex**: `GET /api/apiary` now returns the codex. Wild species say where they live; bred species show their parents once the keeper knows enough. - **App**: a genome table (active and inactive alleles, dominance markers, deltas against the hive queen), Analyse and Release on reserve cards, analysis in the Queen drawer, the codex as a list with hints, and colours for the new species. - **Migrations**: `202610311500-allele-genomes` converts stored genomes to the nearest alleles (carried twice, marked analysed); `202610311600-release-queens` adds `released`. ## Checks - `nx affected -t lint typecheck test build` passes, and so does the apiary `int-test` against Postgres. - In the browser: migrated the local database, then released, bred an open flight, analysed the new queen (she carried a hidden rosemary allele), and checked the Queen drawer and the codex. No console errors. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Genomes become pairs of alleles per gene (species, productivity, fertility,
resilience, gentleness), each dominant or recessive; a queen expresses the
active one and passes either on. Breeding draws one allele from each side, and
species the two sides carry can mutate into a new one, often hidden at first:
an Andalusian tree from the wild Iberian and rosemary bees up to the Alhambra
bee. Analysing a queen costs 200 g of honey and reveals her alleles; reserve
queens can be released to make room. Existing genomes are migrated to the
nearest alleles. The app shows genes, analyses, releases, and a codex that
reveals the tree as the keeper breeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new Focus context records timed sessions (15, 25, 50 or 90 minutes, one at a
time). A session completes only once its time is up by the server's clock and
publishes FocusSessionCompletedV1. Rewards pays it at once on the Ledger, 0.5
nectar and 0.2 pollen a minute, at most 180 minutes in any 24 hours, and
publishes FocusRewardedV1 for the Apiary's stores.

The game screen gets a Focus slot: pick a length, watch the countdown over the
island, give up or complete. Leaving the app for more than ten seconds loses
the session, judged by page visibility and remembered across a closed app. The
stores show the pay at once while the server catches up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The game moves to a Forestry-like progression. A homestead per keeper holds an
island of cells, an inventory of individual bees (princesses and drones, each
with a genome) and supplies. Focus sessions explore Andalusia and turn up wild
hives (the first always does); collecting one gives a pure-bred princess and
drones. Hives and flowers are placed on the island from hive kits and seeds,
bought with nectar and pollen. A princess and a drone in an empty hive become
a queen who makes honey near the flower her new flower gene names, for her
new lifespan gene in hours; at her death she leaves a princess and drones bred
from her and her mate. The keeper aggregate becomes the wallet.

Existing keepers are migrated: their hive keeps its queen alive with flowers
around it, and reserve queens become a princess and a drone each. The web app
gets a guide to the next step, a build hotbar with glowing cells, a hive panel,
a bee inventory, and a scene drawn from the homestead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewed-on: https://git.selene.acl.sh/Habitea/App/pulls/15
Reviewed-on: https://git.selene.acl.sh/Habitea/App/pulls/14
alex merged commit 120083bc6f into main 2026-10-31 18:25:34 +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!13
No description provided.