For everyone — Reasoning like a detective in the rain
Picture a detective facing a wet road on a stormy morning. Nobody saw anything, but water on the asphalt and an umbrella left by the door are enough: with no certainty, he infers that rain is the probable cause, and he is right most of the time. This is exactly what mathematicians have been doing since the 18th century under the name of Bayesian inference: starting from incomplete clues and updating your suspicions with every new observation. It is what a doctor does in the consulting room, what a weather forecaster does when announcing "a 70% chance of showers" — long before seeing a single drop fall.
Why should you care? Because in the real world, nobody ever has all the information, and yet decisions must be made: take the bridge or the tunnel, plant the vegetable garden on the north side or the south, hunt today or wait. Probability turns that doubt into an honest decision tool, one that also says when it is wrong.
This is precisely what the Yokul project gives its virtual beings. An actor in our worlds sees a rabbit bolt away at top speed, notices an animal prowling near the lake: it doesn't "know" that a predator is lurking, but its Bayesian network strongly tilts its belief in that direction — and it will hunt where the game is most likely to be. Without a single line of code ever having shown it the way.
One last note: this is not a passing fashion: the project's Bayesian lineage goes back to 2011, with the first "memory & decision" modeling of the actors — the same thread as Workflow Engine, which arrived at the same time. The last paragraph of the full text tells where it leads.
The full text
An actor in a virtual world never knows everything. It hears a noise, catches a glimpse of a silhouette, smells smoke — and must still decide, right away, without complete information. The Bayesian network is the mathematical tool for this uncertainty: when perception is incomplete, decision-making becomes a matter of computing probabilities.
What is a Bayesian network?
A Bayesian network is a directed acyclic graph (DAG) whose nodes are random variables and whose edges are causal dependencies. Each node carries a conditional probability table (CPT): the probability of each of its values given the values of its parents. The modern formalization of the model is due to Judea Pearl (Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference, Morgan Kaufmann, 1988) — the same man who, thirty years later (The Book of Why, 2018), would remind us that the graph is only worth something because it carries explicit causal assumptions: exactly the discipline that actor modeling demands.
The value of the model comes down to one sentence: the graph factorizes the joint distribution.
P(X1, X2, ..., Xn) = Π P(Xi | parents(Xi))
You therefore never declare an astronomical table of joint probabilities: you only declare what each variable depends on directly. And the computation flows both ways. The edges carry causality, but inference also runs backward from effects to causes:
I see a rabbit bolt by at full speed. What is the probability that a predator is prowling nearby?
This is the reasoning an actor is asked to perform when facing a world it doesn't control: see the effect, infer the probable cause, act accordingly.
A concrete example: is this animal hungry?
Take a virtual animal, observed by a hunter. The available observation: the animal is — or is not — roaming near the watering hole. The known context: the state of the vegetation. The question: how hungry is it?
Food scarcity ──▶ Hunger ──▶ NearWater
│ ▲
└──────────────────────┘
(nourriture rare → rôde aussi autour du lac)
In Python, a minimal hand-coded network, with no library, to show the mechanics (figures verified by running the script):
from itertools import product
P_food = {"scarce": 0.4, "rich": 0.6} # a priori sur la végétation
P_hunger = { # P(faim | état de la végétation)
"scarce": {"high": 0.8, "low": 0.2},
"rich": {"high": 0.2, "low": 0.8},
}
P_near = { # P(rôde près du lac | faim, végétation)
("high", "scarce"): 0.85, # affamé et rien à manger sur place
("high", "rich"): 0.20, # affamé, mais il mange où il est
("low", "scarce"): 0.45, # peu de faim, mais il cherche
("low", "rich"): 0.10, # tout va bien, il reste chez lui
}
def infer(near_water: bool) -> float:
"""P(faim élevée | l'animal a été vu près du lac, ou non)."""
post = {"high": 0.0, "low": 0.0}
for food, hunger in product(P_food, ["high", "low"]):
p = (P_food[food]
* P_hunger[food][hunger]
* (P_near[(hunger, food)] if near_water
else 1 - P_near[(hunger, food)]))
post[hunger] += p
return post["high"] / (post["high"] + post["low"])
print(f"P(faim | vu près du lac) = {infer(True):.2f}") # 0.78
print(f"P(faim | absent du lac) = {infer(False):.2f}") # 0.23
Seeing the animal near the lake lifts the belief in "high hunger" from a prior of 44% to 78%; not seeing it drops it to 23%. The actor running this inference is reasoning: from a mundane observation, it updates its belief about a state of the world it cannot perceive directly. It hunts where the game is most likely to be — without a single line of code ever telling it where to hunt.
Bayesian network or neural network?
In 2026, the reflexive answer to "learn a decision" is the neural network. For actors embedded in a simulator, the choice is anything but obvious:
| Criterion | Bayesian network | Neural network |
|---|---|---|
| Data required | One model, written by an expert | Countless examples |
| Interpretability | Every edge is an axiom | Black box |
| Runtime cost | A few multiplications | Millions of operations |
| Hot modification | Edit a CPT, right away | Retrain, test, redeploy |
| Behaviors | Bounded, probabilistic guarantee | Slips that are hard to predict |
| Memory footprint | A few KB | From MBs to GBs |
To simulate a scavenger, prey or a merchant, a twenty-node network is often enough. Above all, the meaning of each edge is written by a human: you can explain the actor's behavior, correct it mid-simulation — and even swap out an actor's decision engine without rewriting its behavior descriptor. That is the promise of the Behavior Model.
Honest limitations
- Exact inference gets expensive: beyond about fifty densely connected nodes, the computation is intractable (the problem is #P-hard). You then move to approximate inference: Gibbs sampling, particle filters, belief propagation.
- Writing the CPTs is a craft. The numbers come from the expert, or else from statistical learning over simulation traces — and you then leave the comfort of a purely declarative model.
- The Markov assumption is a simplification. For actor memory, time must be organized: dynamic Bayesian networks (DBN) chain the same graph across successive instants, each copy inheriting the beliefs of the previous one.
To conclude
A few tables of numbers, a graph, and a theorem from the 18th century: they give our virtual beings what is most precious to them — doubt. Our worlds don't need omniscient actors, they need actors that are wrong intelligently and relearn the world by observing it. And one door stays open: Bayesian decision theory naturally ties together memory, perception and action — exactly the trio carried by the project's memory_decision schemas, where an actor's decision engine is fed by its memory and its context. A continuation under construction: an article in preparation will tackle head-on the distinction between the ontology of perception and that of reality — the actor believes, it does not know.
Key takeaways
- A Bayesian network factorizes the joint distribution: you only declare what each variable depends on directly, and inference flows from effects back to causes.
- A mundane observation updates a belief: seen near the lake, the animal's probable hunger rises from 44% to 78%; absent from the lake, it falls back to 23%.
- Against the neural network: a few KB, a CPT editable on the fly, behavior explainable line by line.
- The limitations are owned: beyond about fifty dense nodes you must move to approximate inference, and writing the CPTs remains a craft.
See also
Article written for the redesign of yokul.org, replacing the page left empty in the 2023 version.