Creating a Dispatch Board with DispEdit - MagnumMacKivler/trakpak3 GitHub Wiki
Back to Adding Signals to your Map
PREVIOUS Tutorial: Place Nodes and Configure Paths
This tutorial will show you how to create dispatch boards, using Trakpak3's Dispatch Board Editor (DispEdit)!
Table of Contents
- Create the Board
- Draw the Track Lines
- Place Switch Controllers
- Place Block Detectors
- Place Signals
- Decorations
- Dispatch Proxies
Installing the Dispatch Board File
Bonus: Physical Dispatch Boards
Introduction
Load the map you want to make a dispatch board for... I'll be using the test map, "signal_tutorial", that we used previously.
Once in-game, you'll want to bind a key to tp3_dispatch_editor
, because you're going to be pressing it a lot.
DispEdit
When you run the tp3_dispatch_editor command, DispEdit will open up. It's a lot to take in, but we'll take it one piece at a time.
One thing you should know about first is that the "Reset Window" button can be used to resize and center the window back to default.
Create the Board
Start by pressing the "Add Board" button in the top left corner. Give the board a descriptive name... we'll do "Tutorial" for this example... and press Confirm.
The map can have multiple boards, which can by cycled through like pages. There are arrow buttons at the bottom left corner that can be used to move between them. Multiple boards can help complex maps stay organized, but for this tutorial, we'll just need the one.
The dispatch board uses a grid system to allow for easy placement of elements. The grid size for each page can be configured using the controls in the top middle, and the grid rendering can be disabled entirely with the Toggle Grid Display button. If desired, the Background (BG) Color can also be changed, using the appropriate RGB color code.
And of course, don't forget to save! The Save button is right in the top right corner of the editor.
Draw the Track Lines
The first thing a dispatch board needs is a diagram of the track itself. On the right side of the editor, you should see a selection of buttons labeled "Add Elements". Select the one for "Track Line".
A green box cursor should now appear. Left click to place the first point of the line, then again for the second point, or right click to cancel. We're going to want to place this line up near the top, on the left, and have it be 4 grid spaces wide, like so:
Clicking either of these two handles will let you move that handle by clicking again. Clicking the background or right-clicking will deselect it. Once that happens, the line can be re-selected again by clicking the handle in the center. If you want to delete an element, select it, then press the "Delete Selected Element" button in the bottom right corner.
There are three blocks of single track on the left end of the map, so we will make two more lines, spaced one grid unit apart. The spacing is optional; you could also just make it one long line instead.
Now we'll add the first switch, and the diverging line. Dispatch boards are commonly arranged in an East-West pattern instead of trying to capture the actual direction of the track.
Lastly, we'll add the second junction, which includes the unsignaled stub track and the transition to double track, and the righthand crossover.
If desired, you can use the Toggle Grid and Toggle Helpers buttons to see how the diagram will look in the final dispatch board.
Place Switch Controllers
Next, you'll want to go back to the Add Elements panel and select "Switch". Place these on the switches you want to control via the dispatch board--not all switches necessarily need them. The crossover only needs one, right in the middle, since the switch stands are linked together (something set up in Hammer).
Now, we have to link the switch controllers to the actual switches. Use the Toggle Map Block Hulls button to turn on tp3_showhulls 2
. You'll notice that all the switch stands, blocks, and signals are now surrounded by wireframe boxes.
This is the first switch we need to link, so noclip into the box. You'll notice that a message saying to press E to copy the name to clipboard. Press E to copy the name to the clipboard.
Now, open the Dispatch Board editor again, and click on the corresponding switch controller. An "Element Properties" table will appear. Paste the targetname of the switch stand into the box, and de-select.
Now, repeat the process for the other switches. For the crossover, you only need to pick one, since the two switch stands are linked.
Place Block Detectors
Now, we're going to add the block detectors, that will indicate when a section of track is occupied. Placement is just like the switch controllers.
These must be linked to tp3_signal_blocks in the same manner as the switch controllers, too. You should be getting the hang of this by now.
Place Signals
Now, for something a little more complex. Go to the Add Elements panel and add Signals to the dispatch board, to represent Junction and Home signals. Do not add ABS signals to the dispatch board--they are truly and purely automatic.
Take note of the "Orientation" and "Style" properties. Orientation will rotate the signal icon so it makes sense, and Style will give it an alternate icon commonly seen on more modern, computerized dispatch boards.
If you feel the dispatch board is getting too crowded, don't be afraid to move and extend things to spread out. Remember, you can always add more pages if you need to spread it out.
Ahh... much better!
Signals are linked up just like switches and blocks are.
Decorations
There are a couple of options you can use to annotate the dispatch board. Track lines can be recolored and re-weighted (line thickness), and there are also Boxes and Text Labels that you can play with. A well-annotated dispatch board is an easy-to-use dispatch board!
Dispatch Proxies
If you want to control something else in the map from a dispatch board, or simply want a generic icon, you can use a Dispatch Proxy.
Placement in Hammer
In Hammer, place a tp3_dispatch_proxy
entity. A Dispatch Proxy is a generic entity that allows for 2-way communication between the dispatch board and the Hammer I/O system.
Dispatch Proxies have 10 states (0 to 9). When a player presses the linked button on the dispatch board, the tp3_dispatch_proxy will fire one of 10 outputs based on which state it's in. For this example, we'll have the Dispatch Proxy control a door on the branch line.
The proxy itself doesn't need any keyvalues changed except for the name. We'll say the Proxy should have three states... State 0 will be for when the door is shut, State 1 will be for when the door is moving, and State 2 will be for when the door is open.
First, let's set up the outputs to control the door. When the Proxy is in State 0 (shut) and the player presses the button, we want it to open the door. Conversely, when the Proxy is in State 2 (open) and the player presses the button, we want it to shut the door. When the Proxy is in State 1 (moving), we want nothing to happen.
Now, we'll set up the outputs for the door to change the state of the Proxy. When the door starts moving, open or close, it sets the state to 1 (moving). When the door is fully opened or fully closed, it sets the state to 2 or 0, respectively.
Now, we recompile the map.
Back in Gmod
Load the map once again. Once you open DispEdit, press the "Load from Save" button to load the board we were working on before.
Add a Dispatch Proxy element near the end of the branch. You'll notice this one has a lot of properties! There will be an icon and a color option for each state, though we'll only need 0, 1, and 2.
Changing the color for each state is self-explanatory. To change the icon, you can open the Icon Browser located in the bottom left corner of the editor.
We'll select the Letter S icon first, for the "Shut" state. Select the appropriate icon, then press Copy to Clipboard. The icon can now be pasted into the "icon0" property. While we're at it, let's change "color0" to light red (255 127 127) to show that the door is shut and impassable.
Now, we can repeat the process for states 1 and 2. Set icon1 to the Hourglass icon (switch_hourglass_lit.png), and leave color1 as white (255 255 255). Set icon2 to the Letter O icon, for "Open", and set color2 to light green (127 255 127).
Lastly, we need to add the Proxy entity's name. There's no easy way to copy this, so just type the name from Hammer into the property box. In this example, it was "proxy_door1".
Proxies as Symbols
The Dispatch Proxy elements are unique in that they don't actually need to be linked to anything to exist. You can simply use them as a symbol on the dispatch board with an icon and color of your choice, in the state0/color0 properties.
Installing the Dispatch Board File
Save the dispatch board one last time. Just like the Node and Path Config files, the dispatch board file must be copied into a new subfolder and changed to .lua. You know the drill.
Make a subfolder in lua\trakpak3
named "dispatch". Copy the appropriate file from data\trakpak3\dispatch
into lua\trakpak3\dispatch
and change that sucker to .lua.
Testing the Dispatch Board
Reload the map one last time, and bind a key to tp3_dispatch
. If all went well, your dispatch board should look great!
Switches and CTC signals should be controllable from the board, as well as that door on the branch we made.
Also, fun fact, you can right click any switch, signal, and even block detectors to teleport to them.
Bonus: Physical Dispatch Boards
After the Dispatch Board is ready to use, you can add "physical" dispatch boards in Hammer with the tp3_dispatch_board
entity. Place one in Hammer, set the Dispatch Board Name
to the name of the page you want to use (ours was "Tutorial"), and drag the moveable origin. The board will be projected as a rectangle with the top left corner being the entity itself, and the bottom right corner being the moveable origin. Try to keep a rough 4:3 aspect ratio and make sure it's big enough that the buttons won't get squished together.
As they say in Looney Toons... That's all, folks!