Define kinds of boids and their rules, then run the scene. The server starts one process for each boid of your definition.
| Key | Value |
|---|---|
box | [WIDTH, HEIGHT], each from 40 to 400 |
ground | grass, water, sand, floor, night or none |
wrap | true: each side continues at the opposite side |
rocks | A list of [X, Y, RADIUS]. The rule avoid moves a boid around them. |
kinds | The kinds of boids: 6 kinds at most. The server has a limit of the boids of a scene, and tells it. |
| Key | Value |
|---|---|
name | The group of its boids |
count | The number of its boids |
speed | [MINIMUM, MAXIMUM] |
perception | The distance that a boid sees (default 10) |
rules | A list of [NAME, WEIGHT] or [NAME, WEIGHT, OPTIONS] |
when | A list of {"sees": GROUP, "rules": RULES}: the rules of a boid while it sees a boid of that group |
follows | "chain": each boid has the relation follows to the boid before it. The target "leader" of a rule is that boid. |
combine | "priority": the first rules use the force first |
shape | An animal: bird, sheep, dog, wolf, fish, shark, deer, fox, bee, beetle, ant, duck, duckling, firefly, person or child; or leaf, spark, dart, dot, hex, rock |
color, size | ink, warm, cool, rock, wool, fur, gold, leaf or plum; a number |
| Rule | Options |
|---|---|
separation, alignment, cohesion | radius, groups ("all", "same" or a list of names) |
seek, flee, arrive | target; radius for flee |
pursue, evade | target, radius, max_time |
leader | target, distance |
wander | jitter, distance, radius |
cruise | speed |
avoid | lookahead, clearance |
dodge | radius, horizon |
contain | margin |
follow | path (a list of points), loop |
flow | field (a vector [X, Y]) |
A target is a point [X, Y], the name of a group (the nearest boid of that group), or "leader".
A definition is data, and not code. For a boid with code of your own, write a module with the behavior gen_boid: see the game.