How to Make Vehicles Move in Your Farming Simulator Mod

By Jason van Gumster, Christian Ammann

Your Farming Simulator mod isn’t much of a vehicle if it has no capability to go. It becomes a very attractive lawn ornament. The remedy to get your mod moving lies within the <wheels> and <motor> tags of your vehicle XML file.

Focusing on the wheels

As a tag unto itself, the <wheels> tag only has a single attribute, autoRotateBackSpeed. This attribute defines the rate at which the steering wheel returns to the center when the player releases the steering controls.

Within the open and close of the <wheels> tag is a series of tags, appropriately called <wheel>, for each of the wheels in your vehicle. The following list goes through the main attributes for each <wheel> tag:

  • repr: At the very least, every <wheel> tag must have this attribute. This is the index path to your vehicle’s actual wheel object or its parent fender, but not the wheel’s collision object.

  • driveNode: If your wheel is a child of a fender, and that fender doesn’t rotate, the repr attribute should be the fender’s index path. This attribute should be the index path of your actual wheel object.

  • rotMax/rotMin: These attributes dictate the limits of how much the wheels can rotate for steering purposes, which means that for nonsteering wheels, both of these attributes should be zero.

  • rotSpeed: This rotation attribute dictates the maximum speed that a wheel can rotate when steering. If you have rear-wheel steering on your vehicle, set this attribute with a negative value.

  • radius: You can measure your wheel’s radius in your 3D modeling program (assuming you used real-world units) and enter that value, in meters, here.

  • suspTravel: GIANTS Engine’s physics system implements virtual springs (shock absorbers) on each wheel. This attribute controls the length of the spring that’s suspending the wheel.

  • spring/damper: These two attributes work together to control the physics properties of the virtual spring. Set the spring attribute too high and your vehicle bounces all over the place. Set the damper too high and your vehicle may cruise over even the roughest terrain like it’s a paved road.

  • deltaY: The virtual spring is located at the center of the repr object and points downward along the y-axis, which causes your vehicle’s wheels to push down. You can compensate for this effect using the deltaY attribute. As a starting point, set the value for this attribute to half the value used in the suspTravel attribute.

  • maxLongStiffness/maxLatStiffness: The stiffness attributes specifically relate to longitudinal and lateral friction of your vehicle’s wheels. Friction is what allows wheels to move vehicles, so you should spend some time tweaking these attributes. Set them too high and your vehicle will be unable to move. Set them too low and it will feel like driving on ice.

  • mass: This value determines the rate the wheel can be accelerated by the motor. The higher the mass, the slower it will accelerate. A good starting value is 0.27.

Moving with your motor

The motor is the other half of the equation to making your vehicle move. Most of the motor’s properties are contained within the <motor> tag’s attributes and nested children tags. Two notable exceptions pertain to your vehicle’s fuel. Incidentally, these two values are often one of the first things an early modder may try to change:

  • <fuelCapacity>: The number between the open and close of this tag is the maximum amount of fuel your vehicle can carry, in liters.

  • <fuelUsage>: Within the confines of this tag is a value that dictates how many liters of fuel your vehicle uses for each meter that it travels.

With the fuel parameters of your vehicle defined, the <motor> tag can draw your full attention. Unlike the <wheels> tag, most of your motor settings are attributes of the actual tag rather than child tags. The main reason is because vehicles only have one motor, so it makes sense. In the <motor> tag, the following are the main attributes with which you should concern yourself:

  • minRpm: This attribute is the idle speed of your motor. Keep the value for this attribute relatively low. Otherwise, your vehicle will race off even when the player isn’t stepping on the gas.

  • maxRpm: The maxRpm attribute is a single value defining maximum rotations per minute (RPM) for the motor.

  • *minForwardGearRatio/maxForwardGearRatio/minBackwardGearRatio/maxBackwardGearRatio: If you set the gear ratios to high values, you can make your vehicle’s wheels spin faster when at a constant engine speed. The trade-off, however, is that higher gear ratios also require motors with more torque.

If you go to the Farming Simulator Modding Tutorials that are available at the GIANTS Developer Network, you can find a spreadsheet that helps you calculate correct RPM and gear ratio values for your motor. That spreadsheet can save you from wasting an immense amount of time tweaking those attributes by trial and error.