Creating a new track type mod¶
This guide is authored by Voxel Tycoon community member scailman
We can create any type of rail but with certain limitations, such as the height of the rails.
When we create a new rail type, we also have to take into account that we need to make new stations and train depots. Alternatively we can modify the stations and train depots of the base game to use the new rails.
There are elements that are common to any rail type , which are signals, bridges and tunnels. This guide will explain how to create all of these, although it is possible to use the default base game assets as they adapt to different rail types automatically.
Whatever rail type we create, currently any train will be able to use it. To look right in the game and depending on the type of rails we create, we may need to create the right trains. For more information about creating a train, read the guide: Creating your first locomotive mod.
In the 3d program that we are using, we must create each element of the tracks separately. In the following image you can see from left to right: StraightCap, DiagonalCap, Rail1, Rail2 and Rail3 elements.
All elements must be centered on the coordinate axis at position 0,0,0.
The modeling is exactly the same as any type of building or vehicle that we can create in the game. If you need a more detailed explanation you can read the guide: Creating your first building mod.
Configuring the rails (
The train tracks are made up of three parts, the rails, the sleepers and the ballast. The rails and the ballast are generated by extrusion. This means that these elements are generated by stretching the mesh on the Z axis. If the rails have any element that is not generated by extrusion, it will be deformed or will not display correctly.
The configuration also includes the mesh of the catenary poles as well as the height of the catenary wire.
Tracks have a limitation in that, they cannot be linked with others of a different type.
- ElectrificationPrice: Price of each catenary section.
- Height: Height of rails above ground level. This value must not exceed 0.499. If the value is 0.5 or greater, the rails will sink into the ground.
- PoleMeshUri: Obj file of the catenary pole mesh that will be used when track is electrified.
- WireHeight: Catenary wire height.
LofterIngredients (Array): This section specifies the three elements that represent the track, the rails, the sleepers and the ballast.
Mode: How the item is generated. Possible values are Loft and Repeat. If the value is Loft, the element is extruded on the Z axis. The repeat mode makes the element repeat every certain space.
- MeshUri: Path of the .obj file.
Length: Section length. It can also refer to the repetition distance of the element.
EmbankmentLofterIngredients (Array): This section specifies the object that will be used for track slopes.
- Meshes: Meshes used for the end of the track.
- StraightCap: Meshes used for straight end track.
- DiagonalCap: Meshes used for diagonal end track. (45 degrees)
- ResearchUri: Path to the
.researchasset required to unlock the track type.
- Price: Price of each track section.
- RunningCosts: Track maintenance cost.
- Hidden: Specifies if the track type is visible in the track construction menu.
Creating the station¶
The modeling of the stations in many cases have to consider the type of track that will use it and the trains that will stop on it. This might mean having to do higher platforms or with less separation between the tracks.
Train stations can have very different appearances as we have a certain degree of personalization with the decorations that we can create and that will be repeated along the length of the platform. We can have different types of furniture such as benches, signs, lampposts or any other element decorative, but also use limitations such as maximum platform width and length to create multi-platform decorations from one .obj file.
Train station setup (
Train stations allow trains to load and unload cargo.
They have a maximum length and a maximum number of platforms by default, but if we wish we can restrict the maximum and minimum values manually.
The platforms have several elements that are repeated according to the size of the station that we place during the game.
The stations are made up of an initial section (cap), an intermediate section and a final section. This also applies to the central platforms. It can also include have decorations such as benches, lampposts, posters or cranes that are repeated throughout the entire platform.
- Height: Maximum station height. This value prevent building other elements at height lower than this above station.
- RailUri: Path of the
.railasset used in the station.
- EdgePlatform (Array): This section define the different elements of the side platforms of the station. The platforms are divided in four parts, start cap section, middle section, end cap section and decorations. Each element is specified in the parameters Mesh, Cap1Mesh, Cap2Mesh and the subsection Decorations.
- IslandPlatform: The platform island elements are the same as edge platform section but this time all elements are setup to create the central platform of the stations if there are two or more tracks.
- MinWidth: Minimum number of tracks of the station.
- MaxWidth: Maximum number of tracks of the station.
- DefaultWidth: Default truck number when the station is selected from the station building menu the first time.
- MinLength: Minimum possible platform length measurement in voxels.
- MaxLength: Maximum possible platform length measurement in voxels.
- DefaultLength: Default platform length when the station is selected from the station building menu the first time.
- ResearchUri: Path of the
.researchasset that unlocks the station.
- Price: Price of each section of the station. (The price can change depending om the length and number of platforms of the station).
- RunningCosts: Maintenance costs of the station. If set to null, the game automatically calculates the costs.
- Hidden: This parameter tells the game if the station is visible or not in the station building menu.
Train depot (
The train depot is where the trains are purchased in the game. It�s menu will show all available trains. Trains can use any type of track and have no restriction when using it. This means that in most cases, we will have to create specific trains for specific track type of road if we want them to appear visually correct.
- Rails (Array): This section specifies the track type, the section type, the track position and some other parameters.
- SpawnConnectionIndex: It defines at what end of rail (there's two for regular straigt rail) the train should spawn. So it's set to some value (0) for the rails in depot and nulls for other rails in the depot.
- Uri: Path of the
.railasset used to place the track in the depot.
- RailType: Type of mesh used in this track section. The possible rail type can be Straight or StraightCap.
- Position: Position of the rail based in a grid. It follows the same rules of conveyors placement in the devices.
- Rotation: Rail rotation. The possible values are: Rotate0, Rotate90, Rotate180 and Rotate270. The rotation must always be Rotate0 because the depot (in most cases) only has one track along the length of the building.
- Handle: This parameter sets whether or not it is possible to connect a track at this point of the depot, to the rest of the world. This parameter will be true if is the end section of the track of the depot.
- DisallowSignals: This parameter prevents placing signals on this track section. If it's the end section of track, the value is false.
- ClippingPlanes (Array): The clipping plane is an element that is placed at the entrance of the depot and creates a darkening effect.
- MeshUri: Path of the mesh file.
- Position: Position of the clipping plane in X,Y,Z axis.
- Rotation: Rotation of the clipping plane in X,Y,Z axis.
- Scale: Scale determines the size of the clipping plane in X,Y,Z axis.
- ResearchUri: Path of the
.researchasset that unlock the depot.
- Size: Size of the building in X,Y, Z axis.
- Liveries (Array): This section contains the building mesh and all night lights variations.
- MeshUri: Building .obj file mesh.
- MeshVariant (Array): If there are night variants for the windows, this sectiondefines them. Learn more about how to configure the night windows effect in the guide: Creating your first building mod.
- Lights (Array): You can add two type of lights, point lights and spotlights. These lights don't cast shadows.
- Type: The lights can be point light (Point) or spotlights (Spotlight).
- Color: Hexadecimal value of the light color.
- Position: Light position in X, Y, Z axis.
- Range: Light radius in meters.
- Intensity: Light intensity. The default value is 1.0. Values above 1 make the light more bright, and below 1 less intense.
- SpotAngle: If the lights is a spotlight, this parameter specify the direction of the light in degrees.
- Price: Price of the building.
- RunningCosts: Maintenance cost of the building.
- Hidden: This parameter tells the game if the depot is visible or not in the depot building menu.
Currently, there are two types of signals; chain signals and pre-signals.
Depending on the needs of the railway network, we must place one type or another.
The configuration of the signals is very simple because it only depends on either two different meshes or three in the case of pre-signals. The first mesh (
.obj file) is for the green signal state and the second mesh is for the red signal state. If the signal is of the pre-signal type, the second mesh corresponds to the amber state of the signal.
- MeshUris (Array): In this section all the meshes for the signal states are listed. For now you can't animate signals between states.
- Price: Signal price.
- ResearchUri: Path of the
.researchasset that unlock the signal.
Bridges are used to overcome obstacles, such as roads and other train tracks.
Depending on the type of bridge, it may have different span between pillars, which makes its use conditioned by the surrounding environment.
The other restriction that we can configure is the maximum height of the bridge. Depending on the type of bridge we are creating, the pillars can have an upper part, a middle part and a base part.
- SpanMeshUri: Main mesh of the bridge. Specifies the path of the .obj file that forms the main section of the bridge.
- SpanLength: Length in voxels of the central section of the bridge. It determines the length of the spacing between pillars.
- SpanHeight: Height of the main section of the bridge. Bridges must be a minimum of three voxels high to be built over a track or road.
- MinHeight: Minimum bridge height.
- MaxHeight: Maximum bridge height. It prevents building something above the bridge if the height is less than that specified.
- DefaultHeight: Default height at which the bridge will be built.
- LofterIngredients (Array): Bridge section that is generated in case the length is less than that indicated in the SpanLenght parameter.
- PierBottomMeshUri: Mesh used on top of bridge pillar. If the value is null it will not be used in the bridge.
- PierMeshUri: Mesh used on middle part of bridge pillar. If the value is null it will not be used in the bridge.
- PierTopMeshUri: Mesh used on the bottom of bridge pillar. If the value is null it will not be used in the bridge.
- PierOffset: Sets the value of pillar offset.
- ResearchUri: Path of the
.researchasset that unlock the bridge.
Tunnels general have a common appearance across all types of rails, the only difference being the entrance that can be customized to better suit the style we want to give it.
The tunnels are made up of three different meshes, the outer facade, the inner facade and the inner walls of the tunnel.
The tunnels allowed us to overcome obstacles such as other tracks or roads. For now only the construction of straight tunnels is allowed. In the future its planned that the tunnels will have curves to be able to build underground systems.
- MeshUri: Path of the mesh of the interior walls of the tunnel. This object will be extruded along the entire length of the tunnel.
- InCapMeshUri: Path of the mesh used for the inner tunnel facade.
- OutCapMeshUri: Path of the mesh used for the outter tunnel facade.
- MinDepth: Minimum depth at which the tunnel can be built. A value of 0 means it's ground level.
- MaxDepth: Maximum depth that the tunnel can have measured in voxels.
- DefaultDepth: Default depth at which the tunnel is built. By default the value is 3.
- ResearchUri: Path of the
.researchasset that unlocks the tunnel.
- Price: Tunnel price per section.
- RunningCosts: Tunnel maintenance cost. By default the value is null.
- Hidden: Specifies if the tunnel is visible in the tunnel build menu.