Railway System with Intercity Train
This pack contains everything you need to quickly set up working realistic railroad in your level.
Fully functioning railway can be created in 5 minutes.
Railway System with Intercity Train .............................................................................................................................1
BP_Train........................................................................................................................................................................3
BP_Track .......................................................................................................................................................................6
BP_Platform ..................................................................................................................................................................9
BP_Tunnel ...................................................................................................................................................................11
BP_Crossing ................................................................................................................................................................13
BP_Bridge ...................................................................................................................................................................14
BP_Rail_Joint ..............................................................................................................................................................17
BP_Switch ...................................................................................................................................................................18
Signal Lights ................................................................................................................................................................19
BP_Train_Controller ...................................................................................................................................................20
BP_Whistle_Post ........................................................................................................................................................22
World building tips .....................................................................................................................................................23
Sequencer ...................................................................................................................................................................24
Multiplayer .................................................................................................................................................................25
Replacing Train with custom model ...........................................................................................................................26
Demo Map ..................................................................................................................................................................27
System’s usage varies widely.
It can be simple railway line with trains for background of your game. No interior, optimized collision. Minimum
performance impact.
It can be complex railway with lot of Trains which stop at Platform where player can enter Train and ride it.
Works perfectly with both static and dynamic lighting.
All meshes geometry, collisions, LODs; blueprints are optimized for minimum performance impact.
Limitations:
Interior doors between cars and to Driver’s cabin do not open.
Train can seamlessly change Tracks only if they are overlapping for some length (see BP_Switch description).
Auto Snap to closest Track feature may not work in packaged game when using sublevels. Disable Auto Snap
when Railway System is in sublevel.
Editing long Tracks in UE5.1+ may be slow. Use Spline Editing Mode to quickly edit Track Spline.
BP_Train
Customizable Intercity Train. Can be used standalone or on Track. In standalone mode all cars will be arranged in
straight line and Train will not move.
If Train is on Track, Train will always try to maintain specified Max Speed while moving along Track. When there is
a need to stop at Platform or Track End, Train will gradually slow down with specified Deceleration/Acceleration
Rate and stop for specified time. Doors will be opened at Platform for specified time. After that, Train will
accelerate until it reaches Max Speed.
BP_Train is made with performance in mind. To optimize more, try to disable unneeded features: disable Interior
or Interior Collision, Headlight Beam, Sound, Pawn Mover. You can enable Static Train (from another blueprints)
when Train is out of sight.
Train can be either electric or diesel. It depends on Track used. Roof equipment and engine sound depend on this.
Train Interior. Can be disabled (windows become opaque). Interior lights are baked in emissive of Interior and
Passengers. Interior is walkable. You may need to reduce character capsule radius to 28 and half height to 90 to
walk inside comfortly.
Train can be controlled at runtime. Change variables that affect train movement. For example, MaxSpeed, Sound
Volumes, Stop At Platforms, Static Train
BP_Train has Change Track function.
This function changes current BP_Track. Train immediately teleports to closest point of new Track and continues
movement. BP_Crossings on both old and new BP_Tracks are updated with new Train list.
This function can be executed from level BP or other BPs according to your needs.
If you want smooth transition to another Track (like railway switch), best way to do this is to make two track
overlap. Overlap should be slightly longer than Train length (see BP_Switch description).
Reverse Direction – Train will be oriented and start moving in another
direction.
Is Electric – determines roof equipment and engine sound. If Train has
BP_Track picked, this value will be inherited from Track.
Show next Platform name on Destination Sign – updates destination
signs with next Platform name when Train departs.
Track Ending Behavior – this is what Train should do at end of Track.
Stop and Reverse, Immediate Reverse, Teleport to another End.
Pawn Mover – creates a Box Collision in front of first Car. When
collided with Pawn, Train will move Pawn from its way. Use for non-
physics enabled Pawns (like default characters)
Auto Snap – Train will search for closest Track or closest position on
selected Track. Uncheck and you will be able to pick Track and set
Start Position manually.
Interior – Adds interior meshes. Disable to save some polygons.
Windows will become opaque; interior and people meshes will not be
generated. Doors will not open if disabled.
Interior Light Intensity – Emissive intensity. Lighting inside train
(including Passengers) is baked and imitated with Emission. Interior
uses no light sources but looks perfect at night. You can set Intensity to
0 at day scenes.
Passengers, Driver – add highly optimized people meshes with baked
lighting
Interior Collision – Enable if you want your character to move inside train.
Headlight Beam – high-intensity Spot Light source.
Lights Emissive Intensity – Emissive intensity of lights. Headlight will
have x2 intensity.
Colors – select one of 3 liveries and adjust 5 body colors.
Sound – Enable/disable/adjust volume of sounds: Wheel, Engine, Braking,
Horn.
Stop at Platforms – Train will ignore all Platforms when unchecked
Static Train – Train will not move. No speed calculations.
Max Speed (km/h) – Train will try to reach this speed if there is
enough distance before next stop.
Deceleration/Acceleration Rate – cm/s2, about 110 for normal
braking, 200 for emergency braking. Use higher values for faster
starts/stops.
Wheel Rotation Speed – Use this variable to reduce wheel motion
blur. 1=normal speed, 0=stop rotation.
Starting Speed (multiplier of Max Speed) – Train will begin movement
with this speed
BP_Track
Allows fast creation of customizable Railroad Track. Gauge is 1435 mm (standard gauge). Track creation is based
on user configurable Spline. Select points, Alt+mouse drag to add new points. Just like all Splines in UE4.
Track meshes have custom LODs for maximum performance.
Sleepers can be wooden or concrete. Track can be dirty or clean. Gravel tint can be changed.
In real world, tracks cannot have small curve radiuses. To achieve this, don’t put spline points to dense. No need
to put points closer than 200 m.
100+ km Double Track tested and works perfectly.
Recommended Track creation workflow (with use of Align to Terrain)
1. (optional) Add BP_Track in Spline Editing Mode, create
approximate layout of your future track.
2. Add Landscape Splines to places where your Track must be
lower or higher than terrain. Set Half-Width to 500m (1000
for Double Track). Try to make smooth splines, do not put
Landscape Spline points too dense. You can also use
Landscape Ramps.
3. Deform Landscape to Splines
4. Add BP_Bridges where needed
5. Use existing BP_Track or add new.
Now you can enable Align to Terrain. Refine Spline if needed.
6. Make sure BP_Track Spline is at ground level near future Tunnel Portals.
7. Add BP_Tunnels where needed. Paint Landscape visibility. After this Aligning to Terrain should work fine
if you use it.
8. Add Platforms, Crossings, other meshes.
9. If you change Landscape, check Update in BP_Track to re-align
10. If you change Track shape at some place, check Update in all affected Crossings, Platforms or Tunnels.
Recommended Track creation workflow (with Deform Landscape button)
1. Add BP_Track and position spline exactly where you need railroad to be
2. If you want to preserve terrain above Tunnels, try disabling Lower heights
3. Pick Landscape to Deform and click Deform Landscape. Now Landscape is
conformed to Track
4. Put BP_Bridges where needed. Use Landscape tools (Flatten or Ramp) to remove landscape under Bridge
5. Make sure BP_Track Spline is at ground level near future Tunnel Portals.
6. Add BP_Tunnels where needed. Paint Landscape visibility.
7. Add Platforms, Crossings, other meshes.
8. If you change Track shape at some place, check Update in all affected Crossings, Platforms or Tunnels.
You can combine both workflows (Deforming Landscape and then Aligning to Terrain) if needed.
Spline Editing Mode – meshes will not be generated. When Track gets long,
spline updates become slow. Adding spline meshes is heaviest part of
construction script. To quickly move spline points, enable this mode.
Closed Loop – connect Track ends. No need to closely match Track ends, they will
connect smoothly at any distance.
Rail Top Height – height of Rail Top above spline (or ground when aligned to
Terrain). Other blueprints adapt to this value.
Track Length (m) – read only value for your information.
Double Track – two parallel tracks with defined Spacing. Other blueprints will
adapt to this Spacing.
Auto Update Trains on this Track – train positions will be automatically updated
(use for minor changes in Track shape).
Dead End – Add Dead_End meshes (only when Closed
Loop=false).
Deform Landscape – click to deform Landscape to Track spline. This is the easiest
and fastest way to conform landscape to Track. Disable Align to Terrain and pick
Landscape to Deform.
Wooden Track – wooden sleepers instead of concrete.
Dirtiness – Make Track and Electrification Masts look dirty.
Gravel Tint – color of track gravel.
Electrified Track – put Masts and Wires with specified Spacing.
Update – update Track. Use it to align to changed terrain.
Align To Terrain – Divides spline to segments (based on Trace Distance variable) and aligns each point to ground
or other objects (e.g. bridges). If no objects with collision found within specified Height range, Track remains at
initial height. In Tunnels there is nothing to align to, so Track should remain built along user configurable spline.
Actors To Ignore – Pick Actors to be ignored when aligning. For example, water plane under terrain or some
objects near Track. All Tunnels, Crossings, Tracks, Trains, Platforms are automatically ignored. There is no need to
add Actors if Track aligns well.
Spline Points – Just ignore this! This array is used to store backup spline data. Problem is UE4 runs Construction Scripts in random
order and sometimes twice. First time can be before landscape is loaded. This messes up other BP positions and built lighting. To fix this,
BP_Track recovers correct spline data from here. When AlignToTerrail is successful, BP_Track records Splines here. This only applies when
Align To Terrain=true. Only way to pass Splines between several Construction Script runs is to store point data in exposed variable arrays.
BP_Platform
Platfroms can be created along Track only. Platform automatically searches for closest Track and builds along it.
Platform is a place for Trains to stop. Also Trains can change direction here.
Tiles, Fence, Shelter materials are customizable.
Update – use this to re-build Platform when Track was changed.
Opposite Side – place Platform on opposite side of tracks (Single Track
only).
Tiles Color – Platform tiles tint.
Pedestrian Crossing
Trains Stop Here – Trains will ignore this Platform if unchecked.
Turn around here – Trains will change direction here.
Name – give Platform a name. It will be shown on Platform Name Sign
and on Train Destination Signs.
Additional Meshes can be added: Shelter, Fence, Seating, Garbage Can.
Shelter Lights – adds Spot Lights to Shelters
BP_Tunnel
When placed to scene, BP_Tunnel will search for closest Track. After that, first portal will be placed in closest
place on Track, and Tunnel with needed Length will be constructed along Track.
Tunnel can be Single or Double track. It depends on selected Track.
BP_Tunnel cannot work without BP_Track. But you can use included meshes to easily build straight tunnels in few
seconds.
Update – use this to re-build Tunnel when Track was
changed
Length (m) – Tunnel length in meters. It is limited by
ends of Track
Reverse Tunnel Direction – Tunnel will be built in
opposite direction from pivot
Lights Emissive – Tunnel lights strength. If you use
baked lighting, this lights will be baked in Tunnel. No
other light sources included in blueprint.
Block Entrance – Create Blocking volumes at Tunnel Portals so Player cannot enter Tunnel
Blocking box offset inwards (m) – Offsets blocking box so Player can go into Tunnel for several meters
Portals Long Scaling – make Portals longer so they can be easily fitted to landscape
If you use Track’s Align to Terrain feature, try to put Track’s Spline at ground level near Tunnel Portals, because
Track has nowhere to align in Tunnel (no Landscape, and Track do not align to Tunnels).
Don’t forget to paint Landscape visibility in Portals to make Landscape invisible here.
It’s good idea to place Reflection Capture in the middle of Tunnel. Set Influence Radius to cover whole Tunnel.
BP_Crossing
When placed to scene, BP_Crossing will search for closest point on closest Track and appear there.
Railroad Crossing can operate in both Automatic and Manual mode. This means events Open Crossing and Close
Crossing will be fired automatically based on Trains movement or manually from another blueprints.
These events will switch Crossing lights and sounds, move Gates (Gate movement is physics based, your car (or
character) can stop Gate from lowering or break Gate).
Event Dispatchers: Crossing Starts to Close, Crossing Starts to Open.
Update – use this to re-build Crossing when Track was
changed
Gate Position – adjusts position of both signal masts
Crossing Width (m) – width of rubber crossing mesh
Crossing Height – adjust height position of rubber crossing
mesh
Crossing Gates – should Gates be generated
Is Closed – Crossing will be closed at BeginPlay (Manual
mode only)
Delay Before Closing Gate – Time (seconds) between Close
Crossing event and start of Gate lowering. Lights and sound
begin to work immediately.
Automatic mode – each one second blueprint will monitor
train movement and Close/Open Crossing when needed
Time Before Train For Closure – Time in seconds before first car gets to Crossing
Time after Train for Opening – Time in seconds after last car leaves Crossing
BP_Bridge
Create various bridges with unlimited length. BP_Bridge can be used standalone in any project without Railway.
Bridge Length, Bridge Width (m) – dimensions in meters.
Bridge Height – scale bridge beams to be taller or lower.
Truss Bridge A/B – two Truss types or Beam bridge.
Top – add top beams to Truss bridge.
Two Support Types
BP_Bridge can add BP_Rail_Joint for realistic brigde sound.
Metal and Support materials:
Use SM_Bridge_Mast_Support in case you have electrified Track and Masts are outside your bridge
You can use landscape Ramps to make smooth transition from Landscape to Bridge.
It’s recommended to firstly add Bridge and set dimensions, then adjust Landscape to fit Bridge. Change Abutment
Offset so Abutments fit Landscape perfectly.
BP_Rail_Joint
Drag and drop this blueprint on your railway track.
Now each time Wheel overlaps blueprint, it will play Rail Joint sound. Volume and pitch depend on Train speed.
Only one parameter, Volume Multiplier is available.
BP_Switch
BP_Switch changes track of any Train touching BP_Switch. It simply executes BP_Train Change Track function.
Track is changed immediately. Train teleports to nearest point of selected Track.
If you want smooth transition to another Track (like railway switch), best way to do this is to make two track
overlap. Overlap should be slightly longer than Train length.
Active – is Switch functioning
Track To Change To – Train will be teleported to this Track. If
Track is not selected Switch will not function.
Event Dispatchers: Train changed Track.
Signal Lights
Two static Meshes with customizable Material Instances.
Three custom colors, intensities. Can flash. Can be a bit darker when viewed from side.
Signal Lights don’t affect Train movement.
BP_Train_Controller
BP_Train_Controller is a Pawn blueprint. It connects to one of Trains in level and allows you to drive Train.
Usage:
1. Add BP_Train to scene and set all variables as usual. Pay attention to variables from Speed category, they
are used for drivable Train too.
2. Add BP_Train_Controller to scene
3. In BP_Train_Controller details pick a Train you want to drive. You may want to set other variables
4. Enable BP_Train_Controller Auto Possess Player to Player 0 (or make possession through some
blueprint)
5. Play!
When connected to BP_Train_Controller, BP_Train will start with its Starting Speed but will try to maintain speed
calculated in Controller: Target Speed x Train’s Max Speed.
Target Speed can be negative for reversing.
Train will ignore Platforms. Train will handle End of Track as usual.
If you want to change the way Train Speed is controlled (e. g. control through Throttle and Brake amount), you
can do it in Calculate Speed function.
Inputs:
W/Num+ – increase Target Speed; S/Num- – decrease Target Speed; A/Num0 – set Target Speed to 0.
C – switch between interior/exterior camera; Mouse – rotate external camera; MouseWheel – zoom.
<, > – open right or left doors; / – close doors. Only one side can be opened simultaneously.
PgUp/PgDown – change Car to follow
H – horn (Horn on BP_Train must be enabled)
All inputs can be changed in Inputs section of EventGraph
Train – select existing BP_Train to make it drivable. BP will not work if no Train is selected.
Update – click to update BP_Train_Controller if Train changed location in editor
Car to Follow – External camera will follow specific car (PgUp/PgDown to change in game)
Target Speed – Multiplier of Max Speed (-1 to 1). Change in game with W/S/Num+/-
Speed Change Step – Target Speed step
Print String HUD – Simple HUD for debug purposes. Shows Target and Current speeds.
Inner Camera Position Offset – change position of Interior Camera.
Ignore BP_Whistle_Post – Train will not automatically honk when overlaps BP_Whistle_Post
BP_Whistle_Post
Drag and drop this blueprint on your railway track.
Now each time Train overlaps blueprint, Train will use horn for random time in range
Train must have Horn enabled to use this feature
You can place several BP_Whistle_Posts in row to make Train horn a sound pattern
World building tips
Creating Railroad switches
Put new Track next to existing one. If Align To Terrain is enabled in both Tracks, they will be at same height. You
may lower secondary Track by 1-2 cm by lowering Rail Top Height value. For nice sound effect, put two
BP_Rail_Joints: one near switch, and one (with twice lower Volume) where rails intersect.
Sometimes Train’s cars can become separated and move relative to each other in case of Single Track without
Align To Terrain. This is due to uneven spline points spacing and UE4 bad position on spline calculations. Enabling
Align To Terrain divides Spline by even sections and solves problem.
Multiple Trains on one BP_Track
Trains move independently of each other. If you want to use many trains on one single Track, it’s good idea to set
identical Speed and Timing settings so Train wouldn’t run into each other. Number of Trains is unlimited.
BP_Crossing will recognize all Trains on current BP_Track.
Sequencer
Train movement can be specified in Sequencer. You can keyframe Position of Train to precisely control Train
movement.
Create Train as usual. Select and add it to Sequencer.
Add Track – Event – Repeater
Bind Move Train from Sequencer event to this new track. Director blueprint may open. Close it.
Enable Call in Editor for this track
Add new Track: Position
Add new keyframe for current position.
Now you can add additional keyframes. To set desired position, you need to
change number shown on track. Drag number with left mouse button and you
will immediately see Train moved to new position.
Now you are ready to animate Train along track any way you want!
Multiplayer
Multiplayer is supported. When connected to game, all client Trains synchronize their Position and Current Speed
with server Trains.
After initial synchronization, Train movement is no longer synchronized during game. Tests show that Trains on
client and server continue to move synchronously thanks to identical speed and timing parameters. But you have
to check if this synchronization persists in your game and if initial synchronization is enough.
BP_Train_Controller also supports Multiplayer.
Replacing Train with custom model
Easiest way to add your train car meshes is to make them like original meshes.
1. Take a look into Railway_System\Meshes\Intercity_Train folder. These are static meshes used in
BP_Train.
2. Prepare your custom meshes: Bogie, Wheel, Cars, Door. Optionally make Interior meshes.
3. Make sure new meshes have correct Pivots and Sockets (like in original meshes).
4. Open BP_Train. Select Add Static Mesh Component nodes and change static mesh to new mesh:
• Construction Script – Add Bogies: Bogie (1) and Wheel (2) nodes
• Construction Script – Add Cars: Power Car (2) and Intermediate Car (1)
• Add Interior and set Lights – Add Interior Meshes: Interior (2)
• Add Interior and set Lights – Add Passenger Meshes: Passengers (2), Driver (1)
• Add Roof Equipment: – Roof Equipment (2) (or remove these nodes if equipment meshes are not
needed)
5. Set Bogie Spacing variables (4) to match your train
dimensions
Demo Map
Demo Map is included with product.
If you see "LANDSCAPE: PHYSICAL MATERIAL NEEDS TO BE REBUILT" message go to Build - Build All Landscape to
get rid of it (UE5.2).
If you want to play First Person Character and Third Person Character, download input file
https://drive.google.com/file/d/1hDE_PVkosdU4J6NHmm9xC6S-aNSd2JE0/view?usp=drive_link
Then go to Project Settings - Input and import this file. This is needed for Demo Map characters only.
Also you may need to rebuild your lighting in UE5.0+.
Or you may want to switch DemoMap to Lumen lighting (so you will not wait long for light build):
Select SkyLight, enable Real Time Carture and make it Movable. Enable Force No Precomputed Lighting in World
Settings.
Grass and rocks from downloadable demo are not included with product.