For us to be able to see our vehicle within the Editor we need to register the XML of the vehicle within the Scripts folder and then deep into a hierarchy of Entities given GameSDK ships with so many. By default the language used to construct and register a vehicle is XML, alongside this we have the standard CGA (Crytek Geometry Animation) which is the filetype for rigid body animation.
Every vehicle in the CRYENGINE is driven by its script, which takes care of the vehicles functionality, like driving behavior, damage states, character positioning or weapons.
These scripts need to be carefully set up in order to have a fully functioning vehicle. Attached is the XML of a very simple, 4-wheeled car to show the most basic implementation of a vehicle.
We'll break down the attached XML into smaller chunks to get a basic understanding of what each part does.
Vehicle XML Composition
Simple 4 Wheel
<Vehicle name="Simple 4 Wheel">
Each part of the vehicle is defined within the <Vehicle> brackets.
name is the name of the vehicle as it shows up in the RollupBar in the editor.
Common sense dictates that the name defined in the name property is similar to the name of the XML itself.
<Buoyancy waterDensity="30" waterResistance="50" waterDamping="0"/>
<Simulation maxTimeStep="0.05" minEnergy="0.002" maxLoggedCollisions="2"/>
Vehicles are basically RigidBodies on wheels, so all the properties in the <Physics> bracket are already documented in the RigidBody Documentation.
Components take care of a vehicles logic. They are simple bounding boxes that can be used to mark weak spots or allow for certain actions on certain parts of a vehicle, you could for example create a component that surrounds a door and make it part of an action, that puts the player into the appropriate seat. Simply put, interaction with a vehicle is usually achieved with a component.
Parts are the physical representation of the vehicles individual parts. In the attached XML, each wheel is a single part. It is important to note that the hierarchy of the parts in the XML needs to reflect the hierarchy of the nodes in your CGA. A child node in your DCC tool equals to a part within another part in the XML. In the example of the attached vehicle all wheels are childnodes of the "body" node, therefore they are parts of the "body" part.
Actions defined in the XMLs <Actions> brackets allow you to interact with vehicles while outside the vehicle. Common actions are "enter" and "flip" these allow you to either enter or flip a vehicle. Actions that are available to the player while driving the vehicle are called "Seat Actions" and are defined separately in the seats segment.
In order to allow players to enter the vehicle, you need to set up a seat for each passenger. The amount of seats available determines how many people fit into a vehicle. Seats also can have seat actions assigned to them that allow the player to use weapons, switch lights or sound the horn.
The movement parameters for the ArcadeWheeled system have been explained in the XML Setup Guide.
Seats, actions, components and parts are what makes a basic vehicle work. We'll go into more detail on each of these and other functionality in the specific sections.
The attached vehicle is of little use in a game, since the player cannot interact with it in any way.
The following sections will go into more detail on how to add functionality to the vehicle.