Adding a voxel unit ingame

Matthias Mailänder edited this page May 17, 2015 · 12 revisions

This guide was created 2013-09-09 and works for the 2013-0908 release.

This will be a step by step in depth guide on how to add a voxel unit to your game. As with all my guides i recommend using Notepad++ to edit the yaml file. I will not write a guide how you make a voxel, just how you add a finished voxel into the game. In this guide i will add a voxel Apache helicopter and we will add it to a mod based on Red Alert.

The files we will edit are.

  • A unit yaml file (i.ex. rules/aircraft.yaml)
  • A Sequence yaml file (i.ex. sequences/aircraft.yaml)
  • voxels.yaml (i.ex. sequences/voxels.yaml)
  • system.yaml
  • mod.yaml

All these files should be added to the mod.yaml file. Otherwise our game will crash when we try out the unit.


Before we start editing our unit (i.ex. our helicopter) we need to add the voxel to the game. Put the finished vxl into the bits folder. we also need a cameo (icon) for our unit, it should be named the same as the unit with icon writen at the end.


  • Apache.vxl
  • Apache.hva
  • Apacheicon.shp

Lets start with the code for the unit. Open up our unit yaml file, in this example we would open the aircraft.yaml inside the rules folder. For simplicity you can just add this code at the bottom of the file, The most important part is that the name APACHE is the same name as the voxel.

	Inherits: ^Helicopter
		Cost: 2000
		Name: Apache Longbow
		Description: Gunship armed with Missiles.\n  Strong vs Tanks\n  Weak vs Infantry
		Queue: Air
		BuildPaletteOrder: 20
		Prerequisites: hpad, atek
		Owner: allies
		Bounds: 30,24
		RearmBuildings: hpad
		LandWhenIdle: false
		InitialFacing: 20
		ROT: 4
		Speed: 16
		HP: 200
		Type: Light
		Range: 12
		Weapon: HellfireAA
		LocalOffset: 0,-213,-85
		Weapon: HellfireAG
		LocalOffset: 0,213,-85
		FacingTolerance: 20
		Ammo: 12
		PipCount: 4
		Offset: 85,0,384
		Scale: 8
		LightAmbientColor: 0.2, 0.2, 0.2
		LightDiffuseColor: 0.6, 0.6, 0.6

It's important that the code name of the unit is the same name as the voxel. Thats it for the unit, you might need to play around with the Scale trait to get your unit in the right size, and play around with the rotor offset to get the rotor(s) in the correct position. Everything else here should be straight forward. If something is unclear you can always check my creating a new unit guide here.

What have we accomplished?

Added the base code for the unit. What building does ited, how much should it cost, what weapon to use et.c.

Save the file and close it down. Time to move on.

Sequences yaml

Now lets open up the Aircraft.yaml file in the sequences folder for our Apache Helicopter.

We need to add this line of code inside the aircraft.yaml (at the top, bottom or somewhere in the middle. Your choice)

	icon: apacheicon
		Start: 0
	rotor: lrotor
		Start: 0
		Length: 4
	slow-rotor: lrotor
		Start: 4
		Length: 8

What have we accomplished?

Added the icon (cameo) for our unit and gaved it a rotor so it wont look stupid when it flies. :)

Save the aircraft.yaml file in sequences and close it down. Lets head on.


Create a new file if you do not have a voxels.yaml and name it exactly that. Adding voxel is a rather new function and this file is needed for voxel. in the voxels.yaml you add all your voxels. If we did a tank we would add the tank voxel first, then bind it together with the turret voxel and the turret voxel with the barrel voxel.

Luckily for us, we aren't doing a tank, we are doing a helicopter so all we need to add is this.


If you are interested in how the code for a tank should look like then here's an example.

	turret: 4tnktur
	barrel: 4tnkbarl

That would be the code for Tiberian Sun Mammoth tank.

What have we accomplished?

We just made the game understand that our helicopter is a voxel and not a shp. If we made a tank we also made it understand what is what. (what voxel is the body, the turret and the barrel)

Save and close voxels.yaml down. It's time to move on.

System YAML

The absolute first thing we will do is to insert the palette under the player: trait. Right after Player: insert this code:

	BasePalette: tibsun
	BaseName: tibsun
	RemapIndex: 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31

Your code should look something like something like this in system.yaml (From the beginning of the file):

		BasePalette: tibsun
		BaseName: tibsun
		RemapIndex: 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
		Type: Building

Okay, open up system.yaml inside the rules folder. inside this file search for "Country@0". Depending on what game the first country will be diffrent for RA it would be Allies. Above this post this little bit of code in.

	Name: tibsun
	Filename: unittem.pal
	ShadowIndex: 4
	AllowModifiers: false
	Name: normals
	Type: TiberianSun

Your code should look like this when its done.

	Name: tibsun
	Filename: unittem.pal
	ShadowIndex: 4
	AllowModifiers: false
	Name: normals
	Type: TiberianSun
	Name: Allies
	Race: allies
	Name: Soviet
	Race: soviet

As long as this code is under the world: trait you should be good, by putting the code right above the first country it will be in the very end of the palette code under the world: trait.

What have we accomplished?

We fixed the normals palette so your voxel unit wont turn up colored like a rainbow... And thats a good thing.

Lets save the system.yaml file and close it down. Almost done here.


The Mod.yaml file is a very important file, the game reads this and the file tells the game what files to read, so you need to add all the files that are new. Search after sequences, something like this should pop up:


Create this under sequences but above cursors:


What have we accomplished?

We added the voxels sequences file to the mod.yaml file. The game will now load that file when it starts up!

Save and close down mod.yaml.

What now?

Start the game and test your new voxel unit.

My voxel has incorrect scaling / bounds

See #4113:

The Scale variable in the VXL header is ignored in the Westwood engine while OpenRA acknowledges it. While ra2ff.txt notes Scale is usually 0.083, community-made voxels have this as 0.83 because of a bad default value in VXLSE.

See this post on Project Perfect Mod on how to fix the issue.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.