Tren Layout P&E: Advanced 2 Walkthrough
In this P&E we’re going to look at emitters. We recommend you do the Gameplay - Emitters tutorial before trying this. We’re not gonna lie - this stuff is hard to digest. But it’s worth it! Understanding emitters is crucial to much of gameplay, optimisation and more. Strap in.
In the dock#
A simple wiring lesson, but important for understanding how to use Checkpoints with Tren Swap Docks. If you have both items in your track you’ll need to replicate this setup. Each Dock needs its own Checkpoint, which needs to be activated by the corresponding dock when the player switches Tren. Otherwise after a crash you could find yourself on the wrong side in the wrong Tren.
Wire the left Dock to the left Checkpoint and the right dock to the right Checkpoint.
To the naked eye#
To talk about emitters we need to talk about Preview Invisibility. Reason being, as soon as you set an element as the Object to Emit, it gets powered off and disappears from view in the editor. That's because the Preview Invisibility filter is on by default, showing you the visibility of elements as they will appear in Play Mode. Elements that are powered off are always invisible.
Go to the Show/Hide menu and turn off Preview Invisibility. Now you can see and edit the invisible track piece. Tweak it with +, hover over the Power button on the tweak menu and press X to turn it on. Close the tweak menu with +. We’ll be doing a fair bit of tweaking, so if we don’t close the menus the screen will get rather busy!
Help don't hinder#
Show/Hide filters stay on or off when switching between Play and Edit just like Guides. We need to get used to turning them off again when they start getting in the way. You see the blue stuff everywhere? That’s for collision detection. With Preview Invisibility off it’s not just ugly and cluttered, it will also affect some Guides.
Tweak the track, turn its power on, close the tweak menu and turn the Preview Invisibility filter back on.
Circle the wagons#
Let’s get started on those emitters. Start by stamping a PermaClamp wagon as guided. We’re going to set it to be emitted.
Tweak the emitter with +. At the top of the tweak menu you’ll see a button called Object to Emit. Select it with . You’ll now have a dotted line from the button to your imp. Hover over the wagon and press - this sets it as the Object to Emit, aka the “reference object”, as we’ll often refer to it. If Preview Invisibility is off the wagon will disappear. Close the tweak menu with +.
An emitter reference object is powered off because all the versions of it that are emitted are essentially clones of it. If your reference is powered on and any changes are made to it those changes will also be applied to the clones. For example if it was destroyed, the emitter would no longer emit it.
Get a load on#
Elements that create other elements work just the same way - by having a reference object to emit. Take a Fast Loading Station. This has an emitter gadget with a cargo element set as the Object to Emit.
Find a Fast Loading Station (P&E) and stamp it in. Turn Preview Invisibility off so you can see the reference, then turn it back on again. Switch to Play Mode and head on through to get some cargo.
Dump it#
A Fast Unloading Station has no need of emitters. All it has to do is get rid of the cargo. So it just has some logic and a Tag, which the cargo element detects, triggering its own Destroyer gadget and destroying itself.
Find a Fast Unloading Station (P&E) and stamp it in as guided.
Unhitch your wagon#
One way to get rid of emitted objects is via their emitter’s Destroy Emitted Objects input on page 3 of the tweak menu. This will destroy all versions of the reference object that emitter has emitted. To make it a little easier we’ve exposed this with a node here. The green dotted line goes back to the emitter from the last lesson.
Go ahead and connect the End Stop button’s Just Pressed output to the Destroy Emitted node. Switch to Play Mode, reverse to the limbo barrier, and drop off the cargo with . The wagon presses the button and triggers its own destruction.
Emit one get one free!#
The key thing with emitters is that they need a reference element in the scene to emit a copy of, and this is also the key to optimising your scenes. If we make sure that multiple emitters are emitting from the same reference.
We want to emit another wagon here. Since we’re already emitting one elsewhere let’s use the same reference object.
Tweak the emitter with + to open its tweak menu. You can pick it up with and move it to the side so it doesn’t obscure your view. Follow the guideline back to the first emitter lesson. If Preview Invisibility is on you won’t be able to see it, so turn that off. Press over Object to Emit on the tweak menu, move your imp over to the reference wagon, and press again. We now have one wagon being referenced by two emitters. Efficiency! Turn Preview Invisibility back on and switch to Play Mode to continue.
Deepen your scope#
The next lesson will see us optimising the emitter reference within an element, so there will be scoping. Let’s jog our memory here.
We want to fill this gap in the track. To do that we’ll make a special wagon with a track piece on it to stop up the gap. We’ve already set up the height and density so it’s not top heavy and doesn’t fall over.
Pick up and hold the track piece with . Move it over the pillar. It’ll snap into place, but we also need to get it into the correct Scope. Keep holding and Scope In with +. Release to drop it where it is snapping. Scope out with +.
Now pick up and hold the combined object with and move it over the wagon so it snaps. Again, keep holding and Scope In with +, then release where it snaps. Scope Out with +, switch to Play Mode and push your contraption into place and release it with +.
Optimise for success#
Let’s look at some more optimisation. If we have a scene with multiple elements which emit the same thing, it’s not efficient for them all to contain their own references.
We want to emit another bit of cargo here. We could stamp another Fast Loader, Scope In and delete the reference object, and tweak its emitter to re-target its Object to Emit to the reference object in the previous Loader.
There is, however, a slightly quicker way, but only for working with multiples of the same element.
Note that the camera is focused on the Loader from a previous lesson. Scope into it with +, and turn off Preview Invisibility so you can see the emitter reference.
Pick it up and hold it with , then Scope Out with +. Drop it anywhere you like.
The reference element is now outside the Loader, but the Loader’s emitter is still targeting it. If we clone the Loader, its reference targeting is cloned, but not the reference element itself - both the original and the clone will be targeting the same reference. Savings!
Clone the Loader with + and stamp it at our current lesson position as guided. Don’t forget to switch Preview Invisibility back on before heading back to Play Mode.
Emit nothing, deny everything#
Let’s finish our emitter lessons with another method for destruction. Firstly you need a Tag and a Destroyer on the reference object. We’ve already attached these for you.
The Tag will trigger the Destroyer when it enters a corresponding Trigger Zone. We’ll set up the zone in the next lesson.
For now, tweak the emitter and set its Object to Emit target as the wagon. Now stamp Tunnel: 3 Units to cover up the wagon being emitted.
Bin it#
Time to set up a Trigger Zone to destroy the wagon. The zone will detect the Tag on the wagon and cause it to send a signal to the Destroyer gadget.
Tweak the Trigger Zone with + and set Things to Detect as Tag. Note we’ve already filled in the name field for the Tag. Connect the button’s Just Pressed node to the Trigger Zone Power node. This way the Trigger Zone only turns on to detect and trigger the Tag for a frame when the button is pressed by the wagon.
High roller#
Ok let’s have a little fun to finish up and play with some PermaClamp: Roller wagons. These have a wraparound wheel which attaches to the underside of the track, so they’ll stay on even when upside-down. Put them on the front and back of Tren and then Tren can go upside down too.
To use them in your tracks you’ll need to get creative about how you pick them up and drop them off.
Just stamp two PermaClamp: Roller wagons as guided and switch to Play Mode.
On camera#
If you have jumps or vertical movement in your tracks you’re going to need Camera Zoom Objects. They use Trigger Zones to control the camera zoom.
Search for and stamp the Camera Zoom Object (P&E) as guided. Note that when you switch to Play Mode it pushes the camera out. That way you can see where you’re going and prepare for obstacles before you hit them.
Off the hook#
To finish up, let's create another compound element using Scope. We’ll add a Track Strap: Hook Point to this track piece to make something that Small Popter can move. To do that we’ll need to Scope it in twice.
Pick up the Hook Point with and hold. Hover it over the track Scope In +. Scope in again to get to the correct (movable) part of the element. Switch to Play Mode and use Small Popter to hook and swing the track arm up and over to create a bridge.
If you got through all that - well done! This was the last P&E for general assembling of tracks. Learn about wrapping those tracks up in start and finish gates, playtesting and balancing in the Tren Track P&E.
The Dreams User Guide is a work-in-progress. Keep an eye out for updates as we add more learning resources and articles over time.