Movement direction probability
By Robin Dowling · 5 months ago
Early on in the simulation, I noticed that organisms moved in jagged, discontinuous patterns. Each tick, they would pick a new direction without any memory of where they had just come from. This created movement that looked mechanical and unnatural. Organisms would frequently reverse direction or move in sharp angles, creating zigzag paths across the world.
The solution was to introduce directional momentum. When an organism decides to move, it now considers its current direction and weights the probability of continuing in that direction higher than alternatives. The probability decreases exponentially as the angle from the current direction increases.
Moving in the same direction receives about 42% probability. Adjacent directions at 45° angles receive about 21% each. The opposite direction, a complete 180° reversal, gets only about 3% probability.
This creates a strong preference for continuing along a path rather than constantly changing course. The result is movement that feels more organic. Organisms trace smoother paths, curve gradually, and maintain momentum as they explore or pursue goals.
The system applies to all movement types, not just random exploration. When an organism moves toward food, away from threats, or back to familiar territory, it still considers its current direction in the decision. This prevents the ping-ponging behavior that occurred when organisms would move one step toward a goal, then immediately reverse course the next tick.
It's a simple mathematical weighting mechanism, but it transforms how movement looks and feels in the simulation.