[Guide] How to create on-board computer mod.

User avatar
galimim
Posts: 3254
Joined: 26 Jan 2013 22:11
Location: Slovenija
Contact:

Re: [WIP][Guide] How to create on-board computer mod.

#11 Post by galimim » 21 Aug 2019 11:09

Thank you for taking the time for this. I have already made use of this to adjust the dash for Cascadia fix :D
ETS2:
Real Tires Mod
Search for Drivetrain Revision mods!
Truck fix doctor
ATS:
Real Tires Mod
Search for Drivetrain Revision mods!
Truck fix doctor

User avatar
piva
Posts: 4054
Joined: 29 Oct 2014 16:41

Re: [WIP][Guide] How to create on-board computer mod.

#12 Post by piva » 21 Aug 2019 11:14

Next time you will do not ask me about dashboard mod for next truck you improve. :lol:

User avatar
galimim
Posts: 3254
Joined: 26 Jan 2013 22:11
Location: Slovenija
Contact:

Re: [WIP][Guide] How to create on-board computer mod.

#13 Post by galimim » 21 Aug 2019 11:29

I think you would still to it 10 times quicker than me :lol:
ETS2:
Real Tires Mod
Search for Drivetrain Revision mods!
Truck fix doctor
ATS:
Real Tires Mod
Search for Drivetrain Revision mods!
Truck fix doctor

User avatar
piva
Posts: 4054
Joined: 29 Oct 2014 16:41

Re: [WIP][Guide] How to create on-board computer mod.

#14 Post by piva » 21 Aug 2019 11:34

But I can't fix truck model like you. :lol:

User avatar
Lonestar92
Posts: 189
Joined: 24 May 2019 21:04
Location: Italy

Re: [WIP][Guide] How to create on-board computer mod.

#15 Post by Lonestar92 » 21 Aug 2019 14:34

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.

User avatar
Max
SCS Software
Posts: 6070
Joined: 26 Nov 2012 10:00
Location: SCS, Prague

Re: [WIP][Guide] How to create on-board computer mod.

#16 Post by Max » 22 Aug 2019 05:58

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) :D
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 :lol:
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.
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 .. :D
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.

User avatar
cip
Posts: 5962
Joined: 26 Aug 2016 08:14
Location: Brussels

Re: [WIP][Guide] How to create on-board computer mod.

#17 Post by cip » 22 Aug 2019 09:21

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!
Enjoy driving with my Real Traffic Density for ETS2 and ATS
Enjoy listening my Real Ai Traffic FMOD Sounds for ETS2 and ATS
I have quit SCS forum...

User avatar
piva
Posts: 4054
Joined: 29 Oct 2014 16:41

Re: [WIP][Guide] How to create on-board computer mod.

#18 Post by piva » 22 Aug 2019 10:14

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. :lol:

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
}
to be continued...
Last edited by piva on 27 Aug 2019 08:04, edited 2 times in total.

User avatar
piva
Posts: 4054
Joined: 29 Oct 2014 16:41

Re: [WIP][Guide] How to create on-board computer mod.

#19 Post by piva » 22 Aug 2019 12:38

Info relocated. Topic Removed
Last edited by piva on 27 Aug 2019 08:05, edited 1 time in total.

User avatar
piva
Posts: 4054
Joined: 29 Oct 2014 16:41

Re: [WIP][Guide] How to create on-board computer mod.

#20 Post by piva » 26 Aug 2019 07:55

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

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>"
}
}
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>"
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>"
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>"
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.

Post Reply

Return to “Modding Guides”

Who is online

Users browsing this forum: Mulle33 and 0 guests