Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Tutorials
#1

How To Understand And Create Your Own Logic [PART 1]

Archive: 14 posts


Hey guys,

Today I'm going to show you how to understand complex pieces of logic and how to create your own logic. I'm doing this tutorial for the less logical among us who also want to be able to make their own logic without the hassle of asking everyone before thinking of a solution on their own. You see, brightness hasn't got everything to do with being able to understand logic. In what extent you're able to think logically, however, has. Some people (I'll refer to them as the logicians) are slightly more capable of thinking as a machine: Input A and B make output C, while the logically impaired (I'll refer to them as the visualizers) tend to visualize the situation: R2 plus Right Stick equals moving your arms and in their minds, they see the arm moving.

Why are visualizers less able to solve logical problems? Well, that's because it's much harder to visualize such problems. They are able to imagine simple additions and even multiplications, but when it comes to reducing complex functions, it becomes nearly impossible to visualize it. This is where a complete shift of thinking is required. You need to stop thinking in images and start thinking as a machine. This is where the tutorial kicks in as I'm going to tell you exactly how to do this.

Step 1: Visualizing The Situation
This may seem contradictory to what I just told you, but this is the start of understanding logic. You can think of it as learning a foreign language. You don't just barge into endless lines of text and get lost. You need to take the time to apprehend it. Start off with single words, while keeping the translation beside them at all times. Okay, before we can begin creating logic, we need to have a good view of the problem. For instance, a double jump. Visualize it for a moment. The double jump involves two jumps. One starting from the ground and one in the air. Touching surface and not touching surface, so the double jump will certainly require Impact Sensors. While in the air, you are not touching the ground and you should be able to perform one more jump. Only once, so you shouldn't be able to jump after it. It all sounds pretty easy this way, but it should give you a nice view of the logic pieces necessary for your creation. Take the time to write things down as this will help you being able to link pieces of logic together in your mind.

Step 2: Collecting Logic
Now, it's time to narrow down the required logic. Now you should try to take every single logical step into account. The golden rule when doing this is quite simple: Things never happen on their own. Every output needs an input. Think about this and you'll notice that it makes perfect sense (everything does, that's why it's called logic). We always start with stating the obvious. Just because it's obvious, doesn't mean that it shoudln't be taken into account when designing logic. This is also very important to keep in mind.
In case of the double jump, we will certainly need a Sackbot, as it's impossible for Sackboy to jump two times. This means you will need a controlinator to control the Sackbot. How to do this exactly can be found in another tutorial and I'm not covering this to its full extent. With the controlinator, you can press X by default to jump once. However, it is not possible to tweak it so you can jump twice. You can't use logic to make the Sackbot jump twice either. What does this mean? Well, it means that we'll have to create our own jump first before adding logic to it. Okay, jumping, jumping... It basically means MOVING upwards. Let's use a Mover for this!

http://i54.tinypic.com/ml5gkw.jpg
We gotta Move

However, the Sackbot will immediately start moving as soon as you put the Mover on the circuit board. To fix this, we'll need to connect the X (jump) button from the controlinator to the Mover. Okay, we've done that, but our custom jump doesn't quite look like an actual jump yet. Rather, levitating into the air higher and higher the longer you press the X button.

http://i54.tinypic.com/aow85d.jpg
Is it a bird? Is it a plane?

Another issue is the lost ability to move left and right in the air This is because the Mover only allows upward movement and doesn't reset after you've reached a certain height. So we need to fix two problems: losing the ability to move left and right when jumping and being able to gain height when pressing X continuously. Logic is all about solving problems, so these are the problems we'll be focusing on first.

Step 3: Solving Problems
Yes, there is still a long way ahead of us, but this is all about gaining the insight needed when you are facing these problems. Knowing what to do with certain situations and figuring out how to solve such complex problems. Gaining height comes with pressing X continuously, right? Well, maybe the solution involves impairing the player to press X all the time. So the player presses X, then something happens preventing the player to press X, and the Mover should somehow turn off, causing the player to plummet back to the floor. Okay, let's explore this interesting concept a bit. After the player presses X, something is activated which stays on all the time, preventing the player to press X again. This is the purpose of the Permanent Switch, which is basically a Counter set to count to 1. After it reached 1 it'll remain active at all times, until it is reset in some manner.
Another problem comes with falling off. There is no limitation as to when X can be pressed, so it could also be pressed in mid-air after falling off a ledge or something.

http://i51.tinypic.com/ib9dn8.jpg
See what I mean?

So, jumping should only be allowed when touching the floor. In other words, an Impact Sensor is needed. Keep in mind that touching something almost always requires an Impact Sensor. Okay, we've now collected two conditions for jumping: X can only be pressed once AND only when a player is touching the floor. Yep, you've guessed it. This is where the AND gate comes in.
Okay, so now, we've got a Mover, a Permanent Switch, an Impact Sensor and an AND gate. Connect them all together and we're golden, right? Nope, not quite, as now, when you press X, you'll soar into the sky like Superman after having energy drink.

http://i55.tinypic.com/125q6hx.jpg
No, it's Superman!

We need to get down somehow. In other words, we need to be able to reset the Mover. Unfortunately, Movers don't have reset buttons, so we need to have something to work around with. When faced with such a problem it's often useful to make an inventory of every logic piece that has a reset button. Then it's crucial to find one that doesn't interfere with the signal. The Permanent Switch is the most useful for this one, as it doesn't interfere and has a reset button. We connect the AND gate to the permanent switch and the Permanent Switch to the Mover. Now, it's time to look at the actual problem again: finding a way to reset the Mover (so basically making you stop going higher). At a certain time after jumping, you should fall down again. The longer the Mover is active, the higher you get, so the time is connected to the jump height. In other words, a Timer would do the job just fine. So, we jump and after about 0.3 seconds we start going down. We set the timer to 0.3 and connect it to the reset button of the Permanent Switch.

http://i55.tinypic.com/10x7l2w.jpg
Now with Timer

However, right now the Timer will start as soon as you enter the controlinator. Connect the Permanent Switch to the Start/Stop gate of the Timer. Now, the Timer will only start after you've pressed X to jump. You'll now find that the Timer only runs full once and then stays full. So, we'll need to find a way to reset the Timer as well. Another Permanent Switch after the Timer wouldn't make any sense, because you'd need to reset that too and the thing that reset it etc, etc.

http://i53.tinypic.com/29og0m9.jpg
Let's find a way to reset this

Now we'll have to think of an appropriate moment to reset the Timer. We could reset it after hitting the ground. Set up another Impact Sensor and connect it to the reset port of both the Timer and the first Permanent Switch. Now, we can jump around and fall down wih our own custom jump.

http://i52.tinypic.com/15xa3wh.jpg
Well, at least we're jumping now

However, no matter how long you press the X button, you'll always fly to a certain height. To fix this, we'll need to implement a way to make that either the Timer filling up OR the time you press X will send you back to the ground. Set up an OR gate and connect the Timer to its input. The output should be connected to the Permanent Switch. For now, connect the X button to the other input and see what happens. If you hold X longer than 0.3 seconds, the Sackbot will endlessly soar through the air again.

http://i51.tinypic.com/23wr40o.jpg
Not this again!

That's because only the Mover and the Timer will be rest by either the timer running off or by holding X. After the timer run off, the OR gate became active, but because Sackbot wasn't touching the ground, the signal from the first Permanenet Switch couldn't be reset. To fix this, we'll need to reset everything after pressing X. In other words, the reset signal should come when NOT pressing X. Yep, you've guessed it. This is where the NOT gate comes along. Connect the NOT gate to the X button and the other side of the NOT gate to the OR gate. Try jumping around now. The longer you'll hold X, the higher you'll jump.

http://i53.tinypic.com/10zsjnb.jpg
Finally, we got ourselves a working custom jump

That's it for PART 1 of my tutorial. I've only covered the single custom jump in great detail in this one and I'm asking you to first understand what you're actually doing. Try to translate what you want to do in easy steps and above all try to fiddle with logic as much as possible without help. First try to figure it out yourself and then ask for aid, not the other way around. It'll help you understand logic so much better. Logic is something anyone can learn. Some just learn it at a slower rate than others, but that's okay. Practice makes perfect and for logic that's no different.
2011-07-18 15:34:00

Author:
DoodVogeltje
Posts: 81


This tourial would be good for beginners, good job. Check mine sackbot toturial out, if you want.

https://lbpcentral.lbp-hub.com/index.php?t=60079-How-to-make-a-sackbot-roll
2011-07-18 15:41:00

Author:
zzmorg82
Posts: 948


This is fantastic, not for the content. But for the concept.

By that I mean I understand that you are not teaching how to make a custom jump but the thought process behind creating something using jump as an example.

I do think that it may be worth while to drop in some pics of the trial and error, because remember, your talking to visualisers!

This method is how I created all of my logic. It's gets a bit messy over time but revisions and optimisation are part of the development. When looking at complex logic I used to always ask myself HOW did they come up with that?

I now have people asking me the same thing. But they only see the end product neatly packaged, not the thought process that you have mapped out. Which to me, can be more interesting than the final circuit. Especially as a learning tool.
2011-07-19 00:34:00

Author:
Mr_Fusion
Posts: 1799


I do think that it may be worth while to drop in some pics of the trial and error, because remember, your talking to visualisers!
As a matter of fact, I'm uploading them now from my PS3 to my pc.
2011-07-19 00:59:00

Author:
DoodVogeltje
Posts: 81


Read my Sig And yeah, I used to SUCK at logic, but when I started (read sig) I could understand what I was doing. Sadly my artsy side of my brain is useless, I suck at scenery...2011-07-19 04:04:00

Author:
Unknown User


i have something similar like this written in my LBP2 notebook! except its about 2 sentences per paragraph... i like to draw out my logic stuff before i make it in LBP2 (only when im away or off of the game) that way my brain is always working! 2011-07-19 06:12:00

Author:
LBP2_Tutorialist
Posts: 225


This has inspired me to go back to my original designs (as I copy objects and keep them with mk tags) and document the evolution of the logic as trial and error leads to optimisation. Some objects have 'mk XIV' after them now...2011-07-19 06:31:00

Author:
Mr_Fusion
Posts: 1799


Okay, I've added some pictures now to make it even clearer. Expect PART 2 to be up soon. 2011-07-20 00:44:00

Author:
DoodVogeltje
Posts: 81


I've just made a jumping thing and i wrestled with how to keep someone from going up and up and up. I ended up using X to trigger a sequencer with god knows what on it and it works, but it never even occurred to me to use an impact switch, so thanks, much more elegant and blindingly obvious if only i wasn't so visual.2011-07-20 01:03:00

Author:
julesyjules
Posts: 1156


The great thing about logic is that it can almost always be approached from more than one angle, the same logic can be created in more than one way, nice of you to show a tutorial about how "logic" can be thought through trial and error, I go through that all the time in my logic quests 2011-07-20 02:34:00

Author:
damaz10
Posts: 771


Okay, I've added some pictures now to make it even clearer. Expect PART 2 to be up soon.

Testing and bug tracing are topics I'd like to see covered. Even though it might lead to me being bored in the Help forums.
2011-07-20 07:17:00

Author:
Antikris
Posts: 1340


This looks useful. I'm not much of a logic person so maybe this can help me make more complex experiments. I can understand the basic concept of the gates, selectors, timers, etc, but applying them in situations that require more complex conditions is hard for me. I bookmarked this page, I'll read it when I have more time. And a big mug filled with strong, smoking hot coffee 2011-07-20 11:04:00

Author:
SnipySev
Posts: 2452


Testing and bug tracing are topics I'd like to see covered. Even though it might lead to me being bored in the Help forums.
You're in luck. I'll cover that in PART 2 of this tutorial.
2011-07-20 13:06:00

Author:
DoodVogeltje
Posts: 81


Nice job! Tha's very useful.2011-07-23 14:16:00

Author:
TheGoldenFlash
Posts: 209


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.