Small Brain. Big Trades.
README.md
FruitFlyBrain
A whole connectome running as a spiking network on this entity. It loads the
connectome asset the field names (the package's maleCNS by default),
steps it every frame the gameplay clock runs and, with runInEdit, in edit
mode too; draws every neuron with a soma as a lit point around the entity;
and hands the live network to anything that asks.
Fields: connectome, running, runInEdit, timeScale,
maxStepsPerFrame, gain, minSynapses, showCloud, cloudScale,
neuronRadius.
Methods on the ref: getBrain(), stimulate(sel, hz), silence(sel, on),
clearStimulation(), reset(), watch(name, sel), unwatch(name),
rates(), describe(). stimulate, silence, clearStimulation and
reset are synced calls, so every peer's copy of the network receives the
same inputs. onLoaded fires with the neuron and edge counts once the
network is on the GPU.
local e = entity.spawn("Brain")
e.position = { 0, 5, -8 }
e.component.add("FruitFlyBrain", { gain = 0.6 })
local c = e.component.get("FruitFlyBrain")
c:watch("MN9", { types = { "MN9" } })
c:stimulate({ types = { "claw_tpGRN" } }, 100)