Channels and slots

Beginners guide to using channels and slots

 

What are Channels and Slots?

Channels and slots allow you to organise your brain. You can name them or number them.

Think of channels as a cupboard and slots as a shelf.

Your channel is a cupboard with many shelves, each shelf can take one brain.

You can have multiple channels and multiple slots per channel.

Example of use
Lets say you wanted to be able to stop the player from using their movement and combat controls. Your option is to turn off the player brain or part of the brain. Here is where channels and slots can be useful.

You have a channel called “controls”.

You add brains to it in their own slots.

You create 1 brain (in a templated logic cube) for each control instruction.

example: WHEN [X][pressed DO [attack]

WHEN [once]
…WHEN DO [add brain][IWP: move][to channel][controls][to slot][1]
…WHEN DO [add brain][IWP: attack][to channel][controls][to slot][2]
…WHEN DO [add brain][IWP: shoot][to channel][controls][to slot][3]

Now instead of deactivating the whole of the players brain, we can now deactivate just the controls (every brain in the cupboard).

WHEN DO [deactivate brain][channel][controls]

or just deactivate the shoot (for example) (one brain on one shelf).

WHEN DO [deactivate brain][channel][controls][slot][3]

Important things to know

If you add or push a brain without specifying a channel it will alter the default channel in the brain. If you add  a brain to a channel without specifying a slot it will allocate a slot to the brain but it will not be referable. If you push a brain to a channel without specifying a slot it will remove all the brains in that channel and insert itself. If you push a brain into a channel with a slot reference it will remove just the brain in that slot.

Best practice to always specify a slot if you are specifying a channel.

All the brains in all active channels and all active slots will run simultaneously, so it is important not to have conflicting or multiple copies of instructions in your active brains.

Pop brain will replace the brain if it has been changed using push brain. Specify a slot.

WHEN DO [pop brain][channel][controls][slot][1]

Be aware that the more you use multi-brain facilities, the more careful you have to be about not duplicating or creating conflicting commands. Trying to debug a system with lots of brains can be more difficult.

Other Uses

How you organise your channels is up to you. In the above example we had the option to turn off all the different controls individually as well as all the controls. If in your game you only wanted to turn off all the controls together, you could put all the controls into one brain and just deactivate the slot. Organising your brains for flexibility will take some planning. I recommend you work it all out on paper first.

Levelling systems can also be built using channels and slots. You can add abilities, turn off abilities or replace abilities that are grouped together.

Advertisement

Comments are closed.

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: