Table of Contents
- Frequent pieces list access frame ATTACK2 ( Def: Hit world. Right mouse button )
- External DSV databases panel. Right-click the ExportDB button.
- Physgun snapping feature
- Ray intersection snapping feature
- Dealing with track pieces additions
- Button controlled slider panels
- Matrix-based interpolation snap and dynamic translations
- Working mode radial menu selection
- Extended physics gun snap ghosting and general adviser
- Context menu for entity direct value export and manipulation
- Server-based tasks for spawning/snapping
- Curved track generation
- Flip over normal position and angle
- Tool dedicated con-var menu
- Bezier curving for smooth transition turns
Frequent pieces list access frame ATTACK2
( Def: Hit world. Right mouse button )
This frame is designed, so the user can access the most frequent pieces
on the server every time they are needed. In multiplayer, many users will
populate this list rather than only one user in a single player game. Sorting the list
can be performed by clicking the top of the column where the name is displayed. You can copy
any value in this list with the exception of the model, which is copied by selecting a line from
the list. For closing it just click the form [X]
like in a normal window button or use the shortcut [ALT + E]
.
You can see what each panel element is used for in the list below:
- Database export button.
Left click is used to export the client-side generic database as an external file. The file unique prefix starts with[generic]_
and the result data is located here. You can also pressSHIFT
while issuing the export to generate auto-run configuration file for the type selected. When no line is chosen the script will use the type of the holder model. Right click is used to open theexternal DSV manager
. Keep in mind that the user has to settrackassembly_exportdb 1
from this to work. - This combo box contains a list of columns which a search can be made
Using the Lua pattern written in(3)
. The result is displayed in the list view columns database below(5)
,(6)
,(7)
and(8)
containing the matched records. - The text field entry
Accepts Lua pattern from the user input and whenENTER
is pressed, searches in the list view column selected by(3)
to match the pattern with. The result will populate the list view only with the matched data rows in(5)
,(6)
,(7)
or(8)
. - This is the title of the frame.
It contains the user nickname and current tool version the client is running. You can check for the version here. - The
Used
column
Contains the amount of time in seconds the piece stays in the cache taken as a difference between cache read request and the panel open invoke request. - The
End
column
Contains the amount of active track ends available on the piece for snapping. This will be always larger than one. - The
Type
column
Contains the type under each piece persists in the cache and a grouping string that contains a bunch of models being under the same category. - The
Name
column
Contains the track piece name, usually auto-generated from the model or directly inserted into the database. - The tool hint for each row
It will display the actual track model path. - This is the current model
Quickly retrieved from the cache. Selecting this will switch the model(9)
to be used in the track building process. - Model display
This displays the currently selected model from the cache for the current line(10)
the user has clicked on. - The context menu
It is generally used to preform various tasks, but in this case it will copy and export data
External DSV databases panel. Right-click the ExportDB
button.
This frame is designed, so the user can access the external DSV pluggable databases list on the local machine the game instance is running on. It is opened via right-clicking the ExportDB
button ( when trackassembly_exportdb
is set to 1
) and a direct representation of the DSV external database list located here. It contains all the currently available external database information and if they are active or not.
For closing it just click the form [X]
like in a normal window button or use the shortcut [ALT + E]
. The elements are explained below what they do:
- The active column
This shows whenever a given database unique prefix is active or not. If it's active, then it is not commented in the file using the#
token. - This database prefix column
This stores the unique prefix key for every database attached. They are for the external database sent to the system and must be sequential and mandatory. - This is the current line source
It will display the origin file that is responsible for attaching the external database prefix given in(2)
- This is the title of the frame
It contains the user nickname and current tool version the client is running. You can check for the version here. - This is the current database
Selecting this will mark it for further context manipulation - This displays the current mouse hovered line
Derived from the DSV file for the unique database prefix. You can right-click on it to open the context menu(7)
and show various option related to its DSV management. - This is the context menu being shown when the line
(6)
gets right-clicked
It is generally used to preform various tasks. Its task list will supports and is not limited to:- Toggle the DSV source ON/OFF to activate it
- Copy various values like the box data for example
- Current selected line manipulation. Add, create, delete.
- Move the selected line up/down, top/bottom
- Manage DSV attached table contents for each table present
- Toggle manipulation
This text entry is used when you need to toggle ON/OFF the modified/created line. EnterV
for enable and everything else for disable. - Unique prefix manipulation
This text entry is used when you need to change the unique prefix for the modified/created line. It is mandatory and does not contain spaces. - Source manipulation
This text entry usually contains some customsource
marker who or what has added the DSV. It is not mandatory and can be even empty. - Import button
Click on this button to automatically read the DSV file and populate the list view with its contents - Export button
Click on this button to export the current state of the list view to the DSV file list
Physgun snapping feature
This is used to include the same functionality from an addon called
Rollercoaster assistant
. It was very old and I used to love it, however, the author is
nowhere to be found just like the addon itself. That's why I coded my own personal version for the same thing.
You can see it in action here:
Ray intersection snapping feature
When building a track layout, the user cannot place the curve piece precisely to obtain a smooth
transition between two snapped pieces. For 45
or 90
degree curves eye-balling the track, is very
hard because the user is looking at a projection of a 3D world over a flat 2D screen. This sometimes
results in bad depth perception and hard to connect two segments with freezing them in place. That's
why a script was made to do just that. You can see it in action here:
Dealing with track pieces additions
Additions are generally entities that have to be created and attached to the track piece spawned.
They are often used as track needles, switching levers and additional scenery. This is not to be mistaken
with the bodygroups which are visuals for an entity.
A good example for additions database is Shinji's track pack
and his switchers:
Button controlled slider panels
These items are introduced in the tool major update derived from merge request matrix POA.
Their main purpose is for the user to be able to interact with the slider faster.
This panel also includes a snap increment/decrement, where the angular amount is controlled by the
convar trackassembly_incsnpang
and the liner amount is controlled by trackassembly_incsnplin
Here are the dedicated button functionalities and what they do:
<> : Mouse left click decrements the slider, right one increments it
+/- : Reverses the sign of the slider if its value is different than zero
@M : Stores the slider into the user clipboard. Left click to paste and right to copy
@D : Updates the slider value to the default. Left click to update and right to copy
@45 : Snaps the slider to 45 degrees magnitude. Left click for negative and right for positive
@90 : Snaps the slider to 90 degrees magnitude. Left click for negative and right for positive
@135 : Snaps the slider to 135 degrees magnitude. Left click for negative and right for positive
@180 : Snaps the slider to 180 degrees magnitude. Left click for negative and right for positive
Matrix-based interpolation snap and dynamic translations
The matrix class in Garry's mod gives astonishing functionality related to translation and
rotation. They can be represented in this case by a matrix, and so transforming a matrix
is done by multiplying the source matrix to the rotation/translation matrix. In this case when snapping the tool solves the
matrix equation for the new basis Spawn * Holder = Trace
where Spawn
, Holder
and Trace
are matrices
with dimensions 4x4
. The spawn matrix Spawn
then becomes equal to Spawn = Trace * Holder⁻¹
. When the equation is solved
by the Gmod Lua API, the translation and rotation can get easily extracted. If you are searching for how to translate the script
or anything related to the translations, you better see the following page
Working mode radial menu selection
The working mode switch drop-down menu is used quite often by the player during the track building process. Every time
the user must open the spawn menu and click on the working mode
selection drop-down menu then choosing the working mode he/she needs. The radial menu is designed to be a micro-optimization
of that process. By enabling it via a console variable
trackassembly_enradmenu
, the payer can press its action key ( Currently Mouse-3 MOUSE_MIDDLE
)
and use a radial menu for working mode selection. You can see it in action below:
Extended physics gun snap ghosting and general adviser
Sometimes the user cannot predict where exactly the physics gun snapped piece will go at when adjusting the
additional position and angle offsets. That's why some kind of extended drawing was needed. The hook
DRAW_PHYSGUN
automatically draws the spawn structure while extracting the position and angle from the
table to precisely show where the piece position will go at and what angle will be used when snapping.
When the user has enabled the ghosting via trackassembly_ghostcnt
the hook will draw an additional ghost
stack filled with only one single prop client-side to assist the user in the 3D space.
Context menu for entity direct value export and manipulation
The bodygroup/skin manipulation feature needed an upgrade, so the context menu was developed. Among this feature, I decided to slip on some others, which are decent to be controlled via the right-click. The option related to the track assembly tool can be located using the name of the tool depending on the current game language. From there the user can pick various options for value exports like the model, bodygroup/skin, mass. It also manipulates physgun-ignore, freeze, gravity and attached constraints. That way the user has additional control over a single track piece.
Server-based tasks for spawning/snapping
There was a huge problem when TA was attempting to stack many pieces in a single frame. This needed to be
changed somehow to reduce the server lagging with Connection problem 4000
. The server had to stall for a
bit until the stacking is completed so the players could not move or do anything until the process is
finished. That's how this update was born which basically adds a TA complained tasks inside a queue list.
This list is later looped by the server to see are there any tasks to be done and does them. When a player
has already submitted a queue task, he must wait for the server to do all the player requests that came
before him and cannot start another task as the items are registered per player so it will return that
the server is busy because it is currently about to process his request unless via trackassembly_enmultask
the multitasking is enabled. Every server-based task has
dedicated data place, player and arguments.
Curved track generation
This was a major tool update derived from pull request #23
. Its major goal was to update TA,
so the user could do things with TA that he/she couldn't be able to do before. By using the curving option,
the user can create a server-based task that generates a curve passing through a bunch of control points.
This curve is later fitted with straight segments of the model which are automatically fitted along it.
Flip over normal position and angle
This was a major tool update derived from pull request #23
. It was dedicated to
flipping over ( mirroring ) a bunch of tracks across given position and normal vector.
If you have a track that is the same in some direction you can just mirror it by right-clicking
its pieces and left-clicking on the origin you pick.
Tool dedicated con-var menu
This was a major tool update derived from pull request #23
. I know it was crappy
to use the console and it is more convenient to use an actual menu to setup stuff so I made the
exact thing. The menu is divided to user
and admin
dedicated sections. First ones are just user
preferences and the second ones only the server admins can manipulate.
Bezier curving for smooth transition turns
This feature is derived from the following commit. This adds Brazier curving to produce smoother turns when cornering. The curve will use the control points as weighted stretch marks when it generates the track so your trains can enter and exit the curve more smoothly than the regular quarter-circled arc that most of the track packs use nowadays.