🧠 How they think

The complete workings of the simulation, so that their behaviour can be improved afterwards. Each section says where the corresponding setting is found.

1. The loop: one minute at a time

The engine advances by one simulated minute per turn. The language model is called only when a character is free and has to decide something. Everything else (gauges, working time, luck, distances) is code, with no model.

flowchart TD
  T["One minute passes"] --> J["The body: thirst, hunger and energy go down"]
  J --> M{"Life at zero?"}
  M -- yes --> X["Permanent death. The bag stays on the tile"]
  M -- no --> L{"Free?
not walking, working or in conversation"} L -- no --> A["The current action moves forward"] L -- yes --> AP["The engine lists the possible actions
here and now, from the terrain and the bag"] AP --> I["Instinct: if thirst or hunger is critical,
it removes what cannot help"] I --> P["Prompt = brain + perceptions + body + actions"] P --> Q["Local model: Ollama, Qwen"] Q --> V{"Valid JSON
and action in the list?"} V -- no --> R["One retry with the error,
otherwise a reflex with no model"] V -- yes --> E["The engine applies it:
time, luck, energy"] E --> N["The result arrives in the next prompt:
'what has just happened'"] R --> N A --> T N --> T
The principle that avoids constraining them: the model does not receive orders, it receives what is true (its state, what it sees, what is feasible) and chooses from the list. The JSON schema sent to Ollama contains one variant per action possible at that instant: an impossible answer cannot be produced.

Code: src/moteur.py (tick, actions_possibles, instinct, appliquer, resoudre) · prompts: src/contexte.py.

2. The brain: one text always there, four stored memories

Not everything is in the prompt all the time. Only one text is always there: the main brain, which the character writes themselves. The four other memories are stored: the character sees only what concerns the place where they are, the people in front of them, what they are carrying and the places in their plan, unless they decide to reopen them. They also see the next steps of the progression tree (what they can cook, build or craft, what they lack and what it costs). They also know their consumption: the prompt tells them how much they lose per hour and how long it will be before their thirst and hunger reach zero.

flowchart LR
  subgraph TOUJOURS["Always there"]
    CP["MAIN BRAIN
their name + a text they write themselves
150 words at most"] end subgraph RANGE["Stored memories"] CA["MAP
one note per place
+ what they saw there with their own eyes"] GE["PEOPLE
one file per person
+ trust and affinity"] OB["OBJECTS
what they have measured of each thing
+ their notes"] SA["KNOWLEDGE
rules, belongings, projects,
lessons, questions"] end subgraph JOUR["Memory of the day"] VU["Seen and heard
the last 8 perceptions"] CN["Notebook
the notes they chose to write"] end PR(["PROMPT of the decision"]) CP ==> PR VU ==> PR CN ==> PR CA -- "only the place where they are" --> PR GE -- "only the people in sight" --> PR OB -- "only what they carry" --> PR OB -. "consult" .-> PR CA -. "consult" .-> PR GE -. "consult" .-> PR SA -. "consult" .-> PR
PartWhat it containsWho writes it, and whenWhen it is in the promptSetting
Main brain“I am X.” followed by a free text. At the start: thirst and hunger kill, I can only see 2 tiles away, my memories are stored.The character: by day with reflechir (field cerveau), and every night (cerveau_principal).Always.[memoire] cerveau_mots · starting text: NOYAU in contexte.py
MapPer place: their note from the night, the terrains they have seen there (water, rock, shelter…), the state of the resources as observed (bare bushes, fish).The note: the character, at night. What they have seen: the engine, when they look.The place where they are. Everything, for 3 decisions, after consulter carte.[memoire] consultation_decisions
total budget: memoire_tokens in each file of personnages/
PeopleOne file per person (3 to 5 sentences), a label, trust and affinity from -10 to +10, the promises given.The character, at night.The people in sight or mentioned. Everything after consulter gens.
ObjectsPer object, what they have discovered by using it: the hunger restored by a food (unknown until they have eaten some), the prices seen at the Trading Post, what the Trading Post buys back, how it is crafted, their successes in figures with a tool or with bare hands. Plus their personal note.The measurements: the engine, at the moment they live it. The note: the character, at night.The objects they carry and their bare-handed actions. Everything after consulter objets.
KnowledgeFive headings: rules understood, my belongings, projects, lessons, what I want to know.The character, at night.On waking, during their first 3 decisions. After that, only after consulter savoir.
Memory of the dayRecent perceptions (they fade) and the notebook (the facts they chose to keep, each one filed: map, people or knowledge).Perceptions: the engine. Notebook: the character, with retenir and ranger.Always. Erased on waking: only the night's sort survives.memoire_du_jour in each file of personnages/
Books readThe full text of each book paid for or learnt from someone else.The game, at the end of the reading or the teaching.Always (in the fixed part of the prompt).[livres] in config.toml

The character has no personality written in advance: a name and some measurements (stamina, speed of thirst and hunger, size of the memories). Their traits and the summary “what the island has made of you” are rewritten every night from what they have lived through.

What they keep in view, and their project

So as not to drown the model (and not to exceed the context size), some of the blocks are folded. The character chooses themselves, while thinking or at night, the 4 blocks they want to see: their consumption and reserves, what they can reach, what they know about their objects, the Trading Post, what their objects are for, what they do not know, the places in their plan. The situation unfolds some of them by itself: consumption when their gauges drop or in the evening, the Trading Post when they are there. A “REPLIÉ” (folded) line reminds them of what they are not seeing.

They can also set themselves a project (a dish, a building, a tool). The game then breaks it down into steps with figures: what is missing, where it comes from (if they know), how long their own attempts suggest it will take, and what it will open up next. The calculations are done for them; the decision remains theirs.

flowchart LR
  R["reflechir (thinking), or the night"] --> A["attention: 4 chosen blocks"]
  R --> P["project: oven, stew, boots…"]
  A --> PR(["shorter prompt"])
  S["the situation: low gauges, place"] --> PR
  P --> C["the game calculates: what is missing, source, estimated time, what it opens up"]
  C --> PR
  X["their past attempts: 3 attempts at mining = 2 stones"] --> C

3. Day and night: what is kept, what is lost

sequenceDiagram
  participant M as The world
  participant P as The character
  participant C as Notebook of the day
  participant R as Map, People, Knowledge
  participant N as Main brain
  M->>P: what they see, hear, obtain
  P->>C: retenir, they note a fact and file it
  P->>N: reflechir, they rewrite their main brain
  P->>R: consulter, a memory comes back for 3 decisions
  Note over P,C: What is not noted fades away
  M->>P: they fall asleep
  P->>R: they rewrite the map, the knowledge and the files within their budget
  P->>N: they rewrite the main brain
  P->>P: they say what they chose to keep and to forget
  Note over R,N: Whatever exceeds the budget is trimmed from the end
  M->>P: waking up with the schedule they set themselves

The night is one model call per character, the way a long conversation is compacted: the character receives their notebook, what they still have in mind, their current memories, and returns the whole lot rewritten. If the answer is unreadable (another language, a heading reduced to its title), it is requested once more, then the unreadable pieces are thrown away.

Code: prompt_nuit and schema_nuit in contexte.py, appliquer_nuit in moteur.py · settings: [llm.nuit].

4. The map: a single island, terrains

There are no longer separate boards or roads. The island is a single grid of hexagons drawn in config.toml ([carte] lignes, one character per tile). The places are only the names of the regions ([carte.regions]). What can be done depends on the terrain of the region you are in, and on the tile you are standing on.

TileTerrainWhat it allows
~waterIt cannot be walked on. From the shore: boire, puiser, and pecher if there is no pontoon.
=pontoonpecher
. ,grass, sandplanter (the tile becomes garden soil) · construire a shelter or a fire · cacher, fouiller
#rockminer
T b gtrees, berry bush, game thicketcouper_bois · cueillir (as long as berries remain) · chasser
A F Eshelter, fire, workbenchdormir in the shelter · cuire and se_reposer around the fire · crafter
C P Lstall, noticeboard, booksacheter, vendre · ecrire_panneau · lire_livre
j ogarden soil, wellplanter, arroser, recolter · drinking at the Camp once the well has been dug by several people
flowchart LR
  V2["Normal view
2 tiles"] -->|"observe, 3 min"| V6["Wide view
6 tiles for 10 min"] AR["Arriving in a place"] -->|"a 3-minute glance"| V6 V6 -->|"time passes"| V2 V6 --> S["What they see is added
to their MAP memory"] V2 --> D["Speaking: 2 tiles
Giving, trading, stealing, fighting: in contact"]

Each tile has coordinates (x,y), x from west to east, y from north to south. The character always knows their own, sees things and people with their coordinates, and their MAP memory keeps them. Each bush bears its own berries.

Moving: aller_case walks towards a precise tile, aller_zone walks straight towards a place (1 minute per tile), se_deplacer advances 1 to 6 tiles in one of the six directions and stops at the water's edge. What a character sees of the others, they see only within sight range: someone 4 tiles away does not exist for them until they have observed.

Code: src/carte.py · settings: [grille] (vue, vue_observer, parole, contact), [carte], [construire.*].

5. Surviving: the body

stateDiagram-v2
  state "Fine" as Bien
  state "Alert" as Alerte
  state "Emergency" as Urgence
  state "Dying" as Agonie
  state "Dead" as Mort
  [*] --> Bien
  Bien --> Alerte : thirst or hunger below 30
  Alerte --> Urgence : below 15
  Urgence --> Agonie : gauge at 0, life drains away
  Agonie --> Mort : life at 0
  Alerte --> Bien : drink or eat
  Urgence --> Bien : drink or eat
  Agonie --> Bien : drink or eat in time
  Mort --> [*]
GaugeWhat empties itWhat fills itAt zero
Thirsttime (specific to each character)drinking at the shore, or one portion from a flasklife drops by 10 per hour
Hungertime (specific to each character)berries +10, small fish +14, fish +25, meat +35, hot dish +55life drops by 6 per hour
Energyworking, walking, fightingresting, eating, sleepingno more work is possible
Speechevery word spokentime, sleepthey can only make gestures
Lucidityevery model callsleepthey act by reflexes, with no model
Only two safeguards remove choices. Act before leaving again: on arriving somewhere, the character must do one thing there before being able to leave for another place (agir_avant_de_repartir). The survival instinct: Critical thirst: all that remains is drinking, or walking towards water. Critical hunger with food in the bag: all that remains is eating. Critical hunger with nothing: everything stays open (asking, trading, stealing, fishing, sleeping, going to the council), only what cannot feed is removed, and the prompt says what is true (the council gives a ration, someone here may have something to eat, your energy is at zero). Setting: [garde_fous] instinct_survie.

6. Talking to each other

sequenceDiagram
  participant A as The one who opens
  participant B as The other
  A->>B: speak, they must be within 2 tiles
  loop each in turn
    B->>A: speak, propose a trade or a meeting
    A->>B: accept, refuse, counter-offer
    B->>A: explain in their own words, promise
  end
  Note over A,B: Those within 2 tiles hear everything
  A->>B: conclude
  Note over A,B: Nothing passes by itself. Each keeps only what they note with retenir

No automatic transfer: a book, a recipe, a promise, a voted rule pass from one head to another only through speech; the listener retains what they want, where they want. A conversation is a series of model calls, one per line. It is possible to work while talking. A promise is recorded by the game: if it concerns a vote, the council says whether it was kept or betrayed. As long as they do not know a name, the character sees “the man in red” in their prompt.

Code: actions_conv and prompt_conv in contexte.py, tour_conv in moteur.py.

7. The evening council

flowchart TD
  H["19:00"] --> Q{"At least 2 people at the Camp?"}
  Q -- no --> P["Council missed: everyone loses 30 energy"]
  Q -- yes --> V["Each person present votes aloud:
for someone present, against anyone"] V --> E["The elected one receives the ration: 2 fish, 2 berries, 1 water"] V --> S["The most designated must give an object to the elected one"] V --> PR["Vote promises checked: kept or betrayed"]

8. Where to act to change their behaviour

In the order in which I advise trying: first what they know and see, then what is possible, the numbers last.

What is observedProbable causeWhere to act
They repeat the same action that failsThe result of the action does not say why it failedThe p.nouvelles.append(...) sentences of resoudre in moteur.py: state the fact (“the bushes are bare”), not a piece of advice
They ignore a possibility (fishing, building, teaching)Its description in the list of actions is vague or discouragingThe texts of actions_possibles: give the chances and the costs in figures
They forget from one day to the nextThe main brain is badly filled, or they do not consultprompt_nuit (instruction for the main brain), cerveau_mots, consultation_decisions
They do not find each otherView of 2 tiles and nobody observes[grille] vue, vue_observer, coup_d_oeil_arrivee_min
Their talk is hollow, or they make things upNot enough true facts in view at the moment of speakingprompt_conv, the “what you do not know yet” block (bloc_inconnu)
Everyone starves to deathToo little food, or tools priced out of reach[monde.stocks_initiaux], [monde.renouvellement_nuit], [chances], [boutique.prix_base]
They walk about without doing anythingNothing tempting on the spot, or the plan is never revisedWhat they see on arriving (constater, regard); the agir_avant_de_repartir safeguard
They make no progress (no oven, no smokehouse, no hut)They do not see the next step, or it costs too muchThe “CE QUE TU PEUX ATTEINDRE” (what you can reach) block (arbre in moteur.py), the sections [cuisine.*], [construire.*], [conservation], the price of the books
The model answers malformed or slowlyPrompt too long, output too short[llm]: num_ctx, max_tokens, temperature; the --rapide option
To judge a change, look at a real prompt (next section): if a human who read only that text would not know what to do, neither will the model. The prompts and answers of the whole session are also recorded in runs/<partie>/llm/J1.jsonl.

9. Their prompt, live

The last text actually sent to the model for each character, and its answer. Updated every 5 seconds while a session is running.

This is the real prompt, shown in French exactly as the model received it.

No session in progress, or no call yet.