|Name of gadget||Randomiser|
|Section||Logic & Processing|
|Number of Tweak pages||1|
|Last updated||1 Apr 2019 [Beta]|
This gadget is used to create randomness in your game. It has 10 channels and you can choose as many of these as you like. They are labelled A-J but their outputs are 0-9 (with A being 0 and J being 9). Random numbers can be used to add life to your scene (so that everything is not on a fixed time), or life in your NPCs and enemy AI. You can use random numbers like a dice throw and create elements of chance. You can string randomisers together with calculators to get bigger numbers.
Example Tutorial (from Media Molecule)
- Stamp a lot of individual sculptures or shapes into your scene (5 should be enough)
- Place a timer
- Set the timer to 2 seconds
- Place a randomiser.
- Connect the timer finished (pulse) to reset timer creating a loop
- Connect timer finished (pulse) to randomise on the randomiser
- Change the no of ports to 5 (or however many objects you put in your scene)
- Connect each output A-E to one of the shapes visible toggle
- Hit start time
- The shapes will randomly appear and disappear as they are chosen by the randomiser
- Input to Randomise
If you want to send a specific signal through a random output port, connect that signal to this input.
Wire a pulse into here to randomly switch between the output ports. At the same time the corresponding number of that port is output from the Active Port output. One output port is chosen for each pulse and the rules for how they can repeat is determined by the Randomise Mode setting.
- Number of Ports
Move this slider to select how many ports will be active. So for example, if you wanted a random number between 0 and 4 you would select 5 and it would activate ports A-E.
- Randomise Mode
The options are:
- No Repeat
It will pick one of the active ports randomly, but will be sure not to pick the same port twice in a row.
It will pick one of the active ports randomly and will not pick that again until all of the ports have been cycled through. This way you can get a random sequence of numbers that do not repeat.
- True Random
It will pick one of the active ports randomly, using a ‘true’ random number that might pick the same port several times in a row.
- No Repeat
- Output Ports
These are what the randomiser chooses when it is randomising. If the is an “Input to Randomise”, this signal is sent to the currently active port only. Otherwise, the output ports simply turn on when active and off when not, outputting signals of 1 and 0 respectively.
- Active Port
This output will give you a number that represents the port currently selected. This is a numeric value corresponding to the ports in turn, with A=0, B=1 and so on up to J=9.
This is where you can turn your gadget on/off.
To get a truly random number you need to “seed” this randomiser. You could use a button press to do this, as the time that a button is pressed is providing an extra randomising effect to the gadget. If you just set it off without this you may find the numbers are not “random” in that it produces the same set of numbers each time. You could have a randomiser churning out random numbers continuously and only call on that number when needed. Make the timer to be the smallest as possible (0.1 seconds) and then use a signal manipulator to freeze an output at the point you need it, this way you are guaranteed not to get the same results every time.
The randomiser starts at 0 and goes up to a maximum of 9. To get a choice of 1 to 10 you will need to put the output through a calculator which adds 1 to the number.
To get choices above 10 you will need multiple randomisers. I will be adding a tutorial for that when the game is launched.