Sunday, 26 April 2015

Creating Consists via Blueprints for Quick Drive and AI

There are no less than three ways of making consists in TS2015!

The first has been around since the beginning - simply place some vehicles on the track, go to the consist tool and then double click on the grey boxes above the vehicles, you can then give it a name and then re-use it later.  It was a good way to short cut the process for a single scenario but didn't persist between routes so it was of limited use.

Later, Train Simulator added an excellent built-in system for creating your own consists via a user interface in the menu system, which was a big step forwards however these consists still won't appear as AI trains in Quick Drive scenarios.

So how exactly do you create those?

The answer is in the third method - via blueprints.  It's a bit tricky and certainly not easy, but if you can figure out how to create them you may find it preferable since it has some neat ways of re-using sequences over and over that can be a huge time saver... not to mention that any consist you create here can show up as AI in your Quick Drive scenarios too!

Folder Structure

To get started, let's go in to the railworks home folder via Windows Explorer.  On most systems that install to the C: drive by default, that is:

C:\Program Files (x86)\Steam\SteamApps\common\railworks

Inside here, if you don't already have a "Source" folder, create one.

Now you're going to need to decide on a "provider" folder name - this can be anything you like, whether its a nickname, organisation name or your name in some form.  I've got for "MattPeddlesden".

Underneath that you need to think of a product name - so i've just gone for "QDStuff"  but you might want to take slightly more time and come up with something a bit better :)

Lastly, we need to add a folder "PreLoad" (note the capital P and the capital L are important!) underneath that.

When that's all done, you end up with this:

Inside the RailWorks folder you'll find an executable application file called "BlueprintEditor2.exe" - double click it to run, and you'll get a screen something like this:

On the top left pane, titled "Explorer" you can see the Source folder that you created, expand this a couple of times so that your new PreLoad folder is visible.  This is where we'll be doing all our work!

There are two types of consist blueprint within the game, one is the "Consist Blueprint" and these are the ones that result in new options being available in the game.  Ultimately what you do has to end up in new consist blueprints or nothing new will happen.  The other type is a "Consist Fragment Blueprint" and these are used to keep re-usable sequences, for example you could have a sequence of 40 wagons or a 12 passenger coaches and then later create a bunch of new Consist Blueprints by simply having a different loco plus the 12 coach fragment - two simple entries and an easy way to rapidly create some great variety.

We're going to start by creating the Consist Blueprint, get them working and then we'll almost immediately see how Fragment's will be useful - so we'll get one of those created and use it.

Consist Blueprints

Right click on the PreLoad folder and select Add, followed by New Item.

From the list that pops up, select "Blueprint" from the left side and "Consist Blueprint" from the right hand side.

Name it something sensible so that you can easily find it later.   The filename isn't used in-game but it is always useful to be able to work out what files contain what.  Since i'm planning on just making this a quick test, i've just gone with a simple name, later on we'll delete this once we get the hang of it and start doing it properly!

Click Ok and the new blueprint will be created.


There are a number of different sections to this file so let's take them one at a time as an overview first, and then we'll drill in to them to get it set up.

Consist Entry
This defines the actual vehicles that are in the consist.  A consist does not have to contain any locomotives, but it must have at least one of something of course!  If it has no locomotives, note there is a setting later that must be ticked to say it's not drivable.

Loco Name and Display Name
In the Quick Drive selection screen you have a list of locomotives, and then when you click on one you have a list of consists.  Let's look at a couple of screenshots that i've taken from the game, where I have highlighted the key sections.



Where i've highlighted in GREEN, this is the "Loco name" field.  Where I have highlighted in RED, this is the "Display Name" field.

If I create a new consist where the Loco Name is "A loco" then it will create a new entry in the grid in the first screenshot called "A loco".  If I call it the same as something else, e.g. "GE U36 SBD" then my consist will end up being one of the selections inside that.  What it means is that if you simply want more consist variety for a particular loco you can do so without polluting this already quite busy list with a lot of duplication.

The Display Name field should be used to describe the specific consist (e.g. "2+1+1 with 150 car manifest" or "12 Coach Mark 3 Passenger Blue Greys".  When someone clicks on the loco entry in the grid of the first shot, they get the list of consist display names that were found using that "loco name" (which again could be from lots of different places, it very handily merges them all in to one list).  You may choose to duplicate the "loco name" component for clarity, or you may choose not to - personally I don't duplicate it.  Once selected, the "display name" is shown in the right hand half of the current selected consist - top of the list of three boxes.

It's a little confusing at first, but once you get the hang of the naming system you'll find it does exactly what it needs to.

Engine Type
Straight forward - if this is a driveable consist what kind of lead loco is it? This is used for filtering.
If it's not driveable, it doesn't matter what you set this to as it won't be offered in a filterable lists.

Era Start Year and Era End Year
Note: There is currently a limitation in the game whereby if this doesn't include 2014 it won't be used, so for the time being I'd recommend leaving this at the defaults.
The intention of these options is to say what rough years this consist would have operated in.  When you define a Quick Drive scenario template, you can specify what year the template is relevant for and this will then influence which consists appear.  This means you can set up a 1950's Quick Drive that only features era-appropriate stock for instance.

Driving Engine Index
Where in the consist is the driving engine that the player will be sat in?  Normally this is 0 - the lead locomotive.  But if you have something like a Cab Forward or Big Boy then it might be further in the train.  0 is the front, 1 is the next rail vehicle in and so forth.

Valid Build and Drive Routes
This lists all of the valid routes that this consist can appear on, it's a list of route GUID's, and this is the way that the sim prevents SD70M's from appearing on ECML London to Peterborough, for example.  This does not affect the choice the player has, you might say this US freight consist is only good for a set of US routes but as a player, I can still choose to drive it on ECML London Peterborough if I wish - but I won't see it as AI.

Drivable Consist
Tick this box if it is something the player can drive, untick it if it is simply a list of wagons.  Consists that are just a variety of wagons and lengths of consists etc are great to have because they'll appear as "static consists" which will fill up your yards in Quick Drive's.

Consist Type
This one is crucial, it defines what kind of consist this is and is what will make it available to appear as an AI train.  Set this to something appropriate for the consist from the list.  You could choose also to make use of the additional "custom" types, these allow you to specify additional types of consists that have not been catered for already.  When someone sets up a Quick Drive scenario template they define the various AI start points and what the chances of a particular type of consist appearing, this is where you link particular types of consists to specific consists, locomotives and rolling stock.

Has Pantograph, 3rd Rail, 4th Rail
These ones are used as an additional AI filter. When an AI spawner is set up in a Quick Drive template scenario, it has some tick boxes saying whether this spawner is suitable for rail vehicles that have pantographs, or 3rd/4th rail pickups.  Simply tick these boxes to reflect the real requirements of this consist and the system will ensure you don't get overhead electric trains driving on 3rd rail electric routes (as long as it's all set up correctly of course :) ).

Setting Our First Consist Up

Now that we've looked at the options, let's get the first consist set up.  For this consist i'm just going to drop in a CSX SD40-2 followed by two wagons, just to keep it simple and show a couple of extra steps off.  We're also going to set it up so that it can appear as an AI train in Quick Drive scenarios.

First we need to add the vehicles.

Expand the "Consist Entry" section and click Add Element.

Expand the new entries that appear so that you can see it completely, it looks like this:

The CSX SD40-2 is part of the New York New Haven route, so the Provider should be set to "RSC" and the Product to "NewYorkNewHaven".  These are the same names as you would tick when adding the item to make it available in a regular scenario, and are the same as the folders under the Assets folder - take some time to have a browse and get familiar so that it will be easier to find what you're looking for.

This next step is where it gets a little hairy if you're not familiar with how locomotives are structured on your hard drive!

Assets, AP files and Other Complexities...

Before going any further I wanted to just outline how files are stored a little bit, just to give you a head start.  Assuming the install for your TS2015 is here:

C:\Program Files (x86)\Steam\SteamApps\common\railworks

Then all the rail vehicles and other assets are stored here in the assets folder.

C:\Program Files (x86)\Steam\SteamApps\common\railworks\Assets

Beneath that is the provider folder, then the product folder.  So if what we're looking for is RSC and NewYorkNewHaven, then our path for its assets is:

C:\Program Files (x86)\Steam\SteamApps\common\railworks\Assets\RSC\NewYorkNewHaven

If you go there however you'll find just an AP file (and possibly a PAK file, but ignore that!).  An AP file is basically the same as a ZIP file and can be opened in something like 7-zip.  Opening it, you will find a further series of files and folders.  If it's a route AP file (as this is) then you'll find quite a lot in there, if it's just a loco pack then there are fewer folders.

Rail Vehicles are  in the "RailVehicles" folder and from there the separation is usually fairly intuitive.

Continuing where we left off...

The Blueprint ID is the pathname and filename of the blueprint for the rail vehicle we want to add.  In this case the files are in an AP file - so open this with 7-zip (or your favourite ZIP explorer) and we find that the diesel locomotive we want can be found here inside the AP file:

RailVehicles\Diesel\SD40-2\Default\Engine\

Tip: a .ap file is just a renamed .zip file, so it should load fine in any ZIP tool.  Personally I use 7-zip as it's fast and free - you can download it from www.7-zip.org

Inside this folder are a bunch of files, the ones we are looking for are .bin files and in this case there are two - the one we want is sd40_2.bin - for the purposes of our consist, we will put "xml" instead of "bin" though.

This means that the final blueprint ID will be:

RailVehicles\Diesel\SD40-2\Default\Engine\sd40_2.xml

Even though the file itself is actually a .bin file, the game will look for both the .xml and .bin files, but as the blueprint editor is intended to work with source files, it must have the xml file.  If that doesn't make sense, don't worry, just go with it :)

The last option "Flipped" will flip the vehicle around so that it faces the other way.  We'll leave it as it is for now.

Ok, so this is where we're at now:


At this point it's worth answering a couple of questions you might be thinking about...

Can I use vehicles from lots of different provider/product's?
Yes, as many as you want, you can mix a "Marias Pass" loco with a "Miami West Palm Beach" wagon and a "New York New Haven" wagon if you want!  Just remember that the more you add, the more the game will have to load, since it loads the entirety of a provider/product when it accesses any part of one.

Do I need to unpack the AP file?
No, leave it exactly as it is.

That's the first entry on the consist done.  Let's add a couple of wagons - click the Add Element button again.

We'll add a wagon from the same route just to make things easy, set up the same Provider and Product as before.  Navigate back in to the AP file for New York New Haven and we can see that there are a number of wagon types, i'm going to go with the box car, so our blueprint folder is:

RailVehicles\Freight\BoxCar\Default\Wagon\

Inside here, there are a number of bin files, but two of them are the bogie definitions, leaving one which refers to the wagon itself.  Don't forget to change "bin" to "xml" for the blueprint ID, meaning our Blueprint ID is therefore:

RailVehicles\Freight\BoxCar\Default\Wagon\box_car.xml

Let's see how our consist is looking now:

With everything you've just done, you can imagine setting up a 120 wagon consist is going to start getting hard work!  Assuming you're repeating items however, there is a short cut to make it a bit easier so the second wagon we add is going to just be the same as the first.

Click the Add Element button and expand everything out again, as if we were going to do it the same way we did the first one.

Now right click on the "Consist Entry" header of the FIRST wagon we added and select Copy. Now right click on the "Consist Entry" header of the NEW entry we just added (the one that is currently blank) and select Paste.  That's the second wagon done, much easier.

Now that the rail vehicles themselves are done, let's go through the rest of the blueprint.

Loco name - let's make it the same as the existing Sd40-2 so that it simply adds to the list, which means it needs to have a Loco Name of "EMD SD40-2" - it is again essential that capitalisation matches.

Display Name - our consist is simply a couple of box cars so let's call it "2 Box cars".

Engine Type - Diesel.

I'll leave the era start and end years as they are.

Driving Engine Index we will leave as 0.

Valid Build and Drive Routes
For this, click the Add Element button and it will add a "Consist Valid Route" entry with a "Route GUID" entry.  What you need to know now is what the GUID's are for the routes you want to add it to. I found an excellent post on the Steam Forums which lists all the routes (and many freeware routes) and their GUID's, you can find it here:

http://forums.steampowered.com/forums/showthread.php?t=3257269

Simply paste one Route GUID in to the entry box to enable this consist to appear as AI on that route.  Let's add New York New Haven.
And then click Add Element again, and add the GUID for Miami West Palm Beach, so we now end up with:


This means that our consist can now randomly appear as an AI consist on quick drives that happen on these two routes, but it won't appear on any others.

Drivable Consist - this is drivable, so tick the box.

Consist Type - there really isn't an ideal type in this box so i'm going to set it to Freight - Container.  As I mentioned earlier, this relates to how the quick drives themselves are set up.  You pick anything - this could be a "freight livestock" if you want, and then if you give "freight livestock" a chance of showing in the quick drive it will all simply work.  Choosing a reasonably appropriate one just helps you create QD's that make sense and try to have the right trains in the right places.  If you find there aren't any appropriate options then you can use one of the "custom" options but again, these are no good unless the QD itself offers a chance of the same ones appearing.   If you're creating the consists  AND the quick drives then that's ideal and you can create something really nice.

I would recommend that if you create a quick drive, you should document the types of consists you've used and their chances of appearing, that'll help anyone making new consists to ensure that they use the right types.

The last three settings relate to electric trains, if this was an ACS-64 then I would tick the "has pantograph" button but as it's a diesel, I will leave them all unticked.

That's it - our first consist has been created.

Press CTRL-S to save it (or go to the file menu and click Save).

It's important to double check all of the entries you've typed in, the process of exporting will not check to make sure you have put the right paths in because to do that you need the full asset source.

In the "Explorer" section where your new blueprint consist file is, right click on the file and select "Export" followed by "Export This Only".  It's important to choose "Export This Only" because this option will not try to export anything else - and since we don't have the source for the locomotive and wagons that's a good thing!  If you do have all the source because you're actually making the stock yourself then just export as normal and it will error check everything properly as it goes.

Now let's go in to the game and test it!

Once in the Quick Drive section, find the EMD SD40-2 entry and then see if your consist is present.  If it is that's the first win.  Select it and enter the quick drive.  If it loads and then errors right at the end, it means one or more of the entries you've added for the blueprint id's or provider / products is incorrect - check it.  You might get some help by enabling logging (detailed in an earlier blog post).

Once all is working you should now be in the game driving the consist you just made!

That's all you need to get started, you can now make any consist you like - but making a consist that has the same 120 wagons but one of 5 different loco's at the front would currently either mean duplicating that 120 wagons five times.  Nightmare!  This is where Consist Fragments come to the rescue in a big way!

In the same way we created a Consist Blueprint, you can create a Consist Fragment blueprint.  I would strongly suggest a naming convention on the filenames so that fragments are easily identifyable, you could also put them in a sub-folder.  I would suggest a prefix like "F-" or "Fragment-" just to be clear.

Inside the fragment blueprint is just the section of consist entries, so all those blueprint id's, providers, products etc and nothing else.  You could make up a set of say 20 container wagons here or a 5 car passenger train (just the coaches).

Having saved and exported the fragment you can now use it in the main Consist Blueprint - set the provider and product to your provider and product (e.g. MattPeddlesden and QDStuff for my test example here) and then the blueprint ID simply points to the fragment.  There is, however, a nice easy way to do this!

Open the Consist Blueprint you want to use the fragment in and add an element where the next wagon should be placed.

Right click on the Fragment filename in the Explorer pane, select Copy.

Now expand the blank consist entry and right click where it says "blueprint name" - and click Paste.

The Blueprint editor is clever enough to know how to interpret the location of the blueprint you copied and fill in all the blanks for this consist entry!  That's the fragment added.

So if you defined say 10 coal cars, 10 auto racks, 15 low gons etc you could then add half a dozen different fragments and end up with a 100 car manifest train and still have a bunch of fragments you can chop and change around and re-use in other consists.

The other really nice thing about this reusability is that if, later, you find a better coal car, you can simply open each fragment that uses it and swap in the new car - and all of the consists which use those fragments will automatically reflect the changes.

It's been a long journey but we got to the end at last :)

In summary...

  • You need to create a consist using the Blueprint Editor.
  • You should create Consist Fragments for the commonly re-used portions.
  • You should create Consist Blueprints to actually define the final consists.
  • You can mix and match fragments and actual items of stock as much as you want.
  • You can pull in stock from lots of different provider/products if you want.
  • Set the consist type and valid routes to enable the consist to be seen in Quick Drive's as AI traffic.
  • Set the Loco Name of the consist to chose what loco name it shows up as when a player is picking from the list, and I'd recommend you try and add your consists to existing loco name entries so that the list does not get bloated.
  • Set the Display Name to represent what is unique about this consist, what actually is it.
  • You can set up consists with only freight cars / wagons / coaches if you want, make sure not to check the Drivable box for these, but make sure you do set the valid routes and consist type and then they should show up as static items placed in yards and so forth.
  • Do keep your own consist definitions in your own provider/product, it makes it easier for someone to update, remove etc than if you splat yours all over the main ones.

I look forward to seeing what you all do with this exciting feature :)

If you missed my video on creating quick drive scenarios then you can find it here on YouTube:

https://www.youtube.com/watch?v=uTSwEuWPZH8












5 comments:

  1. Very informative, highly recommend the videos made by Matt. Some very good workshop scenarios highlighted and the tutorials are good watching material as well.
    Thanks for sharing Matt - Mavadelo

    ReplyDelete
  2. this is all very confusing as text! can you make a video explaining how to use this feature? It will be much easier to learn

    ReplyDelete
  3. omg why does it has to be this complicated at all? the game does know what locomotives and wagons you have.. why can't it just at random pick any configuration?

    ReplyDelete
  4. omg why does it has to be this complicated at all? the game does know what locomotives and wagons you have.. why can't it just at random pick any configuration?

    ReplyDelete
  5. I have got as far as creating a consist blueprint and clicked Ok but that's about it as when OK is clicked I'm getting a message saying " How do you want to open this file " but nothing will open it.

    ReplyDelete