Place Nodes and Configure Paths - MagnumMacKivler/trakpak3 GitHub Wiki
Back to Adding Signals To Your Map
PREVIOUS Tutorial: Placing Signals in Hammer | NEXT Tutorial: Creating a Dispatch Board with DispEdit
This tutorial will teach you how to finish up the signal installation process, using Trakpak3's custom node and path editing tools.
Table of Contents
Install the Node and Path Config Files
Introduction
If you haven't been following along with the previous two tutorials in the series, I recommend you read up on them before going through this tutorial, since it uses the same example signal system and test map.
Behold, the test map: signal_tutorial.bsp!
You may notice that the ABS signals are lit up, but the Junction signals are dark. That's because they still need some in-game setup in order to work.
The Node Editor Tool
The first thing you'll want to do is find the Trakpak3 tools... they are located in the "Trakpak3 Dev Tools" category. Once you find them, select the Node Editor
tool.
Immediately upon selecting the tool, you should notice a few things have appeared:
- A blue wireframe box where you are aiming. This is a preview of the nodes that the tools place.
- Yellow wireframe spheres sticking out of the ground. These are projections of where the tp3_signal_block entities are in the map.
- White boxes with red, green, and blue axes in them, on the tracks. These are the signals'
Cab Signal Pos
itions.
There are some sliders in the tool menu, but you can leave them alone for now.
The Node Editor allows you to place, move, and delete Track Nodes. Track Nodes are 3D boxes that will eventually be chained together to tell the tp3_signal_blocks how to actually look for trains.
Place Nodes
Start placing nodes onto the track. We'll start at the single track area, placing nodes right next to the signals, in between the Cab Signal Positions. Make sure there's a good amount of space between them and the white Cab Signal Position boxes.
- Left click to place a new node.
- Right click inside the sphere of an existing node to select it. Left click somewhere to move that node, or right click outside it to deselect it.
- Reload to delete a node.
If your map has curves (Of course it will, I stupidly forgot to add any to the actual test map and at this point I don't want to go back and edit everything again), place nodes on them like in the below picture. You don't need a whole lot of them, just enough so that if you were to drag one node in a straight line to the next, it will always touch the correct track and won't overlap with the parallel tracks.
Next, we're going to chain the nodes together and assign a tp3_signal_block to them. But first, go ahead and hit the "Save Node File" button in the tool menu. Press Save again when the dialog box pops up.
The Node Chainer Tool
The Node Chainer Tool is responsible for linking tp3_signal_blocks to sequences of nodes. Nodes can be used by multiple blocks at once.
Left click inside the first of the yellow wireframe spheres (a tp3_signal_block) to select it.
Now, any nodes you select will be added to that block's node chain. Order is important! Select the first node, then the second.
Once finished, left click on the ground somewhere to deselect the node chain. One down, many to go! If you want to clear a block's node chain, press Reload while aiming at a block's wireframe sphere.
Repeat the process for the next block, and so on. Remember, multiple blocks can reference the same nodes!
Short gaps like these are okay, so you don't need to set up blocks over the Junctions.
This is how you'd link up the nodes on curves. The more nodes in a chain, the longer it takes the block to fully cycle (the default rate is 10 scans per second), but really don't worry about making blocks with a few dozen nodes in them.
The nodes on the outside track here get a little close to the inside track, so we will move them out a little bit with the Node Editor tool.
Looking better!
And of course, don't forget to save!
Next, we'll start setting up Junction Signals using the Path Configurator tool.
The Path Configurator Tool
The Path Configurator tool is used to set up all the different switch, block, and next signal combinations that Junction Signals need to function.
The First Junction Signal
Select the Path Configurator Tool, then left click the tp3_signal_master on the first Junction Signal.
A wild Menu appeared!
In the menu, you're going to want to Add a Path for each possible path through the Junction. Since this junction is a single switch with two possible ways to go, we're going to need 2 Paths, so press the "Add Path" button twice.
Now, select Path 1, and close the window. You'll notice a few more visual elements have appeared...
- The signal now has some labels on it to help you keep track of which path we're configuring.
- The blue boxes are tp3_signal_blocks.
Click on the switch, or the switch stand. A label will appear on it, in green, with an "N" for "Normal" (the default position of the switch). You can click it again to change it to a yellow "R" for "Reverse" (the thrown position of the switch) and again to deselect it, but we want it to be Normal for this path. This tells the signal that Path 1, the main path through the Junction, will be active when that switch is in the Normal position.
Now, noclip into the blue cube that marks the tp3_signal_block for the track ahead. It should turn Cyan once you're inside. When this happens, left click anywhere on the ground to select the block. This tells the signal that when Path 1 is active, it should be monitoring this tp3_signal_block.
Lastly, go to the next tp3_signal_master that a train would encounter after taking that path, and left click it. This tells the signal that when Path 1 is active, it should be monitoring that Next Signal.
That's all the setup for just the first path!
Now reopen that menu again by right clicking somewhere, and select Path 2. Repeat the process we just went through, except this time we want the switch to be Reverse, and the tp3_signal_block and Next Signal will be down the diverging path.
Now, there's one more thing we need to do for this Diverging path. In the menu, did you notice the Path Speed combo box and the Diverging checkbox? Make sure the Diverging checkbox is checked, and set the Path Speed to MEDIUM. This will make the signal display a Medium speed indication when lined for that route.
Once we're done, hit Reload to deselect the signal.
Don't forget to save! The path configs are saved in a separate file from the nodes, but the interface is pretty much the same.
The Home Signals
The two signals on the other side of the switch also need paths configured in order to work! Unlike the first Junction signal, though, these only need one path each.
Now you might be thinking, what happens to that signal when the switch is in the Reverse position? When none of the defined paths are true, the signal will default to a condition where the Route Speed is 0 (STOP/DANGER) and the block is Occupied--regardless of whether there is a block set up or not. In a properly-designed system, this should produce an absolute Stop signal.
The home signal on the diverging path gets the same treatment, but of course the switch must be in the Reverse position, the Path Speed is Medium, and the divergence is Diverging.
The Second Junction Signal
Now, let's move on to the second Junction Signal. This one has not two, but three paths it can take.
Because the main path requires both the switches to be in the Normal position, they must both be selected:
The second path, as expected, needs the first switch in Normal and the second switch in Reverse.
The third path, into dark territory, is a special case. Only the first switch needs to be selected (Reverse) because no matter what the second switch is, the train will always go down Path 3. There is also no block or next signal selected, because they don't exist--it is "dark" territory, after all. On other signal systems, you would probably want to make the Path Speed RESTRICTED, so that the signal gives a Restricting or Stop-and-Proceed indication... but the Delaware and Hudson signals we modeled don't quite support that (only ABS signals can display Stop and Proceed), so the most restrictive speed we can give it is Medium.
The path configurations for the home signals opposite the Junction Signal work much as you'd expect.
The righthand searchlight signal here probably should have been a 2-headed signal, oops. We'll just say it's a full speed path so it doesn't display a red all the time.
See, even the masters make mistakes when setting this stuff up... If you find you need to go back and correct something, don't fret! Just save your node and/or path configurator files, fix the error in the map, and load them up next time you launch the map! All the data is stored based on entity names, so even if the entity IDs change, everything still works. This is why it is so critically important that all Trakpak3 entities have unique names.
Install the Node and Path Config Files
Similar to how we installed the Signal System Config earlier, we must now make new subfolders in the lua\trakpak3
directory we created before. These subfolders will be called "nodes" and "pathconfig".
Now, we have to copy the appropriate file from the data\trakpak3\nodes
folder over into the lua\trakpak3\nodes
folder, and the file from the data\trakpak3\pathconfig
folder into the lua\trakpak3\pathconfig
folder. Change both files to .lua.
And with that, the map should be ready to test!
Testing the Signals
Reload the map, and as they say in New York City... Badda Bing!
Have fun playing with the signals, seeing how they respond. If you want to get an idea for how the signal block detection works, you can type tp3_showhulls
(or tp3_showhulls 2
for an even more detailed view), to see the blocks and how they respond to trains (props) in their way.
Another command you may find interesting is tp3_signal_vision
. You're going to want to bind this to a key... bind h +tp3_signal_vision
will make it so it will turn on when you hold down the key, and turn off when you release it. Signal Vision shows you the name, description, and speed of each signal you look at, so it makes a great aid for people who aren't familiar with whatever signals the map uses.
That's all there is to basic signal setup! Have fun!