Workers & Resources: Soviet Republic

Workers & Resources: Soviet Republic

38 ratings
How to make a custom train
By Zombiedragon
In this guide I'll explain from my experiences how you can make and add your custom train to the game. Only single locomotives so far but once I'll make multiple units and wagons I'll explain those too.

What you'll need is a 3d program (e.g. blender) to make the train, an image editor to make the textures and save them as .DDS file (e.g. paint.net or gimp) and a text editor like notepad or something like that.
   
Award
Favorite
Favorited
Unfavorite
Getting started
So you want to add your own train to the game? Great! I'll explain step by step what you'll need to do to get your vehicle in game.

Before you start, there is now an official guide available on all functions of vehicles script wise. I'd recommend checking it out or keeping it open in another tab should some points of my guide raise questions. The guide can be founde here: https://steamproxy.net/sharedfiles/filedetails/?id=1861143159

So lets start then...

First of all we need to have an idea of what vehicle we will make, look up references on the train you want to make and or find blueprints of said vehicle. If you want to design one yourself, make a single or multiple sketches of what you roughly have in mind.

Once you have the idea of what you want to make, it is time to use your 3d program to make the model (I use blender which is free but there are alternative options). In this guide I won't go into detail about creating the model and textures itself, there should be plenty of tutorials on youtube and sites like polycount on how to make models using example blender.



Once the model is done we can go to the next step: exporting it...
Making your workshop item
This is a quick step and not really that hard. We start up the game and go to workshop, then we go to Your items (WIP) and we get a grid view where we click the little plus button to make a new workshop item.

Select a thumbnail and a description that you have written in .txt format. Both can be a placeholder for later and the discription can be altered in the steam workshop aswell. Though it will reset with each update you make on the item later on.



Once we have created the item we get a map inside our game's workshop wip folder. The most recent map is your newest created item. Inside there will be a preview image and a workshopconfig.ini file that we open and edit with notepad. Open the file and add a new rule underneath $VISIBILITY 0

Make another folder inside your workshop number folder with the name of your vehicle, we will need this to put our models, textures and scripts in later.

This new rule should say in your workshopconfig.ini file should say: $OBJECT_VEHICLE your vehicle name This should be the exeact same name as your folder that you just created.


This rule tells the game where the folder containing the needed files such as the model, scripts and textures are. Save the file, make sure not to press SAVE AS, because this can save it as a .txt file which will no longer make it work. The file has to be saved as the same .ini filetype with the same name.


We got the map set up, wonderfull, now we can move onto importing the model!


Exporting from the modeling program and into the game
Now that the model is done it is time to export it. We will have to export it as an .obj file. Why? Because the game can turn obj files into .nmf files that the game uses.



Export the selected model without materials and we should be having a nice .obj model of our train. Now we can open up the ingame model viewer in: (your drive where you have the game installed on, for example C):\SteamLibrary\steamapps\common\SovietRepublic and by executing the ModelViewer.exe



Once the model viewer is open we can see an empty grid and a cube. We will press on the button: import .obj and go to the folder where our .obj file is located (you can put the obj in whatever folder you want but putting it inside your vehicle name folder will make it faster if you need to make alterations or import it again). Select and import it, you should now see your model in the model viewer. Make sure it is the right size, the track width is roughly 1.1 or 1.2 grid squares so your wheels should roughly be of that gauge, if your model fits on the track we can go to the next step.


We now save the model as an NMF file, using the big button that says Save as NMF. Enter the location of your workshop item folder and incase of a locomotive call it Main , so it will be saved as main.nmf in your vehicle named folder, so for example D:\SteamLibrary\steamapps\common\SovietRepublic\media_soviet\workshop_wip\(your workshop item number like this:)1843794167\yourtrainname


Now we go on to the textures and scripts...
Adding the textures and the scripts.
Now that we got our main.nmf model in the vehicle name map, we can add in the textures. If your model has textures they must be saved as .dds files. You can name this file whatever you want. Transparent bits of the textures are interpeted by the game as glass and windows, keep this in mind when making them.


Make sure to use the following settings while saving as a dds file: "Save it in .dds (BC1/DXT1 compression - 1 bit alpha) format" (thanks LovelyPL mentioning this for your vehicle skin guide)

Now that we have saved our texture we need to have a material file. This file will tell the game what textures to use. This file need to be an .mtl file and contain the following:


The $TEXTURE_MTL 0 tells the game to look inside this workshop item folder instead of the standard game directory, telling it to select the .dds file that you made, the $TEXTURE 1 buildings/blankspecular.dds refers it to look at the default specular (shinyness) map. The $TEXTURE 2 buildings/blankbump.dds refers to the default bump (height and details) map. We do not need to alter $TEXTURE 1 and $TEXTURE 2 so we leave them as they are and save the .mtl file keeping the same name.

If we want more skins we make more material.mtl files and name them material_1.mtl tell them what .dds file to use. Make a material_2.mtl and so on and so on...

We will also need a script for the vehicle this is a script.ini file that we can just take from an existing train in the game folders and modify it to suit our needs. We simply copy it and paste it into our vehicle folder.


I've added text to show what the different rules do, the ones where I haven't added text generally shouldn't be altered unless you know what you are doing.

If you want to see the texture now, load your main model in the modelviewer and load press load material, the viewer will load the .mtl you selected and it will appear on your model.

Edit what you need to edit to the script.ini and save the file. Now comes the trickier part...
Minor adjustments and ingame testing.
If still have the script.ini file open then great! You can now test and adjust the light and particle coördinates... This is mostly rough guessing work but I can tell you the meaning of the numbers with this image:


Now open the game and buy your train, let it run and prefferably when it's up on a high bridge and at night pause the game. Now you can accurately see the position of the lights and exhaust/pantograph particles on the train. Save your game and adjust the coördinates, save the script.ini file when you have adjusted them and load your save again. When you exit your save and reload your safe the game reloads the script.ini file, allowing you to see the changes. It's not perfect but it's the best way I found to do this so far.

After messing about enough this will make your lights and particles go from this:


To this:



Once you got all coördinates at the right spot and you are happy with your locomotive and the stats in the script.ini file save em and upload your file, or keep it to yourself. If you want to figure out more I advice just making a new locomotive / wagon mod and mess a bit with the settings in it, copy or look at script.ini files on wagons and multiple units etc...
Enjoy your train and if you have issues.
  • Game crashes during loading vehicles: game might not be able to find texture directories and thus crashes.
  • Train does not appear in game: check your modconfig.ini file and your script file for errors, big spaces, no spaces or typos
  • Train is half in the ground or flying: check your model exporting position, the wheels should be at 0 height, so on the grid.
  • My front lights are aiming backwards: Not entirely sure why this happends or how to solve it, might have to ask the developer about this. If you have troubles with this or managed to solve it let me know.
  • My locomotive is backwards: rotate your model 180 degrees and export as obj again. repeat import into game steps.
  • Model is heavy on the game: your model likely has a lot of polygons and no lods (level of details). Make versions of your model with unnessecary details removed and call them lod_1.nmf and lod_2.nmf (lod 2 should have most things taken off, lods will be seen at a distance so lod 2 will be seen from a big distance away. Less details means less polygons and less calculations on the game and pc's end, resulting in better peformance.)
  • My lenin is very happy with his new proletariat train: Very good comrade.
  • My dollar loving industrialist is very happy with his free market train: Very good my rich freedom loving friend.
  • My train clips into the wagons it's pulling: make sure your model is centered propperly in your 3d modelling software.
  • I can't seem to make a vehicle workshop item: try using the test - beta version of the game.

If none of the above works or you have issues let me know and I'll look into it.

Enjoy


This guide is a Work in progress and might be altered and expanded upon depending on feedback and my own experiences during modding.
12 Comments
MareCZEk 26 Jan, 2020 @ 12:36am 
Do you have time to make one for the buildings? I am so excited to learn how to mod this game properly :-) :SaddenedRobot:
Monovik 31 Oct, 2019 @ 4:01pm 
@Zombiedragon Can you do a building version of this?

Also thank you for making this, you're a legend
Kevlaris 13 Sep, 2019 @ 9:16am 
Thank you!
Zombiedragon  [author] 10 Sep, 2019 @ 3:25am 
@Kevlaris Oh I forgot yeah, it's for the type of vehicle exhaust. Like a big vehicle, medium vehicle (vehicle_medium), small vehicle or electric vehicle (like train_eletric). If you look at the script files of the existing trains in the game you can copy the right type of particles from that. It's basically a preset on what type of exhaust the vehicle has.
Kevlaris 9 Sep, 2019 @ 9:18pm 
Thanks Zombiedragon. But I still don't understand what train_medium means.
Zombiedragon  [author] 9 Sep, 2019 @ 4:52am 
@Kevlaris $PARTICLE_MOVEMENT is the location there the diesel fumes or electric sparks on a vehicle are located. The coordinates there will decide where those come from.
Kevlaris 8 Sep, 2019 @ 7:38am 
Nice tutorial.
What does $PARTICLE_MOVEMENT mean though?
Holodets 28 Aug, 2019 @ 5:07am 
@Zombiedragon I did it. I do not know why, but it worked. I edited the config when the game was on.
Only I did not understand how to change the name of the machine in the game. For some reason it displays the names of existing machines. I don't know what that means "$PARTICLE_MOVEMENT vehicle_medium"
Zombiedragon  [author] 27 Aug, 2019 @ 4:10pm 
@Holodets Sent you a friend invite, I'm not sure what would be causing it besides something in the .ini files. We can look a bit at your files toghether and try and look for what would be causing this. If we find it I'll add the issue in the guide.
Holodets 27 Aug, 2019 @ 2:10pm 
@Zombiedragon use the test version. the game was off