SnowRunner

SnowRunner

Discover a wealth of new maps, vehicles, modes, and more, all created by the community! Discover something new every day and expand your SnowRunner experience.

Find the game on Epic Games, Xbox, Playstation, Facebook, Twitter, Instagram, Reddit, Forums, Discord.

Integration of Trucks and Addons. Part #2.

This guide describes the integration of Trucks and Addons. Part #2 of this guide describes the XML structure (Chapters 5 to 6).

Posted by on (updated ago)


Please refer to Part #1 of this guide for the general info on modding files (Chapters 1-4).

If you want an offline copy, you can download this full guide in PDF format from here.

5. XML Structure

5.1. Main Principles

  • The names of tags, attributes, and values are case-sensitive.
  • All values of attributes, including numeric values, must be in quotation marks.
  • XML has a hierarchy of tags. Any tag has its own place in the general hierarchy and must not violate it.
  • Each opened tag must be closed.
    • If a tag is located on the lowest level of hierarchy, it is written in the form similar to:
      <TagName Attr1="a" Attr2="b" />
    • If a tag has children tags, it is written in the form similar to:
      <TagName Attr1="a" Attr2="b"> 
            children Tags 
      </TagName>
  • The order of tags that are located on the same level in hierarchy is typically not important. However, there are exceptions from this rule that will be discussed separately.
  • Each tag has its own particular set of attributes. Any attribute of a tag can be either mandatory or optional.
  • Tags with the same name, but with different parent tags - have different purposes.
  • You can use common and local templates (_templates) in the XML file.
  • An XML file can be inherited from another XML file (_parent) that is located in the same folder.

5.2. Mesh of the Truck: Tags in the XML file

5.2.1. Minimum set

<CombineXMesh>
    <Material />
</CombineXMesh>

5.2.2. All tags

<_templates />
<_parent />
<CombineXMesh>
    <SocketPoints>
        <SocketPoint />
    </SocketPoints>
    <MaterialOverrides>
        <MaterialOverride />
    </MaterialOverrides>
    <Material />
</CombineXMesh>

5.3. Mesh of the Wheel: Tags in the XML file

5.3.1. Wheel as a single entity

<CombineXMesh Type="Wheel">
    <WheelMesh/>
    <Material />
</CombineXMesh>

5.3.2. Tire or Rim

<CombineXMesh Type="Wheel">
    <Material />
</CombineXMesh>

5.4. Classes of the Truck & Addons: Tags

5.4.1. Truck

5.4.1.1. Minimum set

<Truck>
    <TruckData>
        <Wheels>
            <Wheel/>
        </Wheels>
        <SuspensionSocket />
        <GearboxSocket />
        <EngineSocket />
        <CompatibleWheels />
    </TruckData>
    <PhysicsModel>
        <Body />
    </PhysicsModel>
</Truck>

5.4.1.2. All tags

<_templates />
<_parent />
<Truck>
    <TruckData>
        <Winch/>
        <Wheels>
            <Wheel/>
        </Wheels>
        <SuspensionSocket />
        <SteeringWheel />
        <SteeringRack />
        <Steam />
        <SoundsWheels>
            <WheelWater />
            <WheelSteer />
            <WheelSpinning />
            <WheelMud />
            <WheelExtrude />
            <WheelDamaged />
            <WheelChains />
            <WaterHit />
        </SoundsWheels>
        <SoundsDamage>
            <Wheels />
            <Suspension />
            <Gearbox />
            <FuelTank />
            <Engine />
            <Critical />
            <Common />
        </SoundsDamage>
        <Sounds>
            <Honk />
            <Handbrake />
            <HandbrakeOff />
            <BrakePull />
            <BrakeRelease />
            <BrakesSqueal />
            <Reverse />
            <Gear />
            <EngineTrans />
            <EngineAccel />
            <EngineRev />
            <EngineStart />
            <EngineStop />
            <EngineIdle />
            <EngineIdle_2d />
            <EngineLow />
            <EngineLow_2d />
            <EngineHigh />
            <EngineHigh_2d />
            <EngineHeavy />
            <EngineHeavy_2d />
            <EngineTurbo />
            <DiffLock />
            <ChassisStress />
            <AWD />
            <AbruptStop />
        </Sounds>
        <Shakers>
            <Shaker />
        </Shakers>
        <Shafts>
            <Shaft />
        </Shafts>
        <OcclusionMap />
        <Messages />
        <LimitedFluid />
        <Intake />
        <GearboxSocket />
        <FuelTank />
        <Exhaust />
        <EngineSocket />
        <Driver />
        <Dashboard>
            <Gauge />
        </Dashboard>
        <Damage>
            <DamageArea />
        </Damage>
        <CompatibleWheels />
        <Camera>
            <Cockpit>
                <Rear />
                <Mirror />
                    <SecondaryView />
                </Mirror>
            </Cockpit>
        </Camera>
        <Axles>
            <Axle />
        </Axles>
    </TruckData>
    <Snorkel />
    <Rotator />
    <PhysicsModel>
        <NetSync />
        <Body>
            <Body>
                <Constraint>
                    <Motor />
                    <PlaneMotor />
                    <ConeMotor />
                    <TwistMotor />
                    <AllMotor />
                </Constraint>
            </Body>
        </Body>
    </PhysicsModel>
    <ModelAttachments>
        <StopSignals>
            <Model />
            <Light />
            <Flare />
        </StopSignals>
        <ReverseSignals>
            <Model />
            <Light />
            <Flare />
        </ReverseSignals>
        <Ignition>
            <Model />
            <Light />
            <Flare />
        </Ignition>
        <HeadLight>
            <Model />
            <Light />
            <Flare />
        </HeadLight>
    </ModelAttachments>
    <Landmark />
    <HeadLight />
    <GameData>
        <WinchSocket />
        <UiDesc />
        <CustomizationCameras>
            <CameraPos />
        <CustomizationCameras />
        <CraneSocket />
        <AddonSockets>
            <Socket>
                <ExtraParent />
                <AddonsShift />
            </Socket>
        <AddonSockets />
        <AddonSlots />
    </GameData>
    <ControlledConstraints>
        <Constraint />
    </ControlledConstraints>
    <AutomaticIK>
        <IKBone>
            <IKJoint />
            <IKBone>
                <IKJoint />
            </IKBone>
        </IKBone>
    </AutomaticIK>
</Truck>

5.4.2. Suspension

<_templates />
<_parent />
<SuspensionSetVariants>
	<SuspensionSet>
		<Suspension WheelType="front"/>
		<Suspension WheelType="rear"/>
		<GameData>
			<UiDesc/>
		</GameData>
	</SuspensionSet>
</SuspensionSetVariants>

5.4.3. Engine

<_templates />
<_parent />
<EngineVariants>
	<Engine>
		<GameData>
			<UiDesc />
		</GameData>
	</Engine>
</EngineVariants>

5.4.4. Gearbox

<GearboxVariants>
	<Gearbox>
		<ReverseGear />
		<HighGear />
		<Gear />
		<GameData>
			<GearboxParams />
			<UiDesc />
		</GameData>
	</Gearbox>
</GearboxVariants>

5.4.5. Trailer

5.4.5.1. Minimum set

<Truck Type="Trailer">
    <TruckData>
        <Wheels>
            <Wheel />
        </Wheels>
        <Constraint />
    <TruckData>
    <PhysicsModel>
        <Body />
    </PhysicsModel>
</Truck>

5.4.5.2. All tags

<_templates />
<_parent />
<Truck Type="Trailer">
    <TruckData>
        <Wheels>
            <Wheel />
        </Wheels>
        <OcclusionMap />
        <LimitedFluid />
        <Constraint>
            <Motor />
            <PlaneMotor />
            <ConeMotor />
            <TwistMotor />
            <AllMotor />
        </Constraint>
        <CompatibleWheels />
        <Camera />
        <Axles>
            <Axle />
        </Axles>
    <TruckData>
    <PoweredConstraints>
        <Group />
    </PoweredConstraints>
    <PhysicsModel>
        <NetSync />
        <Body>
            <Body>
                <Constraint>
                    <Motor />
                    <PlaneMotor />
                    <ConeMotor />
                    <TwistMotor />
                    <AllMotor />
                </Constraint>
            </Body>
        </Body>
    </PhysicsModel>
    <ModelAttachments>
        <StopSignals>
            <Model />
            <Light />
            <Flare />
        </StopSignals>
        <ReverseSignals>
            <Model />
            <Light />
            <Flare />
        </ReverseSignals>
        <Ignition>
            <Model />
            <Light />
            <Flare />
        </Ignition>
    </ModelAttachments>
    <Landmark />
    <GameData>
        <WinchSocket />
        <UiDesc />
        <RequiredAddon />
        <InstallSocket />
        <CraneSocket />
        <AddonSlots />
    </GameData>
    <FuelMass>
        <Body />
    </FuelMass>
    <AutomaticIK>
        <IKBone>
            <IKJoint />
            <IKBone>
                <IKJoint />
            </IKBone>
        </IKBone>
    </AutomaticIK>
</Truck>

5.4.6. Addon

5.4.6.1. Minimum set

<TruckAddon>
    <PhysicsModel />
    <GameData>
        <InstallSocket />
    </GameData>  
</TruckAddon>

5.4.6.2. All tags

<_templates />
<_parent />
<TruckAddon>
    <WheelRepairsHide>
        <Mesh />
    </WheelRepairsHide>
    <RepairsHide>
        <Mesh />
    </RepairsHide>
    <FuelHide>
        <Mesh />
    </FuelHide>
    <Vibrator />
    <TruckData>
        <Shakers>
            <Shaker />
        </Shakers>
        <Intake />
        <LimitedFluid />
        <Damage>
            <Multiplier />
        </Damage>
    </TruckData>
    <Snorkel />
    <Rotator />
    <PoweredConstraints>
        <Group>
            <Constraint/>
        </Group>
        <Chain>
            <Group>
                <Constraint />
            </Group>
        </Chain>
    </PoweredConstraints>
    <PhysicsModel>
        <NetSync />
        <Body>
            <Constraint>
                <Motor />
                <PlaneMotor />
                <ConeMotor />
                <TwistMotor />
                <AllMotor />
            </Constraint>
        </Body>
    </PhysicsModel>
    <ModelAttachments>
        <Lightbar>
            <Model />
            <Light />
            <Flare />
        </Lightbar>
        <StopSignals>
            <Model />
            <Light />
            <Flare />
        </StopSignals>
        <ReverseSignals>
            <Model />
            <Light />
            <Flare />
        </ReverseSignals>
        <Ignition>
            <Model />
            <Light />
            <Flare />
        </Ignition>
        <MainHeadLight>
            <Model />
            <Light />
            <Flare />
        </MainHeadLight>
    </ModelAttachments>
    <MainHeadLight />
    <GameData>
        <UiDesc />
        <RequiredAddonType />
        <RequiredAddon />
        <InstallSocket />
        <InstallSlot />
        <Sounds />
        <SoundPoweredGroupStop />
        <SoundPoweredGroupStart />
        <SoundPoweredGroupLoop />
        <SoundIKStop />
        <SoundIKStart />
        <SoundIKLoop />
        <SoundOpenStart />
        <SoundOpenLoop />
        <SoundOpenStop />
        <SoundClose />
        <CraneSourceSocket />
        <Chain>
            <Group>
                <Constraint />
            </Group>
        <Chain>
        <AddonType />
        <AddonSlots />
    </GameData>  
    <FuelMass>
        <Body />
    </FuelMass>
    <ExplicitParents>
        <ExplicitParent />
    </ExplicitParents>
    <Exhaust />
    <ControlledIK>
        <Chain>
            <ConstraintStartPosition />
        </Chain>
    </ControlledIK> 
    <AutomaticIK>
        <IKBone>
            <IKJoint />
            <IKBone>
                <IKJoint />
            </IKBone>           
        </IKBone>
    </AutomaticIK>
    <AddonCamera />
    <ActionGroups>
        <Group>
            <Vibrator />
            <Rotator/>
            <Attachment/>
        </Group>
    </ActionGroups>
</TruckAddon>

5.5. Class of the Wheel: Tags

5.5.1. Wheel as single entity

<_templates />
<_parent />
<TruckWheel>
    <WheelTracks />
    <WheelSoftness />
    <WheelFriction />	
</TruckWheel>

5.5.2. Set of tires and rims

<_templates />
<_parent />
<TruckWheels>
    <TruckTires>
        <TruckTire>
            <WheelTracks />
            <WheelTracks Rear="true"/>
            <WheelSoftness />
            <WheelFriction />
            <GameData>
                <UiDesc/>
            </GameData>
        </TruckTire>
    <TruckTires>
    <TruckRims>
        <TruckRim>
            <GameData>
                <UiDesc />
            </GameData>
        </TruckRim>
    </TruckRims>
</TruckWheels>

5.6. Templates (_templates)

A template is a piece of XML code that can be reused. Both a single tag with predefined parameters and the whole hierarchy of tags can be used as a template.

The _templates tag has only one attribute - Include.

This attribute enables the current XML file to use templates from the following folder: .../_templates
The value of this attribute is the name of the particular template from this folder that you want to use.

For example: <_templates Include="trucks">

The .../_templates/trucks.xml file contains common templates for trucks, addons, and trailers.

Templates can be either included from the external files using Include or described as children of the _templates tag directly inside the XML with which we work.
Any existing tags can be used as children of the _templates tag.

<_templates Include="trucks">
    <WheelRepairsHide>
        <TemplateName1 />
    </WheelRepairsHide>
    <RepairsHide>
        <TemplateName2 />
    </RepairsHide>
    <FuelHide>
        <TemplateName3 />
        <TemplateName4 />
    </FuelHide>
    ...
</_templates>

5.6.1. Sample template and its usage

Below we describe the template of the Wheel tag, named as MyTemplate1:

<_templates>
    <Wheel>
        <MyTemplate1 HardpointY="0.5" HardpointZ="0.5" />
    </Wheel>
</_templates>

After that, we can use this template in the description of the truck via the _template attribute of the Wheel tag:

<Truck>
    <TruckData>
        <Wheels>
            <Wheel _template="MyTemplate1" HardpointX="1"/>
        </Wheels>
	...
    </TruckData>
    ...
</Truck>

The same piece of XML without the template will look like the following:

<Truck>
    <TruckData>
        <Wheels>
            <Wheel HardpointX="1" HardpointY="0.5" HardpointZ="0.5"/>
        </Wheels>
        ...
    </TruckData>
    ...
</Truck>

5.6.2. Repeated usage

The same template can be used multiple times:

<Truck>
    <TruckData>
        <Wheels>
            <Wheel _template="MyTemplate1" HardpointX="1" />
            <Wheel _template="MyTemplate1" HardpointX="1" RightSide="true"/>
            <Wheel _template="MyTemplate1" HardpointX="-1" />
            <Wheel _template="MyTemplate1" HardpointX="-1" RightSide="true"/>
        </Wheels>
        ...
    </TruckData>
    ...
</Truck>

The same piece of XML without the template will look like the following:

<Truck>
    <TruckData>
        <Wheels>
            <Wheel HardpointX="1" HardpointY="0.5" HardpointZ="0.5"/>
            <Wheel 
                HardpointX="1" 
                RightSide="true" 
                HardpointY="0.5" 
                HardpointZ="0.5" 
            />
            <Wheel HardpointX="-1" HardpointX="1" HardpointY="0.5"/>
            <Wheel 
                HardpointX="-1" 
                RightSide="true" 
                HardpointY="0.5" 
                HardpointZ="0.5" 
            />
        </Wheels>
        ...
    </TruckData>
    ...
</Truck>

5.6.3. Templates for multiple tags

Declaration of templates for multiple tags of different types looks like the following:

<_templates>
    <Wheel>
        <MyTemplate1 HardpointY="0.5" HardpointZ="0.5" />
    </Wheel>
    <Body>
        <MyTemplate2 Mass="1"/>
        <MyTemplate3 Mass="5"/>
    </Body>
</_templates>

Where MyTemplate1 - is the template of Wheel tag, and MyTemplate2, MyTemplate3 - are two different templates for the Body tag.

5.6.4. Template for a hierarchy of tags

A template may contain a whole hierarchy of tags.
For example:

Declaration of the template:

<_templates>
    <Body>
        <MyTemplate3 Mass="5">
            <Constraint Type="Hinge" MinLimit="-1" MaxLimit="1">
                <Motor Damping="0.3" Spring="25" Type="Spring" />
            </Constraint>
        </MyTemplate3>
    </Body>
</_templates>

Its usage:

<Truck>
    <PhysicsModel Mesh="trucks/example_truck">
        <Body _template="MyTemplate3">
        </Body>
    </PhysicsModel>
    ...
<Truck>

The same piece of XML without the template will look like the following:

<Truck>
    <PhysicsModel Mesh="trucks/example_truck">
        <Body Mass="5">
            <Constraint Type="Hinge" MinLimit="-1" MaxLimit="1">
                <Motor Damping="0.3" Spring="25" Type="Spring" />
            </Constraint>
        </Body>
    </PhysicsModel>
    ...
<Truck>

5.6.5. Overrides for attribute values

If both a template and a tag that links to it use the same attribute and the tag contains the value of this attribute, then the value specified in the tag will override the value from the template.

For example, in the following XML piece, the value of the HardpointY attribute from the template is overwritten by the value of the same attribute from the tag:

<_templates>
    <Wheel>
        <MyTemplate1 HardpointY="0.5" HardpointZ="0.5" />
    </Wheel>
</_templates>
<Truck>
    <TruckData>
        <Wheels>
            <Wheel _template="MyTemplate1" HardpointX="1" HardpointY="1" />
        </Wheels>
        ...
    </TruckData>
    ...
</Truck>

So, this piece of XML without the template will look like the following:

<Truck>
    <TruckData>
        <Wheels>
            <Wheel HardpointX="1" HardpointY="1" HardpointZ="0.5" />
        </Wheels>
        ...
    </TruckData>
    ...
</Truck>

5.6.6. Extension of the hierarchy

You can add or change attributes or tags in the piece of XML provided by the template. However, when a template describes some hierarchy of tags and you need to add or change an attribute or tag, you will need to recreate all hierarchy of its parent tags.

For example:

<_templates>
    <Body>
        <MyTemplate4 Mass="5">
            <Constraint Type="Fixed" />
            <Body Mass="1">
                <Constraint Type="Hinge" />
                <Body Mass="2">
                    <Constraint Type="Ragdoll" />
                </Body>
            </Body>
        </MyTemplate4>
    </Body>
</_templates>
<Truck>
    <PhysicsModel Mesh="trucks/example_truck">
        <Body Mass="10">
            <Body _template="MyTemplate4">
                <Body>
                    <Body>
                        <Constraint AxisLocal="(1; 0; 0)" />
                    </Body>
                </Body>
            </Body>
            <Body _template="MyTemplate4">
                <Body>
                    <Body>
                        <Body Mass="0.1">
                            <Constraint Type="Fixed" />
                        </Body>
                    </Body>
                </Body>
            </Body>
        </Body>
    </PhysicsModel>
    ...
</Truck>

The same piece of XML without the template will look like the following:

<Truck>
    <PhysicsModel Mesh="trucks/example_truck">
        <Body Mass="10">
            <Body Mass="5">
                <Constraint Type="Fixed" />
                <Body Mass="1">
                    <Constraint Type="Hinge" />
                    <Body Mass="2">
                        <Constraint AxisLocal="(1; 0; 0)" Type="Ragdoll" />
                    </Body>
                </Body>
            </Body>
            <Body Mass="5">
                <Constraint Type="Fixed" />
                <Body Mass="1">
                    <Constraint Type="Hinge" />
                    <Body Mass="2">
                        <Constraint Type="Ragdoll" />
                        <Body Mass="0.1">
                            <Constraint Type="Fixed" />
                        </Body>
                    </Body>
                </Body>
            </Body>
        </Body>
    </PhysicsModel>
    ...
</Truck>

5.6.7. Removal of attributes and tags from the template

Each tag has the _noinherit and _inheritRemove attributes:

  • _noinherit="true" - removes attributes and child tags (inherited from the template) from the tag where it is used.
  • _inheritRemove="true" - removes the tag itself.

For example:

<_templates>
    <Body>
        <MyTemplate4 Mass="5">
            <Constraint Type="Fixed" />
            <Body Mass="1">
                <Constraint Type="Hinge" />
                <Body Mass="2">
                    <Constraint Type="Ragdoll" />
                </Body>
            </Body>
        </MyTemplate4>
    </Body>
</_templates>
<Truck>
    <PhysicsModel Mesh="trucks/example_truck">
        <Body Mass="10">
            <Body _template="MyTemplate4">
                <Body _noinherit="true" ImpactType="Truck">
                    <Constraint Type="Prismatic" />
                </Body>
            </Body>
            <Body _template="MyTemplate4">
                <Body _inheritRemove="true" />
            </Body>
        </Body>
    </PhysicsModel>
    ...
</Truck>

The same piece of XML without the template will look like the following:

<Truck>
    <PhysicsModel Mesh="trucks/example_truck">
        <Body Mass="10">
            <Body Mass="1">
                <Constraint Type="Fixed" />
                <Body ImpactType="Truck">
                    <Constraint Type="Prismatic" />
                </Body>
            </Body>
            <Body Mass="1">
                <Constraint Type="Fixed" />
            </Body>
        </Body>
    </PhysicsModel>
    ...
</Truck>

5.7. Inheritance (_parent)

An XML file can be inherited from another XML file that is located in the same folder.

Working with inheritance is similar to working with templates. I.e., you can change, add, or remove any tags, attributes, and values of the parent XML file. To access a specific tag, you must recreate the hierarchy of its parent tags.

For example:
We havŠµ the following sample files: .../classes/trucks/example_parentfile.xml and .../classes/trucks/example_truck.xml

example_parentfile.xml:

<Truck>
    <PhysicsModel Mesh="trucks/example_parentfile">
        <Body Mass="10">
            <Body Mass="1">
                <Constraint Type="Fixed" />

            </Body>
            <Body Mass="2">
                <Constraint Type="Prismatic" />
            </Body>
        </Body>
    </PhysicsModel>
    ...
</Truck>

example_truck.xml:

<_parent File="example_parentfile" />
<Truck>
    <PhysicsModel Mesh="trucks/example_truck"/>
</Truck>

In this example, the contents of the example_truck.xml are equivalent to the following:

<Truck>
    <PhysicsModel Mesh="trucks/example_truck">
        <Body Mass="10">
            <Body Mass="1">
                <Constraint Type="Fixed" />
            </Body>
            <Body Mass="2">
                <Constraint Type="Prismatic" />
            </Body>
        </Body>
    </PhysicsModel>
    ...
</Truck>

6. Tags and their Parameters

All tags have the inheritRemove="true" and _noinherit="true" parameters (see 5.6.7. above), so these parameters will no longer be mentioned below.

For description of paricular tags and their attributes, please refer to:

  • Part #3 - for description of tags and attributes used for Meshes and Trucks (Chapters 7-8).
  • Part #4 - for tags and attributes used for Suspensions, Engines, Gearboxes, Wheels, and Addons (Chapters 9-14).
  • Part #5 - for tags and attributes used for the creation of custom skins and colorization (Chapter 15).




Comments

Join the community or sign in with your gaming account to join the conversation: