Carspawners - their care and feeding
by Yuri Sos

Contributions by Lukas "Swissie" Lusser and Mike Simpson
Angled level crossing fix by Jeffrey Kraus-Yao


A car spawner is a marker item that can be placed along roads in MSTS to simulate road traffic.

Car spawners consist of three components:

  1. the characteristic blue pyramids and lines that are placed on roads in the Route Editor (RE),
  2. the various car and truck shapes you wish to appear, and
  3. a file called carspawn.dat located in your route's top folder.


Placement of the Car Spawner

To place a car spawner, you must first have laid down your roads. Assuming you've done this, press [F5] (Placement) | More | scroll down to "Vehicles", click and select "Car Spawner:

Move the cursor (white cross) onto the road and click: two blue pyramids will appear:

If you miss and don't click on the road, you will receive this error message and will have to reselect the car spawner from the Object Selector:

Press [F2] to modify, then mouse over one of the blue pyramids till it turns black,

then click on it to highlight it,

press [F3] or the <--> icon, and drag the pyramid along the road as far as you like

(generally said to be a maximum of 2km, but some people have reported carspawners as long as 3.6km).

Note that the blue strobe flashes move along the road IN THE OPPOSITE direction to the flow of traffic. To reverse the flow of traffic, simply drag one pyramid through the other pyramid: the pyramids (and the blue strobe) will reverse and you can then select either pyramid to lengthen your spawner.

This is how the finished car spawner looks in the Route Editor (RE):

One last tip: try to position the start/end pyramids behind a hill, trees or structure as the vehicles just pop up in the World as they are spawned.

Now that we've placed the car spawner, it's time to turn our attention to the vehicles that will be used by the spawner.


Vehicles Used in Car Spawners

If you open the carspawn.dat file of any default route you will find a list of shape files within it.

These are the default vehicle shapes:

  • Europe1 and Europe2: c_car.s, c_van.s, ukbus.s
  • Japan1 and Japan2: Jp1Car01.s, Jp1Car2.s, Jp1moped.s, Jp1van.s, Jp1van2.s
  • USA1 and USA2: car1.s, car2.s, car4.s, policePHIL.S, truck1.s, van_1.s, US2Pickup.s

In addition, files libraries such as those hosted by and have many more vehicle shapes you can use.

To use these vehicles, place the .s and .sd files in the SHAPES folder of your route and the model's ACE files into the TEXTURES folder. You DON'T need a .REF file entry (unless you want to use the vehicles as static models as well).

You then list the model in the carspawn.dat in the form

CarSpawnerItem( "shapefilename.s" separation_distance ) where


Hints for Building Models for Car Spawners

When building the model, its axis should be at ground level, and 180 degrees opposite to a locomotive (ie it will face right, not left when opened in Shape Viewer).

Lights, animation and alternative textures are not supported, but you can fake lights using alphabright textures: for example, this is USA1's car1.s by day and by night:

car_sp_15.jpg - 19kb

Some models downloaded from the various web libraries may run backwards (this happens if an author occasionally builds them facing the same way as a locomotive). If this occurs, simply use ShapeFileManager to reverse the model.


Structure of the carspawn.dat file

The typical carspawn.dat looks something like this

CarSpawnerItem( "Jp1Car01.s" 4 )
CarSpawnerItem( "Jp1Car2.s" 4 )
CarSpawnerItem( "Jp1moped.s" 4 )
CarSpawnerItem( "Jp1van.s" 6 )
CarSpawnerItem( "Jp1van2.s" 6 )
CarSpawnerItem( "Jp1van2.s" 6 )

<---Standard Unicode MSTS header
<---Total Number of CarSpawnerItems
<---CarSpawnerItem( "shapefilename.s" separation_distance )
<---CarSpawnerItem( "shapefilename.s" separation_distance )
<---CarSpawnerItem( "shapefilename.s" separation_distance )
<---CarSpawnerItem( "shapefilename.s" separation_distance )
<---CarSpawnerItem( "shapefilename.s" separation_distance )
<---Repeat 2nd last CarSpawnerItem here or it won't appear
<---Unmatched single closing bracket

You can also place a comment after the separation_distance parameter, thus....

CarSpawnerItem( "ES250-2.s" 4 # Triumph motorbike )
CarSpawnerItem( "PG_203P.s" 7 # Peugot 203 )
CarSpawnerItem( "car4.s" 7 )
CarSpawnerItem( "kk_transp.s" 16 # VW Kombi blue )

....without affecting the functionality of the spawner.dat file.


Increasing Traffic

  1. Variety

    The number of cars you specify in your carspawner.dat file in the route main folder has nothing to do with how often the vehicles appear, but is a list of what will appear, and if you list some cars more than once, a 'weighting' towards certain vehicles being randomly generated more than others.

    You can increase or skew the variety of traffic in your car spawner by

    • duplicating the shapes you want more of to appear, or
    • adding more shapes that you've created, copied from other routes or downloaded from the .Net.

    Remember to duplicate the last entry and be sure to increment the number at the top of the .dat file to reflect the total number of CarSpawnerItems.

  2. Volume

    To adjust the volume of traffic in a car spawner, press [F2] (Modify) and right-click on one of the pyramids: the following dialogue box will appear:

    Make your changes (obviously the shorter the time the more frequently the cars will be spawned) and click "Ok".

    Remember that the car spawner is a fairly random generator of vehicles: these images below demonstrate the range of traffic at one location over about a minute:

  3. Speed

    The speed is set at the same time as the frequency of spawning: the speed you set is an average and there will be a random speed differential. Watching the vehicles on the sim, they seem to behave quite well.


Why can't I see my cars in the sim?

There are several reasons why the carspawner might not show up in MSTS:

  1. Make sure you have the appropriate graphics sliders fully to the right in the MSTS Options settings: A World Objects Density setting below "8" means the cars do not appear;

  2. Make sure your carspawn.dat file is in your new Route's root folder;
  3. Assuming it is there
    • It must be in Unicode format;
    • Each entry line must be in the correct format i.e.
      CarSpawnerItem ( "JaguarEtype.s" 5 );
    • The number of items must be displayed on the first text line e.g. 25. This number must be one greater than the number of CarSpawnerItems;
    • Make sure there is a single closing (and un-matched) bracket ending the carspawn.dat file.
  4. Make sure your car spawner in your route is placed correctly, with a blue pyramid at each end of a section of road with a blue line connecting them. The cars move in the opposite direction to the apparent movement of the blue strobe marks;
  5. If you are not sure about your carspawn.dat file, copy one from the default routes as a test and see if that appears in your route. If that works then your .dat file is wrong.


How can I stop cars driving through the booms at angled level crossings?

The problem is that the cars stop their separation distance away from the track (or more precisely away from the orange cube on the tracks that marks the presence of a level crossing): like this.......

Jeffrey Kraus-Yao has been studying the structure of the track and road database files and discovered a simple solution to the problem of keeping cars back from an angled level crossing. This solution replaces the previous way of treating this problem first presented by Bruce Bridges in his Conrail Indy route v.1. You can find Bruce's solution by reading Carspawners and Angled Level Crossings - The Old Way.

Place your level crossing as you normally do in Route Editor (RE). In this image, I've placed the level crossing, but have depressed the booms below ground level as this crossing didn't have them:

This is what this crossing looks like in the sim:

However, I want the cars to stop at the level crossing signs.

When you've placed the level crossing, press [F2], click on the orange box - it turns wireframe, then right-click and record the "x" and "z" dimensions as well as the tile you're on (see arrows in image below):

Do this for both orange boxes. Then save your changes and quit Route Editor.

Open the route's .RDB file and search for your placed level crossing. In the following examples, I'll show you only one correction, but you'll obviously have to do it for both "orange boxes". Here I've searched for and found LevelCrItem located on the correct tile (1391+10352) and at the correct location (x=530.755, z=799.586); you can ignore the slight differences from the locations you've recorded (eg 799.38 in the RE and 799.58 in the RDB is a 20cm/8" variation - hardly significant).

You can alter the distance the cars stop from the track (orange box, actually) by adjusting the first figure in the TrItemSData line: in this example

TrItemSData ( 1274.39 00000005 )

Open the sim, start an "explore" that takes you to the crossing: you may want to make a small path that starts at/near the crossing to speed up this process as the changes you make to the RDB are reflected as soon as you restart the activity. So adjust, start the explore, watch the cars, adjust/save the RDB, quit the explore and immediately restart to see the effect of the changes (it's actually quicker to do than it was for me to type this paragraph).

First, I added 20m to the number, making it 1294.39, thus.....

....saved the RDB, then tried out the crossing. Oops! The red car (coming towards the camera) is the lead car and has now stopped over the crossing.

Well, let's go the other way. I subtracted 20m from the original 1274.39, making the value 1254.39, save the RDB and looked at the result in the sim. Much, much better - we're very close now.

The final adjustment actually turned out to be 1250m. I then did a similar series of adjustments to the TrItemSData in the LevelCrItem for the other side and this was the final result:

This method is so much easier and quicker than placing extra tracks in parallel, plus there are no "issues" with extra bits of track and possible track database problems. It also means that crossings of up to four tracks wide can be adjusted this way (level crossing items only stretch across a maximum of four tracks). Having performed both methods for these tutorials, this new method is 20-30 minutes faster per crossing than the old extra track method. Thanks to Jeff Kraus-Yao for discovering this RDB tweak.


How can I increase the average speed of traffic on my car spawners?

Let's say you have some areas where there are freeways and you want the cars to move faster than 70km/h (45 mph).

The default average speed for car spawners is 70km/h (20m/sec) when you set them up in the Route Editor. You can set it as high as you like, but the RE drops it back to 25m/sec.

To increase the maximum speed, you will need to directly edit and alter the appropriate World file (this tip contributed by Joseph Realmuto).

Start by using Route Editor to establish which car spawner you wish to alter. The position in the World parameter refers to the middle of the car spawner. It might be easier to change the speed of the Car Spawner (right-click on blue pyramid) to something unique (like 7.99m/sec in this example), save the route, then open the World file and look for 7.99.

Altering default speed

Once you've found your spawner, you can alter the CarAvSpeed ( 7.99 ) line to the speed you require: note that the parameter you are altering is in m/sec, so here's a table to help you decide the average speed you require:

m/sec km/hr mph
5 18 11
6.71 24 15
8.90 32 20
10 36 22
11.18 40 25
13.41 48 30
15 54 33
15.65 56 35
17.88 65 40
20 72 44
20.12 72.5 45
22.35 80 50
25 90 55
30 108 67
35 126 78
40 144 90
45 160 100