[TUTORIAL] MandelSoft's Modding Basics

Modding school: Learn it from the masters
Post Reply
User avatar
MandelSoft
Lead Developer
Posts: 3835
Joined: 08 Aug 2013 10:48
Location: Delft [NL]

31 May 2015 00:01

Modding Basics 1: The Console
One of the most important modding tools of Euro Truck Simulator 2 is the console. The console is a command line tool and can be used to access the map editor and help you manipulate the game's settings. This tutorial explains the basics.

Enabling the console
The first step is to enable the console in your game. Normally, the console is disabled and can't be opened. To enable the console, follow these steps:
  • Go to ../Documents/Euro Truck Simulator 2/
  • Open config.cfg
  • Change the following values from 0 to 1.

    Code: Select all

    uset g_developer 1
    uset g_console 1
  • Save the file and start up your game.
  • The console can be opened and closed by using the Accent Acute (`) key (usually combined with the Tilde (~) key).
*Note: the developer mode also enables the "free camera" in game. Press the 0 key to switch to the free camera. You can move around by using the 4,5,6 and 8 keys from your Numpad.

Commands in the console
As stated before, the console is a command line tool. You type in a command, press the ENTER/RETURN key, and you get a result (or an error when you didn't type in the right command). The following keys are important in the console:
  • ENTER/RETURN: Execute command
  • ARROW UP/DOWN: Reload previous/next command from history
  • TAB: Auto-fill command or give a list of possible auto-fills.
Below is a list of common command codes. Some of these commands work on their own, while others need a value. This value can be a name (<NAME>), a unique identifier of an object (<UID>) a boolean value (<BOOL>) or a numerical value (<NUM>):
  • edit <NAME> : opens the map editor. If you leave <NAME> empty, it will load a blank map. The usual value for <NAME> is "europe", which opens the european map.
  • preview <NAME> : runs a specified map in preview mode.
  • goto <NAME> : teleports the free camera to the given place. This can either be a city name, map co-ordinates or an UID
  • help : gives a list of all commands.
  • quit : shuts down the game.
  • warp <VALUE> : sets the speed multiplier of the game timer. The standard value is 1.
  • g_set_flyspeed : sets the fly speed of the free camera. The standard value is 100.
  • g_set_weather <NAME> <VALUE> : sets the weather type ("nice" or "bad") and skybox variant.
  • g_set_time <VALUE> : sets the time to a given hour on a 24-hour clock. NOTE: it can only skip ahead in time.
  • g_minicon <BOOL> : enables/disables the miniconsole on the screen.
  • g_colbox <BOOL> : enables/disables the game to draw colission models on screen in the map editor.
  • g_delete_uid <UID> : deletes the object with the specified UID from the map in the map editor.
There are more commands available, which you can always look up by auto-filling or using "help".

And that's all there is to the console. This will covers all you need to know about the console.

Next lesson: Mod Packaging

Best,
MandelSoft
Your daily dose of wisdom!
╔═══╗────╔═╗╔═╗────╔╗
║╔═╗║────║║╚╝║║────║║
║╚═╝╠═╦══╣╔╗╔╗╠══╦═╝╠══╗
║╔══╣╔╣╔╗║║║║║║╔╗║╔╗║══╣
║║──║║║╚╝║║║║║║╚╝║╚╝╠══║
╚╝──╚╝╚══╩╝╚╝╚╩══╩══╩══╝
Don't ask us for a release date; we don't know either.

LA-MJ
Posts: 776
Joined: 20 Dec 2013 16:07
Donation rank:

31 May 2015 00:41

side note: map editor only works on Windows :(

User avatar
KubaJAM
Posts: 2285
Joined: 10 Oct 2013 18:42
Donation rank:
Location: Lancashire, United Kingdom

31 May 2015 10:35

I look forward to the next tutorial ;).
Image
Image
Image

User avatar
MandelSoft
Lead Developer
Posts: 3835
Joined: 08 Aug 2013 10:48
Location: Delft [NL]

04 Jun 2015 16:50

Modding Basics 2: Mod Packaging
As you may have noticed, all mods come in SCS or ZIP packages. Packaging is something all mods have in common. Knowing how to package stuff is essential; you have to know how the file system of Euro Truck Simulator 2 works before you can have a working mod or map. Therefore, this lesson is about packaging, an essential skill you need to master if you want to make (map) mods.

Setting up your package application
Mods are packaged in ZIP or SCS files. To package these files, a proper packaging tool is required. Most compression applications (7zip, WinRar) are able to read the ZIP format. However, most SCS packages out there are nothing more than ZIP packages with a different file extension. If you force your packaging tool to open the file, it will be opened perfectly fine.

For quick access, you can also set your packaging tool as standard application to open these packages. Both Windows and Linux-based systems have straight forward approaches for this. For Windows, if no other program is assigned to the SCS extension, a screen pops up where you can set a standard application for this to open. Select your packaging tool and click "OK". Now you can open the package by clicking on it.

Well, that was easy enough!

Note: Not all packages can be opened by this method. There are two categories of packages that can't be opened by this method:
  • Locked packages (example: the ProMods asset package)
  • The SCS base game packages that are located in the installation folder of Euro Truck Simulator 2. For that, there is a drag and drop application from SCS their website, which can be found here
Relative file paths: how the ETS2 file system works
The next part is a bit harder to grasp: how does ETS2 read its files? The way how ETS2 handles files is essential to know if you want to make mods. ETS2 uses so called relative file paths. This means that all file paths that are defined in definition files, but also the entire file structure is based upon the fact that every path is relative to a given "base" folder.

To illustrate the difference between the two, I'll give you two examples of file paths, one with the absolute file paths you are all familiar with and one with a relative file paths. Say, you want to do something with the dutch traffic lights. For the dutch traffic lights, you have model files, texture files and of course, definition files containing the entries. Now, I have extracted all the files from the base packages in my Euro Truck Simulator installation folder. The absolute file paths of these files are

Code: Select all

C:\Program Files (x86)\Steam\SteamApps\common\Euro Truck Simulator 2\model\traffic_light\city_nl.pmc
C:\Program Files (x86)\Steam\SteamApps\common\Euro Truck Simulator 2\model\traffic_light\city_nl.pmd
C:\Program Files (x86)\Steam\SteamApps\common\Euro Truck Simulator 2\model\traffic_light\city_nl.pmg
C:\Program Files (x86)\Steam\SteamApps\common\Euro Truck Simulator 2\model\traffic_light\traffic_lights_nl.dds
C:\Program Files (x86)\Steam\SteamApps\common\Euro Truck Simulator 2\model\traffic_light\traffic_lights_nl.tobj
C:\Program Files (x86)\Steam\SteamApps\common\Euro Truck Simulator 2\automat\02\ea743e2753ff4fdcbe4127e2668d26bdc29d8b.mat
C:\Program Files (x86)\Steam\SteamApps\common\Euro Truck Simulator 2\def\world\semaphore_model.sii
An important thing to notice that these paths will only work on this system with this particular setup. If you do this on another PC, the paths can be very different. If ETS2 were using these kind of paths, mods would be incredibly picky on where you place your mod files (OK, it is still picky, it only works if the mod is in the mod folder), and zipped packages may not even work in that system.

Now, let's take a look again with relative paths, which the game uses in all its definition files:

Code: Select all

/model/traffic_light/city_nl.pmc
/model/traffic_light/city_nl.pmd
/model/traffic_light/city_nl.pmg
/model/traffic_light/traffic_lights_nl.dds
/model/traffic_light/traffic_lights_nl.tobj
/automat/02/ea743e2753ff4fdcbe4127e2668d26bdc29d8b.mat
/def/world/semaphore_model.sii
Most people who are familiar with Linux-based systems see something familiar: the path begins with a "/". However, this is not the root folder of your computer's file system; it's the root (or base) folder of the package! The game reads every package with this file structure, where the root folder of the package is the same root folder in the game's file system. This allows separate package to be merged once the game reads them. As an example, let's take the three ProMods packages. In the image below, you see the three packages opened in their root folder:

Image
DISCLAIMER: this is a work-version of ProMods you see here. The package on the left is locked in public versions.

You see the same file structure coming back again. Now, you have three separate packages here, but once the game reads them, the folders you see here are at the same level in the file structure.

Additions and overrides
As you may know, the game reads each package in alphabetic order. Each file in a package can have two functions: being an addition or an override.

An addition is a file that is new and has not been loaded before in the loading order of the game. They do not affect any existing content.

An override is a file with the exact same file name and relative file path as an file that has been loaded earlier. Since the game can't cope with two files having the same file name and relative file path, the game will always use and only use the file that has been loaded last. This allows you to override files from packages that are loaded earlier in the loading order. If this system didn't work this way, map mods and any other mods wouldn't work at all.

So, those were the basics of packaging!

Next lesson: Mapping basics

Best,
MandelSoft
Your daily dose of wisdom!
╔═══╗────╔═╗╔═╗────╔╗
║╔═╗║────║║╚╝║║────║║
║╚═╝╠═╦══╣╔╗╔╗╠══╦═╝╠══╗
║╔══╣╔╣╔╗║║║║║║╔╗║╔╗║══╣
║║──║║║╚╝║║║║║║╚╝║╚╝╠══║
╚╝──╚╝╚══╩╝╚╝╚╩══╩══╩══╝
Don't ask us for a release date; we don't know either.

Horizon™
Developer
Posts: 2131
Joined: 06 Sep 2014 11:53
Location: Lithuania

07 Jun 2015 13:21

Nice tutorial MandelSoft, but it is possible to select any sector ,for example : +0023-0050 without deleting other parts of map? If yes, tell me how, please :)
Post is proudly delivered by Horizon's Logistics
Image
Roaming through desert

Developer of Lithuania
Developer of Kazakhstan
Developer of Iraq

User avatar
MandelSoft
Lead Developer
Posts: 3835
Joined: 08 Aug 2013 10:48
Location: Delft [NL]

07 Jun 2015 14:57

What do you mean exactly? What is it what you want to do?
Your daily dose of wisdom!
╔═══╗────╔═╗╔═╗────╔╗
║╔═╗║────║║╚╝║║────║║
║╚═╝╠═╦══╣╔╗╔╗╠══╦═╝╠══╗
║╔══╣╔╣╔╗║║║║║║╔╗║╔╗║══╣
║║──║║║╚╝║║║║║║╚╝║╚╝╠══║
╚╝──╚╝╚══╩╝╚╝╚╩══╩══╩══╝
Don't ask us for a release date; we don't know either.

Horizon™
Developer
Posts: 2131
Joined: 06 Sep 2014 11:53
Location: Lithuania

07 Jun 2015 15:03

Nevermind, sorry for the post , did it by myself...sorry.
Post is proudly delivered by Horizon's Logistics
Image
Roaming through desert

Developer of Lithuania
Developer of Kazakhstan
Developer of Iraq

User avatar
cristakey
Posts: 133
Joined: 05 Sep 2013 13:19
Donation rank:
Location: Asolo, Treviso

28 Aug 2015 18:30

MandelSoft wrote:

Is the next lesson coming...?

User avatar
MandelSoft
Lead Developer
Posts: 3835
Joined: 08 Aug 2013 10:48
Location: Delft [NL]

28 Aug 2015 19:07

I didn't have the time to make it yet...
Your daily dose of wisdom!
╔═══╗────╔═╗╔═╗────╔╗
║╔═╗║────║║╚╝║║────║║
║╚═╝╠═╦══╣╔╗╔╗╠══╦═╝╠══╗
║╔══╣╔╣╔╗║║║║║║╔╗║╔╗║══╣
║║──║║║╚╝║║║║║║╚╝║╚╝╠══║
╚╝──╚╝╚══╩╝╚╝╚╩══╩══╩══╝
Don't ask us for a release date; we don't know either.

SpitfireACE
Posts: 1
Joined: 04 Aug 2016 10:58

04 Aug 2016 17:16

Is there another way of moving the free camera other than the numpad? I have a tenkeyless keyboard so this isn't an option.



Post Reply

Return to “ProMods Academy”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 33 guests