If you haven't heard of the game LittleBIGPlanet for the PS3, then you're missing out on an AMAZING game!
The game is all about Play, Create, and Share.
You Play the normal story line or community levels.
You Create levels for others to play and enjoy.
You Share your creations online for others to Play and get inspiration from for their own levels to Create.
Your character is known as Sackboy, and you can customize him with different clothing options and hair styles in the game, or truly customize your sackboy with stickers and decorations to make something that is far from the normal sackboy.
I "fell in love" with this game the moment I saw how expansive the level editor is for the game!
It is truely limitless when it comes to what you can do, the only limit is your imagination.
Which brings me to what this post is all about...
In the game, you can use all different Tools in your levels to make them dynamic levels rather than static.
Buttons, 2-Way Switch, 3-Way Switch, Sticker Switch, Sensor Switch, Magnetic Key/Switch are the basic tools you use.
You can use things like pistons and stuff also to make things like lifting doors when you flip a switch and etc.
But what if you want to do something like... pull a lever, open a door, and when you switch it back you don't want the door to go down?
Or maybe you want to make more complex designs to make your level more fun and challenging to play!
Well, this is where logic in the game come to play!
You may be saying...
Ahh, well you can actually use binary in the game!How can you add logic into a game with a basic level editor like that?
Creations such as full working calculators have been made using the game's powerful level editor!
I've even made a binary timer myself!
So, I'm going to go over two different logic gates that you can create in the game.
The AND gate and OR gate.
There are many more such as XOR and more, but for now I will just go over these two.
AND:
So what is an and gate?
Well I'm sure many of you know this (being most of you are programmers)
The and gate is basically when two or more things are true then you get a result.
For this example, I will be using a two way and switch taking input from two switches.
Above is what it looks like all wired up. (The top logic is floating because it uses dark matter to keep stuff in mid air)
The two switches are hooked up with Direction setting to two different pistons.
When the switch is TRUE then the direction setting makes the piston go from it's min value to it's MAX value (depending on if backwards is on or not)
So, right now both switches are to the left which means they are off, 0, or false, which ever way you want to look at it.
Now let's see what happens when I turn on one switch...
Now you see that the right switch is true and one of the pistons is extended.
This one has the Magnetic Key attached to it.
The thing on the right is the Magnetic Key Switch.
Whenever the key is in the radius of the switch (defined by the user) then the switch is true indicated by a light on the switch itself (if certain settings like on/off)
You'll notice that moving just this one piston over isn't close enough to activate the switch.
Let's try moving the other switch instead...
You'll notice that the other switch is true and the other piston is moved forward... but this moves the key to the same position it was before.
In order to get the key to reach the switch BOTH switches must be true, hence why it's the AND gate.
So what happens if both switches are set to true...
Ahh, here we go!
Both pistons extended moves the key over far enough to the right and is picked up by the magnetic key switch, turning the light on!
You can make an and switch with as many inputs as you want, you just make more piston sets and a bigger and switch.
There are many ways to construct an and switch, this is just one out of many.
OR:
So an or gate is like an and switch, where it takes more than one input.
But this one doesn't require BOTH inputs to be true, but rather it can take just one from either input.
This is useful in LittleBIGPlanet because you can only attach one wire to an object, so when you want to access something from more than one input, you need to use an or switch!
Here is an example of an or switch that takes two inputs...
So this switch is different looking than the previous, but it's just one of many ways to make one...
There are two buttons (the inputs) which are wired to two pistons that are attached to a block with a key on it.
Both pistons have backwards enabled so that they are at their MAX value and away from the radius of the key switch that they both meet to in the middle.
So let's see what happens when we press a button...
So we see here that the button moves the piston in to it's min value and gets in range of the switch causing it to activate the light!
The other piston remains fully extended away, while the one we pressed moves in and activates the switch.
So this is an or switch, what happens when I press the other button...
Ahh, so again we see the light turn on, but this time the other piston is moved in and activates the same switch!
This way we can have two or more inputs controling a single object such as a light.
Conclusion:
There are other switches like the XOR gate which allows one input or another, but not both!
You can also make trigger gates which will only work when something is true, like turning a 2-way switch on then pressing a button to turn on a light. The button wont work unless the switch is on.
Things like that...
So, I hope you liked my logic lesson kind of thing for LittleBIGPlanet.
I'm sure many of you must be interested in this game.
It's really amazing to see what you can do in this game because we can use 1's and 0's to program in it like it's own little programing language if you will.
I'll post some more gates later on if you guys want.
And I'd love to hear some feedback on what you think of the game and these logic gates, and if you have a senario you want me to make in the game using logic gates like this.
Thanks for reading,
LeonBlade