PDA

View Full Version : Tutorial 3.2 - Creating a Chase Scene



Logic Pack
11-05-2009, 05:55 AM
3.2 - Creating a Chase Scene
By comphermc (http://www.lbpcentral.com/forums/member.php?u=4697)

This tutorial will go over the creation of a logically sound, automated chase scene. It will draw on many of the techniques discussed in the earlier tutorials. In this sense, it might be a good idea to familiarize yourself with those tutorials before jumping into this one. It will also be an opportunity to look at how logic can be specialized to suit your level's needs (remember, you aren't limited to the base logic gate constructions from the logic vaults). Because of the nature of this level, we are going to provide a template with which to work. The only difference between this level and the sample level that is not copyable is that all of the logic and most of the decorations have been stripped. We have left certain elements of the level that would normally need to be tweaked through testing, to save you the hassle. Also, a few little details (like the flaming tire) have been omitted. To begin, we suggest playing the sample level titled Tutorial 3.2 - Creating a Chase Scene. This level is a polished, playable version of this tutorial, and its purpose is to show you what the final product is supposed to look like and give you some direction. If you haven't yet played the level, this tutorial will not make much sense. Go play it!

The tutorial itself will be divided into 4 sections. The level will not work unless all 4 sections are completed, but organizing it in this way allows you to take breaks every so often and return to finish it later. You can easily jump to one of these sections by typing the section title into the "find" option in your browser (usually ctrl-F or command-F). These 4 sections are:

Creating the Explosion
Making the Car Go
Chase 1
Chase 2


Creating the Explosion

The first bit of the chase scene is to cause an explosion. This seems pretty simple, but to make it convincing we will need to do more than wire up some explosives.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%281%29.jpg

When you enter the level, you should find yourself in a blank little building. There are explosives hidden out of sight, within the walls. To make this easier on you, we have left them wired to this green magnetic key switch and the explosion speakers. It would be wise to not delete this switch, or else you may have to dismantle the building to get at the explosive.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%282%29.jpg

Just outside of this building, you will see the car/truck/jeep thing that the player will ride in for the trip. This car will have a grab switch on the steering wheel which is wired to each of the wheels (so the car doesn't move). For the purposes of the explosion, go ahead and keep these wired up. We will modify this when we talk about making the car move.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%283%29.jpg

Feel free to decorate your car in any way you see fit. Here we have added some stickers and decorations to make it look nicer. This part is really up to you.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%284%29.jpg

Now we get to add some logic. For this we are go to need a few Permanent Switches, a delay switch, and a modified version of The Switcher. If you look closely, it is the same design as the switcher we give away in the Beginner Pack Vault, but it has two separate chunks of Dark Matter. Even though it looks different, it behaves in the same way, and we have added a few Global Lighting Tools into the mix. Another difference between this Switcher and the Beginner Switcher is that the piston is set to Flipper Out. In this way, its input is now of the One-Shot variety. The outputs are both of the ON/OFF variety.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%285%29.jpg

Set the left Permanent Switch to directional and wire it to the Delay Switch, which should have a timing of say, .5 seconds. Set the Delay switch's output to be One-Shot and wire it to the modified Switcher. Here, we can also set the timing of the Switcher to be .2 seconds.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%286%29.jpg

Remember that magnetic key switch that was wired to all the explosives in the building? We are going to swap the top magnetic key switch in the Switcher with that one. Just delete the old one, and replace it. You should see a whole bevy of wire coming off of this magnetic key switch (not pictured are the wires to the speakers). These speakers are slight variants on the explosive sound, so that when they are played at the same time we get a louder explosion.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%287%29.jpg

Wire each of the ON/OFF magnetic key switches in the Switcher to its corresponding Global Lighting Tool (GLT). Tweak the GLT on the bottom to be your desired level settings. Set the timing to be .5 seconds.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%288%29.jpg

Tweak the top GLT to be yellow as shown [poorly] in this picture. You'll have to mess with the Fog Color and Color Correction settings to achieve the desired results. Set the timing to .1 seconds. What we are looking for is a yellow flash to accompany our explosion, so it will resemble the light given off in an explosion. What happens when the switcher is triggered is the key will extend on the Flipper Out piston, thereby triggering the yellow GLT. The piston will then retract with a timing of .2 seconds, resetting the Global Light. It happens very quickly, but it's a nice effect.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%289%29.jpg

Lastly, place a sensor switch on the door of the car, and tweak it so that it will trigger when the player jumps into the driver's seat. Wire this to your Permanent Gates below. Finally, wire the ON/OFF Permanent gate to the Camera Zone just behind the car. This will make it so the camera shifts to show the house only when the player jumps into the driver's seat.

We are now done with the explosion. This was pretty simple, huh? Make sure you don't change the material of the house or it won't blow up. Leave it as cardboard, but sticker it as desired.


Making the Car Go


http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2810%29.jpg

So, here we have our car. The grab switch on the steering wheel is temporarily wired to the wheels so the car doesn't go anywhere. To begin, we will pause the physics and detach these connections. Do not unpause, or your car will take off on you.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2811%29.jpg

To handle the motion of the car, we are going to need a bevy of Logic switches. By now, you should recognize them, but we'll explain anyway: we have a 3-way OR gate, a 4-way Toggle Switch, two AND gates, a 3-way Switch, and a PERM switch.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2812%29.jpg

Taking a closer look at our 4-way Toggle Switch, we can begin to understand its purpose. We have removed two of the magnetic key switches from its arms, and left two in place. The key is directly behind the top magnetic key switch. Notice that if it were triggered multiple times, the sequence would follow as:

Switch 1 ON > Both Off > Switch 2 ON > Both Off > Switch 1 ON > Both Off

This is exactly the sequence our car follows in the chase scene. It drives to the right, stops for a few seconds, drives to the left, stops for a few seconds, drives to the right, and then stops at the end. These movements will then be achieved with our 3-Way Switch. More on that later.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2813%29.jpg

First, wire the grab switch on the steering wheel to our PERM switch. This will essentially set the whole level in motion.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2814%29.jpg

Set the output of the PERM switch to be directional and wire it to one piston in each of the AND gates as shown.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2815%29.jpg

Wire the top magnetic key switch on the Toggle to the bottom AND gate. Wire the bottom magnetic key switch to the top AND gate. This piece is what will handle the dynamic changing of directions as the car progresses.


http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2816%29.jpg

Then, wire the bottom AND gate to the right winch in on the 3-way Switch. Likewise, wire the top AND gate to the left winch. By design, the winches on the 3-way Switch are set to backwards. If for whatever reason you have made your own, be sure each winch is 'backwards.' This is how we are going to control the motion of the car. Yay!



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2817%29.jpg

We now need to set up the inputs for our 4-way Toggle. We are going to use the blue magnetic key switch on the front of the car. Set it to one shot. What will happen is our toggle will trigger each time the car drives by a blue key.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2818%29.jpg

We don't want to wire the one-shot blue magnetic key switch directly into our toggle (since we are going to have a few more inputs that we'd like to wire to it as well), so we will string it through this 3-way OR gate. In order to wire the one-shot magnetic key switch to the OR gate, we need to set the top piston to flipper in (so it can accept a 'one shot' input). The timing for this should be something like .5 seconds. We are doing this for a reason, we promise - see if it makes sense after we work out the other OR inputs.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2819%29.jpg

You should notice that in the path of the car, there is a little area with a blue magnetic key and a few green magnetic key switches. This is where we want the car to pause for a moment. We have already tweaked these for the purposes of this tutorial to save you the trouble. When the car drives past the blue magnetic key, it will slide for a moment, and come to a stop, bringing its green magnetic key into the range of the green magnetic key switch that is set to directional (the one flipped on its side). This key switch has a large 180 degree trigger radius. The smaller key switch will later be used for a PERM input. For now, we will ignore it.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2820%29.jpg

Next, we are going to need a simple Delay Switch. Wire the directional magnetic key switch on the wall (the one flipped on its side) to the piston in the delay switch. Set the timing of the delay switch to be about 4 seconds (this would be tweaked to your liking by testing it out on your own). Set the output for the delay switch to be directional and wire it to one of the other pistons in the 3-way OR gate. Make sure that you do not leave this logic where it is shown in the picture. Notice that the green key from the Delay Switch is positioned in the trigger radius of the magnetic key switch on the wall? This is a case of conflicting logic. Once you have everything wired up correctly, moved it out of sight.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2821%29.jpg

Repeat the above steps for the second time the car is supposed to stop. The timing of the delay switch for this one will be shorter. Again, tweak it as you see fit. You want it long enough that the chasing car is close, but not too short or the chasing car will bump into the player's car.




http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2822%29.jpg


You should now have all the inputs to your OR gate wired up correctly. Set the output for the OR gate to be of the 'one shot' variety, and wire it to your 4-way Toggle.




http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2823%29.jpg


All the logic is wired up correctly, we just need to connect it to our car.




http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2824%29.jpg


Wire the 3-way Switch above (with the two winches pulling on the lever arm) to the wheels of the car and the speaker on the side of the car. Make sure the 3-way switch is set to directional. Yes, you can wire directional outputs to speakers [not shown].

Your car is now fully functional, but the chase scene itself is not yet completed. We'll start on that in the next section.


Chase 1


http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2825%29.jpg

Chase 1 is all about this car here. Notice that it has a red key on the front of the car instead of a green one. When you copy the level, it will have a grab switch wired to the wheels to keep it in place. Be sure to keep the physics paused, and delete this grab switch - we do not need it.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2826%29.jpg

Instead, what we will do is turn the wheels on using a PERM switch. Place this near the delay switch from before, where the car pauses initially. Again, keep in mind that we do not want to make these logic gates interfere with the magnetic key switch on the rock wall.




http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2827%29.jpg


Remember that smaller green magnetic key switch that we ignored earlier? Well, we are going to use it now. Wire this to the dissolve in the PERM Switch. Wire the PERM switch, whose output should be set to ON/OFF, to the motor bolts on the car and the attached speaker...




http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2828%29.jpg


...and also to the camera that's positioned here. If you recall, when the player drives over the bridge the first time, the camera angle is left at default. When driving over it in reverse, the camera pans out to show the bridge collapse. This is how that is accomplished.




http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2829%29.jpg


See this lone red magnetic key switch? It has a large radius, set to ON/OFF, which is meant to be wired to the magic mouth on the car. This magic mouth has a cutscene camera, so that when the car is driving down this hill, the camera will pan to the car and display the message. These have all been pre-tweaked for simplicity, you just need to wire it up to the magic mouth.




http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2830%29.jpg


Now, we begin on collapsing this bridge. Start by placing a permanent switch nearby. Wire the red magnetic key switch on the bridge to the PERM Switch's dissolve. Set the PERM Switch's output to be directional.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2831%29.jpg

Up above, you should see this strange setup. We have little sections of the lower bridge being held up by dissolve and stiff rods. By dissolving these connections away, we can simulate the collapse of the lower bridge. There's a little piece of dark matter with a piston and a key off to the right of the upper bridge. The piston is held in place by that little magnetic key switch below it. Delete this key switch and instead wire the PERM Switch you just made below, in its place.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2832%29.jpg

Again, we have gone through the hassle of tweaking this whole area for you. As the PERM Switch is triggered, the piston above will extend, thereby dissolving away all the dissolve chunks. It is done this way to simulate the lower bridge's collapse. Contrary to how it looks, each section of the lower bridge is separate from the next. The little front layer detail adds to this illusion. Take it apart if you're curious (but be sure to properly put it back together).



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2833%29.jpg

As a little added detail, we have copied our little explosion GLT effect from the building explosion earlier and decided to implement it here. We have flipped over a red magnetic key switch, and given it a large 180 degree trigger radius. In this way, the magnetic key switch will trigger once the chase car falls into the trigger radius. Setting this switch to 'one shot,' we can wire it to our "explosion effect." This is not entirely necessary, it's just something fun which can be added fairly quickly.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2834%29.jpg

Lastly, we need to work out how are going to control the little drawbridge that drops down. Y'know, the one that allows passage to the upper road? Since it drops down and the resets, it sounds an awful lot like a Set-Reset Switch. Let's add one of those now. Place it wherever is convenient.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2835%29.jpg

For our Set-Reset Switch, we are going to need a temporary directional input. It just so happens that we have on of those already. Remember the directional switch that is triggered when the car pauses? We can use that. Wire it up to the right winch in the Set-Reset Switch.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2836%29.jpg

By wiring it to the right winch, we notice that when this is triggered it will pull the magnetic key in the middle to its matching magnetic key switch.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2837%29.jpg

Similarly, wire the directional magnetic key switch for the second time the car stops to the left winch. Set the output for the set reset to be directional and wire it to the winch controlling the drawbridge.

Viola, Chase 1 is finished. Adding in some details and sounds is entirely up to you. We are almost finished now - all we have left is the second chase, which we've left for the next section.


Chase 2


http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2838%29.jpg

The second half of the chase is all about the second car, which is perched above the beginning of the level, just waiting to be wired up. Again, we would like to keep the physics paused and delete the grab switch holding the motor bolts in place.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2839%29.jpg

Instead, we are going to turn the motor bolts (and other things) ON using a Set-Reset Switch. Add one of these now, wherever is convenient.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2840%29.jpg

We want to trigger the start of the second chase when the player's car comes to rest for the second time. Seek out the directional magnetic key switch (the green, sideways one), and wire it the right winch in the Set-Reset Switch. This will, in essence, set the car in motion. This should make sense in how the Set-Reset Switch is designed to work.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2841%29.jpg

We want the wheels to turn off once the chase car lands on the collapsing cliff. Seek out this yellow directional magnetic key switch on the 'landslide' and wire it to the left winch in the Set-Reset Switch. Yours wires should be spanning across the whole level, which is fine. This will trigger the Set-Rest to turn off the wheels of the car.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2842%29.jpg

Set the output for the Set-Reset Switch to be ON/OFF (obviously), and wire it to both of the chase car's wheels, as well as the speaker attached.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2843%29.jpg

In addition, we want to wire the Set-Reset switch to this camera zone. It can be found just below-and-to-the-right of the second chase car that you just wired up. This will turn on the camera, which pans back to show the chase car. This is not entirely necessary, it's just a quick little addition.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2844%29.jpg

Just above where the first car begins chasing the player car, there is a little drawbridge. We have left the little PERM Switch logic in for you, but it should be clear what's happening. As the player car reaches this point on the upper road, the 'drawbridge' will swing down, allowing access to the road the first chase car originated from.




http://www.lbpcentral.com/forums/../images/logic_pack/tutorials/3-2/3-2%20%2845%29.jpg


Again, we have taken our little 'explosion' GLT effect from the beginning and copied it over to the end of the second chase. Locate the yellow upside-down, one-shot magnetic key switch and wire it to the piston in our 'explosion' effect. Also, wire the output from the explosion effect to the two speakers located nearby.



http://www.lbpcentral.com/forums/../images/logic_pack/tutorials/3-2/3-2%20%2846%29.jpg

For simplicity, we have just left this rockslide portion of the level in for you. If you'd like to know a bit more about how this was accomplished, we invite you check out the tutorial entitled [1.2] Coordinating a Rockslide. It shares many common elements with the rockslide used in this level (and the collapsing bridge for that matter). Similarly, feel free to take it apart and see how it works - it's really not all that complicated, it just takes some patience and tweaking.



http://www.lbpcentral.com/forums/../images/logic_pack/tutorials/3-2/3-2%20%2847%29.jpg

We are just about finished! We are going to want to go clean up the rock detail in front of our two chase cars. We had cut away sections to better work with the cars, but it looks a bit rough. The simplest fix is to use the corner editor to delete the interior points. (If you find that you are unable to delete them, move the terrible gas below so that it does not overlap the rock material. You can always move it back later.)



http://www.lbpcentral.com/forums/../images/logic_pack/tutorials/3-2/3-2%20%2848%29.jpg

Repeat this for the second chase car.



http://www.lbpcentral.com/images/logic_pack/tutorials/3-2/3-2%20%2849%29.jpg


Finally, we are going to want to add a blue magnetic key to the very end of the level. This ensures our car comes to a stop, allowing the level to end.

At this point, we can unpause to make sure that nothing behaves erratically. If everything seems to be in order, you can save and test it out. Feel free to go in and spice it up visually. We couldn't be bothered, but you might want add some actual characters driving the chase cars - it would make more sense! This is not terribly important, however; we'd rather you understand everything that was just accomplished.

Additional notes:


If you find that the logic is behaving erratically, make sure that no logic switch is interfering with any other logic switch (or input magnetic key switch). As a precaution, you can drop down a little chunk of dark matter somewhere in your level prior to unpausing. In this way, if you choose to rewind, just go back to where you were placing the dark matter.
If the timings for anything are not exactly how you'd like, tweak it to your liking. The inputs for our logic are pretty flexible, as everything is triggered by the moving car.
I would avoid changing the speed of the cars or the materials they are made out of. If you do decide to do these things, take note that it will affect the entire level.