[Guide] How to create on-board computer mod.
Forum rules
SCS as a company do not wish to have paid mods on this forum. While we understand that not all paid mods use the Intellectual Property of other companies/people, it is very hard to moderate what is and isn't acceptable when money is involved. There are also concerns that it could look unfavorable to potential work partners going forward if SCS allow mods that may potentially use unlicensed branding.
Posting in the Mods forum (ATS and ETS2) is restricted to sharing free-to-the-public mods and providing support for mods. For more details, please check the Forum Rules.
SCS as a company do not wish to have paid mods on this forum. While we understand that not all paid mods use the Intellectual Property of other companies/people, it is very hard to moderate what is and isn't acceptable when money is involved. There are also concerns that it could look unfavorable to potential work partners going forward if SCS allow mods that may potentially use unlicensed branding.
Posting in the Mods forum (ATS and ETS2) is restricted to sharing free-to-the-public mods and providing support for mods. For more details, please check the Forum Rules.
Re: [WIP][Guide] How to create on-board computer mod.
Thank you for taking the time for this. I have already made use of this to adjust the dash for Cascadia fix
ETS2:
Real Tires Mod
Search for Drivetrain Revision mods!
Truck fix doctor
ATS:
Real Tires Mod
Search for Drivetrain Revision mods!
Truck fix doctor
Real Tires Mod
Search for Drivetrain Revision mods!
Truck fix doctor
ATS:
Real Tires Mod
Search for Drivetrain Revision mods!
Truck fix doctor
Re: [WIP][Guide] How to create on-board computer mod.
Next time you will do not ask me about dashboard mod for next truck you improve.
Re: [WIP][Guide] How to create on-board computer mod.
I think you would still to it 10 times quicker than me
ETS2:
Real Tires Mod
Search for Drivetrain Revision mods!
Truck fix doctor
ATS:
Real Tires Mod
Search for Drivetrain Revision mods!
Truck fix doctor
Real Tires Mod
Search for Drivetrain Revision mods!
Truck fix doctor
ATS:
Real Tires Mod
Search for Drivetrain Revision mods!
Truck fix doctor
Re: [WIP][Guide] How to create on-board computer mod.
But I can't fix truck model like you.
Re: [WIP][Guide] How to create on-board computer mod.
Thank you for this useful guide!!! Yesterday I was messing up with your daf xf dashboard mod and never found a way to make the text in white, I was using the hex FFFFF code but it doesn't work, luckily I came accross this guide and manage to get the text in white as i wanted.
Re: [WIP][Guide] How to create on-board computer mod.
nameless names exist only for unit serialization and deserialization purpose (saving/loading to file). units in memory are linked by pointers between themselves (eg accessory list in truck or window children in dash ui), but if you want to save this structure (perform savegame, or create dash data file), you need to handle the pointer links. thus some unique name must be created for each unit (memory address is unique enough ) and unit structure saved using these names. upon loading it is similar process - units are allocated and created and in second pass interlinked by searching their names (the scope is single unit tree, typically one SiiNunit file + includes). then if the names are "_nameless", they are forgotten. nameless units will get new name if saved later.cipinho wrote: ↑21 Aug 2019 08:01 Thanks Max, good explanation on "_nameless". I had some questions about the goal of this structure, now it's clear (as clear can be for one who does not know coding)
I have only few questions about what's coming after it, that random combination of numbers and letters is automatically generated at every game load or it's stays as defined initially? then are any rules about the length of the text . I see often 2 groups of 4 characters separated by a dot, sometimes 3 groups of 3 characters.
and yet the game do not accept duplicates as I was hoping, I multiplied one file once with _nameless and the game couldn't load it because of conflict with the original. the problem I had was that I could not use mass edit and I had to modify manually about 50 lines
what you can see in data files are some data generated by tool (name like "_nameless.12AB.34EF"), and files written by human (name like ".clock"). but unit naming mechanic works in both cases in same way - well, the game does not see the difference ..
named units (like "country.germany") keep their name after load. they are used for definition linking anytime not just during load - eg cities country "link" are runtime created by taking country token ("germany") and adding prefix token "country". and then unit can be found and retrieved just by searching. typically, named units are like "global data".
Nobody can tell you anything about it. Those who know about it aren't allowed to talk. And those who talk know nothing.
Re: [WIP][Guide] How to create on-board computer mod.
it's great Max, thank you! I deal more with truck accessories than with dashboards, so very helpful for me! if the "nameless" names are different at every game load, it means that to duplicate such file is enough to make a copy/paste version, change the def of the truck into the new, load the game without the cloned version first, the game will generate new units and then I can connect the "clone" the theory sounds great, let's see in practice! thanks a lot!
Re: [WIP][Guide] How to create on-board computer mod.
Part 5. Images.
Of course you will add images on your dashboard computer, like, icons, signs, logos and so on.
Here is some notes about using images for dash.
Game image composed of three files: texture file (DDS), flags and some setting for this texture (TOBJ) and material file (MAT)
In many cases texture (DDS) must have size as "power of 2" for example 32x32 or 128x128 or 1024x1024, can be 32x256 or any other values as power of 2. So 48x260 you can create, but you will have some problems in game. If you have image 48x260 - you must place it in file with 64x512 pixels, and "crop" it for use in your dash. Now I will show how you can do it.
For example, file with icons (I invert colors so you can see image) typically image is "white" with alpha channel, so you can't see it on this page.
[ external image ]
Original image size is 256x256 pixels.
Suppose we have to take second image on top row. We want set image size 64x64 on game dash, in top left corner of dash area
ui::text : .outtemp{
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF >"
coords_l: 10 && 10 pixels from left side
coords_r: 74 && 10 + 64 = 74 - right side
coords_t: 790 && 10 pixels from top side
coords_b: 726 && 790-64=726 - bottom position of image
id: 0 && no game action - just a picture only
layer: 1 && drawing layer
my_parent: .fld
}
But in this case you will see 64x64 part of top left cornet of pict.dds file.
Here it 2 way to "crop" image from file
First
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF left=0.5 right=1 bottom=0.5>"
Where I set
image left position start at 0.5 size of full pict.dds file
right position at full pict.dds file width = 1
bottom at 0.5 of pict.dds file height.
top we do not need because it still 1
for second image on second row it will be top=0.5 left=0.5 right=1 bottom=1
I don't remember, but maybe you can omit right and bottom in this case.
Second
You can set position in file pixel measurement. We remember that size of texture is 256x256
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF top=p0 left=p128 bottom=p128 right=p256>"
So you can set prefix "p" when you using "pixel" measurement
Image size on the dash
We want to set 64x64 image size on the dash. So we can set size at once
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF top=p0 left=p128 bottom=p128 right=p256 width=64 height=64>"
Or we don't know size and will adjust size of image when we will see dash in game. In this case we can use special parameter "xscale" and "yscale".
xscale - horizontal axle
yscale - vertical axle
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF top=p0 left=p128 bottom=p128 right=p256 xscale-stretch yscale=stretch>"
in this case we "stretch" image in our item dimension by both axles
coords_l: 10
coords_r: 74
coords_t: 790
coords_b: 726
If you will create some of images in one dash element and you too lazy like me, you can set parameter "color value" before.
text: "<color value=FFFFFFFF><img src=/material/ui/dashboard/volvo_fh16.mat top=p0 left=p128 bottom=p128 right=p256 xscale-stretch yscale=stretch>"
You can flip over image from left-to-right and from top-to-bottom bu change coordinates position of image
We can show mirrored icon left-to-right, just to change left and right coordinates
Original line
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF top=p0 left=p128 bottom=p128 right=p256 width=64 height=64>"
Flip left-to-right
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF top=p0 left=p256 bottom=p128 right=p128 width=64 height=64>"
And top-to-bottom
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF top=p128 left=p128 bottom=p0 right=p256 width=64 height=64>"
Same method use SCS for cruise-control display for Next-Gen Scania
to be continued...
Of course you will add images on your dashboard computer, like, icons, signs, logos and so on.
Here is some notes about using images for dash.
Game image composed of three files: texture file (DDS), flags and some setting for this texture (TOBJ) and material file (MAT)
In many cases texture (DDS) must have size as "power of 2" for example 32x32 or 128x128 or 1024x1024, can be 32x256 or any other values as power of 2. So 48x260 you can create, but you will have some problems in game. If you have image 48x260 - you must place it in file with 64x512 pixels, and "crop" it for use in your dash. Now I will show how you can do it.
For example, file with icons (I invert colors so you can see image) typically image is "white" with alpha channel, so you can't see it on this page.
[ external image ]
Original image size is 256x256 pixels.
Suppose we have to take second image on top row. We want set image size 64x64 on game dash, in top left corner of dash area
ui::text : .outtemp{
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF >"
coords_l: 10 && 10 pixels from left side
coords_r: 74 && 10 + 64 = 74 - right side
coords_t: 790 && 10 pixels from top side
coords_b: 726 && 790-64=726 - bottom position of image
id: 0 && no game action - just a picture only
layer: 1 && drawing layer
my_parent: .fld
}
But in this case you will see 64x64 part of top left cornet of pict.dds file.
Here it 2 way to "crop" image from file
First
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF left=0.5 right=1 bottom=0.5>"
Where I set
image left position start at 0.5 size of full pict.dds file
right position at full pict.dds file width = 1
bottom at 0.5 of pict.dds file height.
top we do not need because it still 1
for second image on second row it will be top=0.5 left=0.5 right=1 bottom=1
I don't remember, but maybe you can omit right and bottom in this case.
Second
You can set position in file pixel measurement. We remember that size of texture is 256x256
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF top=p0 left=p128 bottom=p128 right=p256>"
So you can set prefix "p" when you using "pixel" measurement
Image size on the dash
We want to set 64x64 image size on the dash. So we can set size at once
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF top=p0 left=p128 bottom=p128 right=p256 width=64 height=64>"
Or we don't know size and will adjust size of image when we will see dash in game. In this case we can use special parameter "xscale" and "yscale".
xscale - horizontal axle
yscale - vertical axle
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF top=p0 left=p128 bottom=p128 right=p256 xscale-stretch yscale=stretch>"
in this case we "stretch" image in our item dimension by both axles
coords_l: 10
coords_r: 74
coords_t: 790
coords_b: 726
If you will create some of images in one dash element and you too lazy like me, you can set parameter "color value" before.
text: "<color value=FFFFFFFF><img src=/material/ui/dashboard/volvo_fh16.mat top=p0 left=p128 bottom=p128 right=p256 xscale-stretch yscale=stretch>"
You can flip over image from left-to-right and from top-to-bottom bu change coordinates position of image
We can show mirrored icon left-to-right, just to change left and right coordinates
Original line
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF top=p0 left=p128 bottom=p128 right=p256 width=64 height=64>"
Flip left-to-right
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF top=p0 left=p256 bottom=p128 right=p128 width=64 height=64>"
And top-to-bottom
text: "<img src=/material/ui/dashboard/volvo_fh16.mat color=FFFFFFFF top=p128 left=p128 bottom=p0 right=p256 width=64 height=64>"
Same method use SCS for cruise-control display for Next-Gen Scania
Code: Select all
ui::text : _nameless._.cc_graphics {
text: "<img src=/material/ui/dashboard/scania_2016/dashboard_computer.mat xscale=stretch yscale=stretch left=p95 right=p0 top=p137 bottom=p253>"
coords_l: 107
coords_r: 337
coords_t: 480
coords_b: 217
area_l: 1
area_r: 0
area_t: 0
area_b: 1
id: 0
layer: 4
tab: -1
pointer: -1
apparent_depth: 0
my_parent: _nameless._.display4
}
ui::text : _nameless._.cc_graphics.0000 {
text: "<img src=/material/ui/dashboard/scania_2016/dashboard_computer.mat xscale=stretch yscale=stretch left=p0 right=p95 top=p137 bottom=p253>"
coords_l: 336
coords_r: 566
coords_t: 480
coords_b: 217
area_l: 1
area_r: 0
area_t: 0
area_b: 1
id: 0
layer: 4
tab: -1
pointer: -1
apparent_depth: 0
my_parent: _nameless._.display4
}
Last edited by piva on 27 Aug 2019 08:04, edited 2 times in total.
Re: [WIP][Guide] How to create on-board computer mod.
Info relocated. Topic Removed
Last edited by piva on 27 Aug 2019 08:05, edited 1 time in total.
Re: [WIP][Guide] How to create on-board computer mod.
Part 6.Fonts
All available fonts you can see in /font/ folder of base.scs. Font file extension is ".font"
Most usable fonts are "big","normal","small". Of course you can use other fonts or your own custom fonts (SCS do not share "fontget.exe" tools for all), but you must be noticed, that supported symbols you can see in .font file.
Example of "big.font"
x0020, 28, 383, 0, 0, 0, 19, 5, 0 # ' ' / 'SPACE'
x0021, 252, 79, 3, 14, 2, 5, 6, 0 # '!' / 'EXCLAMATION MARK'
x0022, 195, 372, 7, 5, 1, 5, 9, 0 # '"' / 'QUOTATION MARK'
x0023, 33, 169, 10, 14, 1, 5, 12, 0 # '#' / 'NUMBER SIGN'
x0024, 140, 151, 10, 16, 0, 5, 11, 0 # '$' / 'DOLLAR SIGN'
x0025, 44, 169, 16, 14, 1, 5, 18, 0 # '%' / 'PERCENT SIGN'
x0026, 217, 151, 13, 15, 1, 5, 14, 0 # '&' / 'AMPERSAND'
x0027, 203, 372, 3, 5, 1, 5, 5, 0 # ''' / 'APOSTROPHE'
x0028, 162, 1, 5, 18, 1, 5, 7, 0 # '(' / 'LEFT PARENTHESIS'
x0029, 168, 1, 6, 18, 0, 5, 7, 0 # ')' / 'RIGHT PARENTHESIS'
x002a, 247, 245, 8, 7, 0, 5, 8, 0 # '*' / 'ASTERISK'
x002b, 119, 372, 10, 9, 1, 8, 12, 0 # '+' / 'PLUS SIGN'
x002c, 251, 200, 4, 7, 0, 16, 5, 0 # ',' / 'COMMA'
x002d, 218, 372, 5, 3, 1, 12, 7, 0 # '-' / 'HYPHEN-MINUS'
x002e, 224, 372, 3, 3, 1, 16, 5, 0 # '.' / 'FULL STOP'
x002f, 61, 169, 7, 14, -1, 5, 5, 0 # '/' / 'SOLIDUS'
x0030, 69, 169, 9, 14, 1, 5, 11, 0 # '0' / 'DIGIT ZERO'
x0031, 79, 169, 7, 14, 1, 5, 11, 0 # '1' / 'DIGIT ONE'
x0032, 87, 169, 10, 14, 0, 5, 11, 0 # '2' / 'DIGIT TWO'
x0033, 98, 169, 9, 14, 1, 5, 11, 0 # '3' / 'DIGIT THREE'
x0034, 108, 169, 10, 14, 1, 5, 12, 0 # '4' / 'DIGIT FOUR'
x0035, 119, 169, 10, 14, 0, 5, 10, 0 # '5' / 'DIGIT FIVE'
x0036, 130, 169, 9, 14, 1, 5, 11, 0 # '6' / 'DIGIT SIX'
x0037, 140, 169, 9, 14, 1, 5, 11, 0 # '7' / 'DIGIT SEVEN'
x0038, 150, 169, 9, 14, 1, 5, 11, 0 # '8' / 'DIGIT EIGHT'
x0039, 160, 169, 9, 14, 1, 5, 11, 0 # '9' / 'DIGIT NINE'
For example, I want to add some info on the dash with 100 pixels height.
You can see parameter
vert_span:25 # max difference between lowest and highest pixel in any two glyphs
so we must increase size of font at 4 times.
In this case define font attribute
text: "<font face=/font/big.font xscale=4 yscale=4>YOUR TEXT HERE</font>"
with attribute "yscale" and "xscale" we increase font size in horizontal and vertical by 4 times.
Please do not forget about close tag </font>. Now game show warnings if you forgot about it.
Most used font template is to show truck info, like: speed, odometer value, trip length, fuel in tanks, temperature and so on.
Many of this indicators have 2 parameters in game, so, for example "odometer" have 2 parts "numbers" and measurement uint
So your indicator template with looks like
text: "<font face=/font/big.font xscale=4 yscale=4>%0 %1</font>"
Parameters begins from "0"
But I don't like when measurement unit have the same size as numbers, so here I show some ways how to change measurement size and fonts in one template. All templates for your dashboard stored in "/ui/template/dashboard_text.<YOUR ID FOR MOD>.sii" file.
file format
You can omit parameter "name" because SCS do not share dashboard create tool, so this parameters can be used just for readability only.
So. I prepare three template for show, how to use some special attributes for change measurement units in your dash
1. using "subscript" attribute.
text: "<font face=/font/big.font xscale=4 yscale=4>%0 <sub>%1</sub></font>"
[ external image ]
2. using "superscript" attribute. Can be used for temperature or some special unit.
text: "<font face=/font/big.font xscale=4 yscale=4>%0 <sup>%1</sup></font>"
[ external image ]
3. using "offset" attribute'. This variant can help you if you using 2 different fonts and/or colors for measurement units.
text: "<font face=/font/big.font xscale=4 yscale=4>%0</font><font face=/font/big.font xscale=2 yscale=2><offset vshift=30> %1</font>"
[ external image ]
Please do not forget, that you public mod can be used in all the world by players with any languages and all measurements units fonts must support all languages that used in game.
To be continued...
All available fonts you can see in /font/ folder of base.scs. Font file extension is ".font"
Most usable fonts are "big","normal","small". Of course you can use other fonts or your own custom fonts (SCS do not share "fontget.exe" tools for all), but you must be noticed, that supported symbols you can see in .font file.
Example of "big.font"
x0020, 28, 383, 0, 0, 0, 19, 5, 0 # ' ' / 'SPACE'
x0021, 252, 79, 3, 14, 2, 5, 6, 0 # '!' / 'EXCLAMATION MARK'
x0022, 195, 372, 7, 5, 1, 5, 9, 0 # '"' / 'QUOTATION MARK'
x0023, 33, 169, 10, 14, 1, 5, 12, 0 # '#' / 'NUMBER SIGN'
x0024, 140, 151, 10, 16, 0, 5, 11, 0 # '$' / 'DOLLAR SIGN'
x0025, 44, 169, 16, 14, 1, 5, 18, 0 # '%' / 'PERCENT SIGN'
x0026, 217, 151, 13, 15, 1, 5, 14, 0 # '&' / 'AMPERSAND'
x0027, 203, 372, 3, 5, 1, 5, 5, 0 # ''' / 'APOSTROPHE'
x0028, 162, 1, 5, 18, 1, 5, 7, 0 # '(' / 'LEFT PARENTHESIS'
x0029, 168, 1, 6, 18, 0, 5, 7, 0 # ')' / 'RIGHT PARENTHESIS'
x002a, 247, 245, 8, 7, 0, 5, 8, 0 # '*' / 'ASTERISK'
x002b, 119, 372, 10, 9, 1, 8, 12, 0 # '+' / 'PLUS SIGN'
x002c, 251, 200, 4, 7, 0, 16, 5, 0 # ',' / 'COMMA'
x002d, 218, 372, 5, 3, 1, 12, 7, 0 # '-' / 'HYPHEN-MINUS'
x002e, 224, 372, 3, 3, 1, 16, 5, 0 # '.' / 'FULL STOP'
x002f, 61, 169, 7, 14, -1, 5, 5, 0 # '/' / 'SOLIDUS'
x0030, 69, 169, 9, 14, 1, 5, 11, 0 # '0' / 'DIGIT ZERO'
x0031, 79, 169, 7, 14, 1, 5, 11, 0 # '1' / 'DIGIT ONE'
x0032, 87, 169, 10, 14, 0, 5, 11, 0 # '2' / 'DIGIT TWO'
x0033, 98, 169, 9, 14, 1, 5, 11, 0 # '3' / 'DIGIT THREE'
x0034, 108, 169, 10, 14, 1, 5, 12, 0 # '4' / 'DIGIT FOUR'
x0035, 119, 169, 10, 14, 0, 5, 10, 0 # '5' / 'DIGIT FIVE'
x0036, 130, 169, 9, 14, 1, 5, 11, 0 # '6' / 'DIGIT SIX'
x0037, 140, 169, 9, 14, 1, 5, 11, 0 # '7' / 'DIGIT SEVEN'
x0038, 150, 169, 9, 14, 1, 5, 11, 0 # '8' / 'DIGIT EIGHT'
x0039, 160, 169, 9, 14, 1, 5, 11, 0 # '9' / 'DIGIT NINE'
For example, I want to add some info on the dash with 100 pixels height.
You can see parameter
vert_span:25 # max difference between lowest and highest pixel in any two glyphs
so we must increase size of font at 4 times.
In this case define font attribute
text: "<font face=/font/big.font xscale=4 yscale=4>YOUR TEXT HERE</font>"
with attribute "yscale" and "xscale" we increase font size in horizontal and vertical by 4 times.
Please do not forget about close tag </font>. Now game show warnings if you forgot about it.
Most used font template is to show truck info, like: speed, odometer value, trip length, fuel in tanks, temperature and so on.
Many of this indicators have 2 parameters in game, so, for example "odometer" have 2 parts "numbers" and measurement uint
So your indicator template with looks like
text: "<font face=/font/big.font xscale=4 yscale=4>%0 %1</font>"
Parameters begins from "0"
But I don't like when measurement unit have the same size as numbers, so here I show some ways how to change measurement size and fonts in one template. All templates for your dashboard stored in "/ui/template/dashboard_text.<YOUR ID FOR MOD>.sii" file.
file format
Code: Select all
SiiNunit
{
ui::text_template : example.sub {
text: "<font face=/font/big.font xscale=4 yscale=4>%0 <sub>%1</sub></font>"
}
ui::text_template : example.sup {
text: "<font face=/font/big.font xscale=4 yscale=4>%0 <sup>%1</sup></font>"
}
ui::text_template : example.offset {
text: "<font face=/font/big.font xscale=4 yscale=4>%0</font><font face=/font/big.font xscale=2 yscale=2><offset vshift=30> %1</font>"
}
}
So. I prepare three template for show, how to use some special attributes for change measurement units in your dash
1. using "subscript" attribute.
text: "<font face=/font/big.font xscale=4 yscale=4>%0 <sub>%1</sub></font>"
[ external image ]
2. using "superscript" attribute. Can be used for temperature or some special unit.
text: "<font face=/font/big.font xscale=4 yscale=4>%0 <sup>%1</sup></font>"
[ external image ]
3. using "offset" attribute'. This variant can help you if you using 2 different fonts and/or colors for measurement units.
text: "<font face=/font/big.font xscale=4 yscale=4>%0</font><font face=/font/big.font xscale=2 yscale=2><offset vshift=30> %1</font>"
[ external image ]
Please do not forget, that you public mod can be used in all the world by players with any languages and all measurements units fonts must support all languages that used in game.
To be continued...
Last edited by piva on 28 Aug 2019 07:21, edited 2 times in total.
Who is online
Users browsing this forum: No registered users and 9 guests