How to Add Lights to Your Farming Simulator Mod

By Jason van Gumster, Christian Ammann

Vehicles in your Farming Simulator mod will only be complete when you add lights. Player-driven vehicles have to be able to see when they’re working their fields in those dim hours before dawn, right? The <lights> section in your vehicle’s XML file is where those lights are defined and controlled.

The <lights> tag itself has no attributes, but nested within it are child <light> tags, each one defining a single light in your vehicle. Each <light> tag has up to four attributes:

  • realLight: This attribute is the index path to an actual light object in the I3D file. Real lights take more processing power, so you don’t want to have too many on your vehicle. In-game, only two are ever used at the same time.

  • fakeLight: A fake light offers no illumination to the scene, so it takes much less processing power. Typically fake lights are boxes or cones with a gradient texture that looks like light emanating from a source. The fakeLight attribute is the index path to one of these objects. The game engine uses fake lights when its artificial intelligence drives or when other players drive the vehicle in multiplayer mode.

  • decoration: You get to take advantage of corona textures with this attribute. The decoration attribute is the index path to the corona object for your light.

  • lightType: The final attribute for a light on your vehicle is lightType. This is a simple integer value that lets the game engine know which light on the vehicle this one is. That way, when the player turns on various lights, the correct ones turn on as expected. This attribute can be set to one of four values:

    • 0: Front light

    • 1: Back work light

    • 2: Front work light

    • 3: Headlight