Adding a voxel unit ingame

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.

unit.yaml

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.

Example:

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.

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)

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.

Voxels.yaml

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.

apache:
idle:

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

4tnk:
idle:turret: 4tnkturbarrel: 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:

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.

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.

Mod.yaml

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:

What now?

My voxel has incorrect scaling / bounds

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.