Community Forum

vehicle xml parents children and inheritance

Forum Overview >> Farming Simulator 19

CategoryFarming Simulator 19
Created07.01.2021 18:38


Fuman 07.01.2021 18:38
I will attempt to be brief, yet concise. Your patience and assistance are greatly appreciated.

This is my first attempt into modding, and I have a question regarding inheritance. I assume that it is not the same concept, if it even exists, as it is in Java. Specifically, I am learning about adding the specializations to the modDesc.xml file and am curious as to how the term "parent" in the vehicleTypes.xml file is applied.
I have cobbled together an example for a conveyor belt, which I would like to add the specialization of 'drivable".
Taken from the vehicleTypes.xml file, (with text not required for the example being removed, all else verbatim)::

<type name="pickupConveyorBelt" parent="baseFillable">
<specialization name="drivable" />
</type>

<type name="baseFillable" parent="baseAttachable">
// no drivable here
</type>

<type name="baseAttachable" parent="base">
// no drivable here
</type>

<type name="base" className="Vehicle" filename="dataS/scripts/vehicles/Vehicle.lua" >
// no drivable here
</type>

As it seems to me, I have drilled down, following a basic concept of inheritance, and found no instance of "drivable" from child back to parent.
That's okay, children can define fields, methods, etc, that are independent of the parent.... in java at least.

But then I see this fellow:

<type name="baseDrivable" parent="base">
<specialization name="drivable" />
</type>

Is his drivable the same as pickupConveyorBelts drivable?
Are they both inheriting some unlisted drivable from base?
Or, (and I assume this to be the case), is pickupConveyorBelt somehow inheriting drivable from baseDrivable? if so, then how?

Thank you for reading, and I look forward to your responses.
Fuman

Bilbo Beutlin (BBeutlin) 07.01.2021 20:01
The default vehicles use specializations defined in "vehicleTypes.xml".
Unluckily it is not published officially, though earlier FS versions had it at least on DVD.
Google for "fs19 vehicleTypes.xml" - you'll find it within the first hits, also in posts here on GDN.

Fuman 07.01.2021 20:19
Thank you for the reply.
And based on said reply, I am now of the opinion that the vehicleTypes.xml file that I am currently working with, does in fact, predate FS-19 and can not serve me in this endeavor.

However, if I or you are unable to access a document/file that has not been published, then what exactly is it that I am hoping to find in the google search you mentioned ?

Is the keyword, "officially" ?

Thank you
Fuman

Bilbo Beutlin (BBeutlin) 07.01.2021 20:36
I have no idea why they didn't release the vehicleTypes on official sources like they did in earlier versions.
Though I can understand why they didn't on DVD, was perhaps unfinished yet. But at least here on GDN should be this file available on recent version. This is an essential file every modder needs anytime.

Fuman 07.01.2021 20:57
The version in my possession, did in fact come from this very site. So perhaps it is valid after all.

That being said, I wonder now if it is really necessary. I ask this with hesitation, as I am still new at this, but from the few mods I have downloaded too use for study, none of them include any type of specialization in the modDesc.xml file. And these are, according to the rankings of the in-game modHub, rather popular mods (names withheld for courtesy and respect for the authors).

Nonetheless, I endeavor to learn the proper method, whatever that may be...

Your reply's are invaluable.

Thank you,
Fuman

Bilbo Beutlin (BBeutlin) 07.01.2021 21:24
In most cases the default vehicleTypes should be sufficient for general purposes.
Defining a new type is necessary if the vehicle uses custom spec scripts which have to be added manually.

Fuman 07.01.2021 22:35
It worked for a moment, but I have obviously altered something and it now refuses to show up in the mod window of the game launcher.
Maybe your eyes will see what mine cannot ?
Please note that in the beltSystem.xml file that I didn't alter anything below <!-- MARKER --> basically, 90% of the file is unchanged.

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<modDesc descVersion="1">
<author>Fuman</author>
<version>1.0.0.0</version>
<title>
<en>Test Belt</en>
</title>
<description>
<en>
<![CDATA[Price: too much
Maximum speed: really slow

Special features:
- deleteable

Description:
test test test..... did I mention, test ?
]]>
</en>
</description>

<multiplayer supported="true"/>
<iconFilename>icon_beltTestSystem.dds</iconFilename>

<vehicleTypes>
<type name="testBelt" className="Vehicle"
filename="$dataS/scripts/vehicles/Vehicle.lua">
<specialization name="attacherJoints"/>
<specialization name="motorized"/>
<specialization name="steerable"/>
<specialization name="drivable"/>
<specialization name="attachable"/>
<specialization name="enterable"/>
<specialization name="wheels"/>
<specialization name="foldable"/>
<specialization name="cyclindered"/>
<specialization name="wearable"/>
<specialization name="washable"/>
<specialization name="turnOnVehicle"/>
<specialization name="shovel"/>
<specialization name="conveyorBelt"/>
<specialization name="fillUnit"/>
<specialization name="dischargeable"/>
<specialization name="tipOccluder"/>
<specialization name="baseMaterial"/>
</type>
</vehicleTypes>

<l10n>
<text name="function_testingOfBelts">
<en>For the testing of Belts</en>
</text>
</l10n>

<storeItems>
<storeItem xmlFilename="beltSystem.xml"/>
</storeItems>
</modDesc>


And the accompanying xml for the item itself.


<?xml version="1.0" encoding="utf-8" standalone="no"?>
<vehicle type="testBelt">
<annotation>Copyright (C) GIANTS Software GmbH, All Rights Reserved.</annotation>
<storeData>
<name>
<en>Test Belt</en>
</name>
<functions>
<function>$l10n_testingOfBelts</function>
<function>$l10n_function_beltSystem</function>
<function>$l10n_function_beltSystemStart</function>
</functions>
<image>store_beltTestSystem.dds</image>
<price>5</price>
<lifetime>600</lifetime>
<rotation>0</rotation>
<brand>LIZARD</brand>
<category>beltTesting</category>
<shopTranslationOffset>0 0.12 0</shopTranslationOffset>
<shopRotationOffset>2.75 0 0</shopRotationOffset>
<vertexBufferMemoryUsage>153040</vertexBufferMemoryUsage>
<indexBufferMemoryUsage>30132</indexBufferMemoryUsage>
<textureMemoryUsage>3495384</textureMemoryUsage>
<instanceVertexBufferMemoryUsage>0</instanceVertexBufferMemoryUsage>
<instanceIndexBufferMemoryUsage>0</instanceIndexBufferMemoryUsage>
</storeData>
<base>
<typeDesc>$l10n_typeDesc_belt</typeDesc>
<filename>beltSystem.i3d</filename>

<!--MARKER-->

<size width="1.5" length="8"/>
<components>
<component centerOfMass="0 0.35 -0.7" solverIterationCount="10" mass="500"/>
</components>
<schemaOverlay attacherJointPosition="0 0">
<default name="DEFAULT_IMPLEMENT"/>
<turnedOn name="DEFAULT_IMPLEMENT_ON"/>
<selected name="DEFAULT_IMPLEMENT_SELECTED"/>
<turnedOnSelected name="DEFAULT_IMPLEMENT_SELECTED_ON"/>
</schemaOverlay>
</base>

etc, etc, etc, until end of file

</vehicle>

the file names appear to be correct, the file types seem ok, and the two image files are sized and named correctly... it is zipped following the naming convention, and in the correct directory.... as I said, there one moment, reload, and poof, it's gone.

Bilbo Beutlin (BBeutlin) 07.01.2021 23:44
The <modDesc descVersion="1"> is wrong. The FS19 expects at least descVersion="40".

Check your line with <type name="testBelt" .. It contains a CR/LF character (newline). But maybe comes from forum software. In general XML parsers give errors if a tag is not in one line.

For a custom vehicleType I'd urgently recommand to use default types whenever possible and adding only the one or few missing specs. The order of specs is very important because certain specs need other specs as a precondition. I didn't check that in detail. In doubt use the "vehicleTypes.xml" for reference.

And very important:
If you're working on mods always check the game log at first. This will indicate problems or errors and give you valuable hints to fix them.

btw:
For "work in progress" you don't need to zip your mod. This is only required for multiplay.
An unzipped mod is more comfortable to work on and if it is on a fast drive like SSD it is even much quicker processed by the game engine.

Fuman 08.01.2021 00:20
1. I had no idea about the restrictions regarding descVersion... I have changed it "42", (the answer to Life, the Universe, and everything else)
2. It is indeed a newLine character. I assumed it was acceptable.
3. so if it is a custom vehicle, how can it also be a default vehicle ? I think you are saying too choose the default vehicle that most closely resembles the vehicle I want, and add only to the custom vehicle those specializations that aren't included with the default vehicle ???
Also, I know for certain that the specs are not in order as provided in the vehicleType.xml file. I assumed it didn't matter. This ties back into my original question on inheritance....
4. I am unsure of how to use the game logging system, as I wasn't aware it even existed.. this is in-game I assume, in some console that is opend how? and activated via some command in said console ? goooooogle.
5. I do indeed have a very fast ssd drive.... what wonderful news that I only have to zip the files for multiplayer!

I shall report back once the edits have been made....

Thank you for imparting a fraction of your experience to lighten the path.

Fuman

Fuman 08.01.2021 01:01
Alas, functionality has returned!
Although, once I focus on the mod in the in-game modHub interface, by selecting the icon_image, and then select "details", there is no picture... I assume that this is reperesented by yet a third image file that is required in the directory ? The icon_image in modHub works, the store_image in the in-game store works.... Now I need to discern the source of the niffty screen shot photo in the details screen.

and for clarity's sake I am showing the specializations list again.... Please note the order is from top to bottom as read from the vehicleTypes.xml file. Also note that by starting at vehicles "base" and then drilling down to "conveyor", some of the specializations contained in conveyor were encountered in previous parent classes and were added to the list before conveyor... is this correct ?

<vehicleTypes>
<type name="testBelt" className="Vehicle" filename="$dataS/scripts/vehicles/Vehicle.lua">
<specialization name="baseMaterial"/>
<specialization name="tipOccluder"/>
<specialization name="wearable"/>
<specialization name="washable"/>
<specialization name="cyclindered"/>
<specialization name="wheels"/>
<specialization name="enterable"/>
<specialization name="fillUnit"/>
<specialization name="motorized"/>
<specialization name="drivable"/>
<specialization name="attacherJoints"/>
<specialization name="attachable"/>
<specialization name="foldable"/>
<specialization name="dischargeable"/>
<specialization name="turnOnVehicle"/>
<specialization name="shovel"/>
<specialization name="conveyorBelt"/>
</type>
</vehicleTypes>

For some odd reason the list included <specialization name="steerable"/>, which apparently isn't a specialization at all !

Kudos sir, you are most generous.

Fuman

Bilbo Beutlin (BBeutlin) 08.01.2021 01:26
"42"? LOL
The FS19 initial release has started with version 40 and was incremented with each major update.
The version number is also used to check compatibility. Let's say your mod has vs. 44 and with vs. 45 was introduced a new feature or method. Then it may happen, the mod with lower vs. cannot use this new methods and falls back into a "compatibility mode" or even refuses work.

Yes - I have meant "most closely" to a default vehicleType and merely adding missing specs.
Also, since the "vehicleTypes.xml" becomes actualized with each update, you can go sure possibly new specs are already included.

The game logfile you find in your FS user folder {USER}\Documents\My Games\FarmingSimulator...\log.txt
Indeed there's also a console which you must enable explicitely, see
https://gdn.giants-software.com/documentation_overview.php

About images from ingame ModHub I can't say much, since I don't use it and download directly from ModHub website.

The spec "steerable" is obsolete, however was used in earlier FS. Be sure to use always the right "vehicleTypes.xml" for each FS version.


Note: Log in to post. Create a new account here.