Building your first model
The fastest way to learn is to make a small model yourself. Click + New model in the library. You get an empty world.
1. Add an agent type
Open the Code tab. Under Agent types click + Agent type. Rename it to creature in the inspector.
2. Give it a property
Under creature, click + Property. Call it energy and set default to 50. This expression runs once for each agent at setup. Any DSL expression works there.
3. Add a setup rule
Under Setup rules click + Rule. The new rule's body is empty. Put this in it:
create_agents('creature', 30)
Now click Setup. Thirty agents appear, scattered randomly.
4. Add a rule for each tick
Under creature → Rules click + Rule. Body:
turn(random(-20, 20))
move_forward(1)
energy = energy - 1
This is a classic random walk that uses up energy. Click Setup, then Go. Your creatures wander around.
5. Add a die-off rule
Under creature → Rules, add another rule:
when: energy <= 0
do: die()
That's the whole loop: agents wander, lose energy and in the end die. Next you could plot the population over time, add food patches, or let creatures reproduce. Take it where you like.