Home    LittleBigPlanet 1 - PSP - Tearaway -Run Sackboy Run    LittleBigPlanet 1    [LBP1] Ideas and Projects [Archive]    Logic Pack    Advanced Pack

Tutorial 3.1 - Designing an Advanced Elevator

Archive: 3 posts

Tutorial 3.1 - Designing an Advanced Elevator
By comphermc (http://www.lbpcentral.com/forums/member.php?u=4697)

In this tutorial, we'll cover the process of designing an elevator with many more additional features and functions than the Basic elevator we went over in the Beginner tutorials. It will take much longer to complete, but it will also behave in a much more realistic manner. We will also design failsafes to ensure the elevator cannot be easily broken.


First, we will construct the little elevator car that the player will ride up in. Be sure to drop into the car to ensure it has the right dimensions. Bigger or smaller elevator cars are fine and will work just the same. Give the elevator a little floor made out of dissolve. This will later act as the the trigger that causes the car to go up and down.


Once we have the car, we will build the shaft of the elevator around it. By using the grid mode, we will ensure the elevator car will be flush with the sides of the elevator. You can make the shaft as tall as you would like. Here, we have made the bottom of the shaft out of Dark Matter so as to anchor the whole elevator.


Move the elevator car up slightly to prepare to attach a piston to itself and the Dark Matter below. The piston will be what moves the car up and down. Before we attach the piston, we need to slightly shrink down the car to ensure it never gets stuck. We suggest turning off grid mode, selecting the car, and scaling it down ever so slightly. Even if it doesn?t look like it did much, it ensures that the car will never get stuck.


Turn the small grid back on and attach a piston to the top of the floor of the elevator car and to the Dark Matter below. We have attached the piston in this way so that the car can be flush with the Dark Matter when it is all the way down. After you place the piston, be sure to go into a its tweak menu and set the piston to stiff. This part is important. The piston will only work if it is set to stiff. Also, while you?re in here, tweak the maximum/minimum length of the piston as well as the timing. Feel free to unpause the physics for this part, but be sure to return to pause before moving on. It is at this point you might want to add a floor for the player to get in and out of the elevator.


Now that we have a ?working? elevator, we need to set some inputs for the system. Attach a grab switch to the dissolve floor and a small magnetic key switch to the shaft of the elevator, so it is next to the car.


Add a magnetic key right next to the magnetic key switch. Repeat this for the top of the shaft as well.


We will want to tweak the trigger radius for these magnetic key switches to be as small as possible so that they still work (within reason). Shown here is the trigger radius for our magnetic key switches. Try to create something similar by tweaking the radius and angle.

The purpose of those last two magnetic key switches is to define the location of the elevator car. When the car is at the top, the top magnetic key will activate. Similarly the bottom magnetic key will activate when the car is at the bottom of the shaft. Now that we've got the basic design in, let's get started with the actual guts of it all.

This elevator design will address a common problem in LBP: the elevator going up (or down) without the player. The basic idea for this elevator is to control the direction of the piston controlling the elevator with a toggle switch. If you recall, a toggle switch takes a one-shot input and alternates between ON/OFF each time it is triggered. When the output for the toggle switch is set to directional, it will alternate between OUT and IN.

If we set up the toggle switch through an OR switch, then we can make the elevator change directions if the player grabs the grab switch on the elevator, or if the elevator and the player are on different floors. Consider this: the player grabs the floor, toggling the elevator to change direction, and then jumps off. The elevator will go up without them. Our logic network will recognize that the player and the elevator are on different floors and will trigger the toggle switch, bringing the elevator back down. Since there are two ways that the player and elevator can be on different floors (Sackboy is above and the elevator is below, or Sackboy is below and the elevator is above), we will need three different inputs to our OR gate.

At this point, we invite you to take a look at these logic network diagrams. The first picture is just the standard layout of how all the logic interacts. The following three pictures, then, represent the three ways that our toggle switch can be triggered.


This is the flowchart sort of layout for our logic network.


If we follow the diagram, keeping in mind that Green is TRUE and Red is FALSE, we can decipher what this diagram is telling us. Since the arrows coming from ?Sackboy Bottom? and ?Elevator Bottom? are green, we can conclude that the player and the elevator are both on the bottom floor. Also, since the arrow coming from ?Grab Switch? is green, it is TRUE, so we conclude that the player has grabbed the floor of the elevator. We also see that at least one of the arrows going into the OR switch is green (from the grab switch), so by how we define an OR switch, the OR?s output will be true. Hence, the toggle is activated.


Here we can see from the green arrows that the player is at the top and the elevator is at the bottom. Hence, the AND gate give a TRUE output, so the OR becomes TRUE, and finally the toggle is activated. This, then, causes the elevator to change to the floor in which the player is located.


This is very similar to the last scenario. Since the player is at the bottom and the elevator is at the top, the AND gate gives a TRUE output. Hence, the OR becomes true, and the toggle is activated. This causes the elevator to change to the floor in which the player is located.

Okay, so that?s all fine and dandy. If you understood how all that works, then wiring up all the logic for this network will be much clearer. In terms of LittleBigPlanet, anywhere you see an arrow, there will be a wire. Let?s now construct our network.


Firstly, we need to make sure that each of our ?boxes? exists in the level. We already have our grab switch, and the magnetic key pairings for determining which floor the elevator is on, but we don't have a way to determine where the player is located. This is not a problem ? we can use a sensor switch.


We can place a sensor switch at each floor, to sense the player?s location. Tweak the radius of this switch to be fairly large, but make sure it doesn?t reach the opposite floor. Also, set the output for this sensor switch to be directional. We now have all our network inputs, we just need to add our logic pieces.


From the diagram, we see that we need two AND gates, a 3-way OR gate, and a TOGGLE switch. To make things clearer, we will line them up in the order that they appear on the diagram. We have decided to use the emitter based TOGGLE from the advanced pack.


Remember, everywhere we see an arrow in our diagram, we need a wire. From this we can start wiring from left to right. The sensor switch on the top floor is wired to one of the pistons on the top AND gate. The magnetic key switch on the bottom of the elevator shaft is wired to the other piston from this same AND gate.


Similarly, the sensor switch on the bottom floor and the magnetic key switch from the top of the elevator shaft are each wired to one of the pistons on the bottom AND gate. Note: we have removed the previous wires for clarity sake. You should not have removed any wires.


Next, we see that the grab switch, and each of the AND gates is wired to the 3-way OR gate. Be sure to change each of these inputs to be directional and not on/off as they are set by default.


Also, the 3 way OR gate needs to have its output changed to One-Shot and be wired to the emitter based TOGGLE gate.


Finally, we wire the emitter based toggle to the piston holding up the elevator car. Assuming you have not messed with the settings for any of the other logic pieces, we are finished. We can now unpause. Your elevator should now be on the bottom floor and be stationary.

Feel free to drop into the level and test it out. When you grab the floor of the elevator, it should change floors. As a test of our new logic system, test out what happens if you grab the floor and then quickly jump out of the elevator. It should go without you, but when it gets to the other floor, it should toggle and come back. If this happens, then we are finished.

You can then go through and spice it up visually if you so desire.

Other Notes

Before you save the level and try to play it, delete any of the keys the emitter in the Toggle has emitted. The toggle will not work if there are any keys emitted in create mode!
If you are going to want this to be multiplayer friendly, you will probably want to set your sensor switches to be "require all"
If anything doesn't seem to work, ensure that you have not inadvertently inverted switches or set something to backwards.
Also, make sure that none of your logic pieces are interfering with other logic pieces.
You can reorganize your logic arrangement so it fits into the level more nicely. If you do, keep in mind the above suggestion.
If your elevator will not move, make sure you have not accidentally glued it to the shaft of the floor in front of it. You should be able to grab the elevator car and move it vertically within the grid. If it won't move, it is probably glued to something it shouldn't be.

Now that the guts are all organized and in place, let's start sprucing this baby up. We've split the remainder of this tutorial into optional Tweaks, which have been added as replies to this thread. We recommend doing all of the available tweaks for any single tutorial, but in the end, they're optional, so you decide.
2009-11-05 06:06:00

Unknown User

Tweak #1 ? Adding Doors

This first tweak will detail how to add doors to your two-floor toggle elevator design that we explored above. For simplicity, we will forego the portion of the above tutorial that resets the elevator?s direction in the event that the player and elevator are on different floors. We invite you to complete this tutorial and consider how you could add in such a reset to this design.

What, then, are we doing? We are going to create an elevator, that upon the player grabbing the floor, will have its doors shut and travel to the opposite floor, where its doors will open. It seems like a simple idea in concept, but the logic network required can be quite tricky.

Before we begin, we will first recall how a few new switches work:

Set-Reset ? The set-reset switch takes two separate inputs. One of the inputs turns it ON (or OUT) and the other input turns it OFF (or IN). When neither of the inputs is TRUE, its output remains unchanged. Because of the design of this switch, we want to avoid having both inputs being true at once. To understand why, we invite you to think about how the switch changes between ON and OFF.
Quick-Reset Timer ? The quick reset timer takes an input and will return an output of ON (or OUT) for a specified period of time once the input is no longer TRUE.

At this point, we can try to understand the logic network diagram shown below. Again, the first picture shows the base diagram. The subsequent pictures detail specific scenarios.


This is the flowchart sort of layout for our logic network. Notice that one of the outputs from the Quick-Reset Timer has a ?backwards? label on it before it gets to the AND gate. This indicated that the truth value (TRUE or FALSE) is flipped at this point. Physically, this means that the piston this wire is connected to in the AND gate must be set to backwards.


Here is the initial FALSE setting of our logic network. This is how everything would look before the player even gets to the elevator. Follow the reasoning to see why the green arrows eventually come across the LEFT setting in the Set-Reset logic piece. When the LEFT setting is true, it will mean the door of the elevator is open.


This is what our logic network diagram will look like when the player has grabbed the floor of the elevator (which we would expect to trigger the toggle). Again, follow the reasoning and the arrows to see how the Set-Reset causes the doors of the elevator to close. When the elevator doors have been closed, this will trigger the toggle.

Remember how we wanted to avoid two TRUE inputs to the Set-Reset? Notice that because of the ?backwards? label on the output from the Quick-Reset Timer it is possible for only one of the inputs for the Set-Reset to be true at once. We hope you can see this. Try to compare this image to the above image if you are having trouble.


Finally, this is what our logic looks like when the elevator is in transit between floors. Notice that the Set-Reset switch does not have any inputs, which is fine (The diagram is not entirely accurate, in that the door remains shut, but the way we have shown is sufficient because it doesn't keep triggering the toggle - which is a one-shot). We can see that once it hits the top floor, the OR gate will become TRUE, making the AND true, resetting the Set-Reset, thereby opening the doors. To see this, just trace a green arrow coming from "Elevator Top" and work it out.


Now that we [hopefully] understand the diagram, we can move on to constructing the network in-game. It is best to just copy over the whole elevator we used in the first section and modifying it to contain doors. Do this if you haven't already. We no longer need the sensor switches used above, so we can delete them. The next thing we need to do is to make some doors.


The easiest way to make doors is to create them with the small grid and then re-size them with the grid turned off. Once you have your doors the correct size, turn the small grid back on.


Move your doors sideways a bit so that they are completely outside the width of the elevator car. Get out and attach a piston from each door to the opposite side of the inside of the elevator car. Make sure you make these pistons stiff. It is up to you to tweak the timing and lengths of these pistons. You can unpause to test these out, but be sure to return to pause mode when you are done. As a reference, the timing of ours is set to 2 seconds.


Next, we are going to need some way for our logic to tell if the elevator doors are closed. To do this, we will create a matching set of a magnetic key and a magnetic key switch to the top of the door (choose a different color than the other set near it). Tweak the trigger area of the switch to be as small as possible so that it still works, and set it to directional.


This is the fun part. Now we need to add all the logic pieces necessary for our network. Looking at the above diagram, we can see that we need an OR gate, two AND gates, a Quick-Reset Timer, a Set-Reset switch, and a dissolve based Toggle. It might help to lay them out in a manner to match the diagram. Notice that the elevator doors are not in the exact same location as on the diagram. This is because the doors are stuck to the elevator!


Proceeding like the in the base tutorial, we can being wiring up our switches. Start by wiring up the magnetic key switches used to detect the floor the elevator car is on to the OR gate.


Then connect the this OR gate to each of AND gates (as per the diagram).


Connect the grab switch to the above AND gate [not pictured]. Also, connect this AND gate to the Quick-Reset Timer. The AND gate needs to be connected to both the winch and the pistons, due to the nature of the Quick-Reset Timer.


Connect the output from the Quick-Reset Timer (which should be set to directional, non-inverted) to the right side of the Set-Reset switch and to the remaining piston in the bottom AND gate. Important: Set the piston in the AND gate that you just wired up to backwards. This is key to the network working correctly.


Wire the output from the bottom AND gate to the left side of the Set-Reset switch.


Wire the Set-Reset switch to the two pistons controlling the elevator doors.


Set the magnetic key switch on the elevator door to One-Shot and wire it to the emitter in the Toggle.


Wire the output from the magnetic key switch on the Toggle to the piston that controls the elevator car.


We now have everything wired up correctly, and it should work. Save and test it out. You should find that everything works fine unless the player jumps out of the elevator right after they grab the floor. The elevator will not reset because we removed that portion of the logic. We invite you to try to combine the first base tutorial with this tweak to remedy this.

Feel free to go in and spiffy it up. The next tutorial will go over how to ensure the elevator will never leave without the player. If you feel like you understand this tutorial, stick around for the complete package.

Other Notes:

Before you save the level and try to play it, delete any of the keys the emitter in the Toggle has emitted. The toggle will not work if there are any keys emitted in create mode!
If something doesn't work, make sure you haven't inadvertently inverted one of the switches or set something to backwards that you shouldn't have.
Also, make sure that none of your logic pieces are interfering with other logic pieces.
You can reorganize your logic arrangement so it fits into the level more nicely. If you do, keep in mind the above suggestion.
Obviously, there are failure issues if someone jumps out of the elevator when they shouldn't, but this is a nice progression to the next tutorial.
2009-11-05 06:12:00

Unknown User

Tweak #2 ? Failure-Proofing

Alright, so the last design was pretty neat in that the doors shut before going up, but it had the problem that it would leave without the player if they jumped out of the elevator at the wrong time. We are going to amend that here by adding a few steps in the logic. Rather than the elevator doors closing trigger the toggle , our new logic will require that the elevator doors be closed and the player still be in the elevator. Unfortunately, for anyone who doesn't have the Metal Gear Solid DLC, this will require the searchlight. The basic idea for the design doesn't change all that much, but we will begin by examining the logic network diagram:


Notice that we have added a few network inputs and an OR gate in the bottom left, but the majority of the network remains unchanged. We can also see that the Quick-Reset Timer feeds into this newly added OR gate. You can either trust us that this is necessary or you can read about the reasoning for this in the spoiler here.

Consider what would happen when the elevator reaches the top of the shaft. The doors would already be closed, so as soon as you triggered the "Sackboy in Back Layer Above", the Toggle would fire, meaning the elevator would change directions. In this way, you'd never actually stop at a floor and would just keep going up and down. By adding an input from the Quick-Reset Timer, we ensure that the new OR gate, which feeds into the Toggle wouldn't activate until the grab switch was triggered again at the top floor (to go back down). Do you trust our reasoning now?


This image shows what the default logic would be before the player would even come across the elevator. This is not much different from the default FALSE diagram above in Design 2.


Here is what the TRUE situation would look like. Notice what the effect of adding these additional logic pieces to our network does. The Toggle will only trigger if the player is still in the elevator. If he or she grabs the grab switch and then jumps out, the doors will shut for as long as the Quick-Reset Timer remains activated (for a few seconds after the grab is released). However, since the player was not in the elevator during this time, the elevator will not go up, and the doors will open when the Quick-Reset Switch deactivates. In this way, it is completely failure proof (Ah, [B]finally!).



Rather than rebuild everything from scratch, we can copy the elevator and logic from Design 2 and make the necessary modifications. Box select everything and copy it over to a new location if you haven't already (using the small grid to keep everything aligned in the grid).


We don't need to remove any of the logic pieces, but we do need to unwire something. The magnetic key switch on the elevator door no longer is wired directly into the Toggle switch. Pause. Select the wire where it connects to the emitter and delete it. While you're at it, change the output type of this magnetic key switch to directional (the one on the elevator doors).


Looking at the above diagram, we can see that we don't yet have network inputs to detect if Sackboy is in the back layer at the top or the bottom. We will achieve these detections using the Metal Gear Solid searchlight object. If you're unfamiliar with this object, it can be found with all of the other light objects in your materials popit. One annoying thing about the searchlight is that the light it emits is not tweakable. We can significantly reduce this lighting effect by shrinking it down. For now, just place it to the side of the elevator, both above and below. Set each of them to directional.


Now that we have all of our network inputs, we need to make sure that we have all the logic pieces necessary to complete the network. By looking at our diagram, we can see that we need a 2-way OR gate and a 3-way AND gate. Let's add these now.


Wire each of the spotlights to one of the pistons on the new OR gate. Double check to make sure you made the spotlight outputs directional, rather than the default ON/OFF. Also, wire the output from the OR gate to one of the pistons in the 3-way AND gate.


We now need to wire up our remaining two inputs for the AND gate. Remember from our diagram that these inputs are the mag key switch from the elevator doors (which is now directional) and the Quick Reset Timer. Wire these up now.


Now, we need to wire the new AND gate to the emitter based Toggle. In order to do this we need to first change the output for the AND gate to be One-Shot. Place the wire on the emitter now.


Surprisingly, we are finished with the wiring. We just need to back and shrink down our spotlights and glue them to wall next to the elevator. By pushing the light against the wall, it will ensure it will only glue to the wall and not to the door. Tweak the trigger radius for the spotlight to encompass the entire elevator car.


We are now finished with all of our elevator designs. Again, feel free to go in and polish things up. Here, we have reorganized our logic so it fits together nicely and placed all three elevators next to each other. The hard part of this last design was figuring out that the Quick-Reset Timer needed to be wired directly to the 3-way AND gate. You can now save and test the level. Try jumping out of the elevator right after you grab the floor, and watch what happens. The doors will stay shut for a second, and then open, but the elevator will never leave without you. Hence, it is failure proof. This sort of thing wouldn't seem too impressive if you came across it in some random level, but it really makes you appreciate these type of things a bit more, doesn't it?

Other Notes:

Before you save the level and try to play it, delete any of the keys the emitter in the Toggle has emitted. The toggle will not work if there are any keys emitted in create mode!
If you would like to make your level multiplayer friendly, we would suggest setting the searchlights to require all.
We can set the timing of the piston on the 3-way AND gate that receives an input from the elevator doors to be .5 seconds to cause a slight delay from when the doors shut to the elevator going up. It's something small that adds a bit of polish.
If something doesn't work, make sure you haven't inadvertently inverted one of the switches, set it to the wrong output type, or set something to backwards that you shouldn't have.
Also, make sure that none of your logic pieces are interfering with other logic pieces.
You can reorganize your logic arrangement so it fits into the level more nicely. If you do, keep in mind the above suggestion.
2009-11-05 06:13:00

Unknown User

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

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.