Australian MSTS @ steam4me Tutorials Carspawners - their care and feeding

Carspawners - their care and feeding

by Yuri Sos

Contributions by Lukas "Swissie" Lusser and Mike Simpson

Table Of Contents

INTRODUCTION

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 www.train-sim.com and www.uktrainsim.com 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

  • shapefilename.s is the name of the shape file and
  • separation_distance is a numerical value in metres that corresponds to the separation maintained in front of the origin of the model vehicle relative to the vehicle or level crossing in front of it. This value should be the length of the vehicle (get that by opening the model in Shape Viewer, pressing Ctrl-C and taking the "length" value) plus 2-3 metres. This value cannot be less than 2 or MSTS crashes as soon as you try to load the route.

    Special Note: whilst most models have their origin at the centre of the model, truck1.s from USA1/USA2 is a special case and most following vehicles will run underneath it. This is because its origin is 0.8m from the front and 9.6m from the rear (total length 10.5m) so unless every other model has a separation_distance of more than 11m, you will appear to have rear-end accidents invloving truck1 at every level crossing.


    It's probably best to exclude truck1 from your car spawner and replace it with one of the many truck shapes available at train-sim.com or uktrainsim.com.

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


SIMISA@@@@@@@@@@JINX0v1t______
 
6
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 - MSTS buglet!
<---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
    • a. 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.......


The clever solution was first used by Bruce Bridges in his Conrail Indy route v.1.

Open the Route Editor and place two pieces of straight track parallel to and on either side of the level crossing: here I've used a couple of 30m straight pieces:

Place two pieces of track

Select and delete the old crossings:

delete crossing gates

Now place the crossings anew (as shown below, both with road visible and made invisible to demonstrate where they sit):

Place crossing gates
Place crossing gates

Finally select each piece of track and depress it below the terrain: you should end up with this:

Depress tracks

Save and quit and try out the crossing in the sim: as you can see, we've almost got it right - but one car still has managed to stop within the booms:

Place crossing gates

Back into Route Editor: with experimentation, you'll find that there is a limit to how far from the first track the extra track can be placed: when you place the crossing gates, you'll find that the orange cubes don't extend from track to track. However, this is not a problem as there is no reason why you can't successfully place a double track piece to stop the cars even further away.

The image below demonstrates the use of a double track to extend the "no-go" zone further away from the crossing as well as the fact that the orange cubes of the emplaced crossing gates have a limit as to how far they will jump to another: it doesn't really matter that the orange cubes are not on the end (dummy) tracks as they are on the trailing side of the crossing as far as the road traffic is concerned.

Place crossing gates
Place crossing gates

And here is the final result in the sim:

Place crossing gates


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:

20m/sec = 72km/h = 45mph
25m/sec = 90km/h = 55mph
30m/sec = 108km/h = 67mph
35m/sec = 126km/h = 78mph
40m/sec = 144km/h = 90mph


9 Nov 2005, 9 July 2007, 25 Oct 2008