creatures
array
Holds every active Creature object in the simulation; the whole ecosystem lives in this array.
let creatures = [];
food
array
Holds simple {x, y} objects representing food pellets that creatures can eat.
let food = [];
apiKey
string
Stores the decoded OpenAI API key used to authenticate fetch() requests.
let apiKey;
initialPopulation
number
How many creatures exist at the very start of the simulation.
const initialPopulation = 10;
maxCreatures
number
The population cap - once reached, creatures can no longer split into new offspring.
const maxCreatures = 200;
initialCreatureSize
number
The starting diameter of new creatures, and the basis for the size threshold needed to split.
const initialCreatureSize = 20;
initialCreatureSpeed
number
The starting movement speed of new creatures.
const initialCreatureSpeed = 1.5;
foodSpawnRate
number
How many frames pass between automatic food spawns.
const foodSpawnRate = 30;
maxFood
number
The maximum number of food pellets allowed on screen at once.
const maxFood = 150;
foodSize
number
The diameter used to draw and collision-check food pellets.
const foodSize = 5;
oracleMessage
string
The current prophecy text returned by the AI, shown in the UI.
let oracleMessage = "";
oracleAction
string
The current active action name ('plague', 'feast', 'mutate', or 'calm') that draw() applies each frame.
let oracleAction = "";
oracleIntensity
number
How strong the AI wants the current action to be, on a 1-10 scale, used to scale effects.
let oracleIntensity = 0;
lastOracleActionFrame
number
Records the frameCount when the current oracle action began, used to time out the effect after 5 seconds.
let lastOracleActionFrame = -Infinity;
oracleActionDuration
number
How many frames (5 seconds worth) an oracle action stays active before resetting.
const oracleActionDuration = 5 * 60;
isOracleThinking
boolean
A flag preventing multiple simultaneous OpenAI requests while one is already in flight.
let isOracleThinking = false;