Documentation of the ship.xml ship definition
Ships are now in separate files, needs to be updated.
NPCs in naev are defined in two stages. The first stage is the ship definition, and the second stage is the fleet definition (fleet.xml).
A ship is nothing more than a specification of a particular ship. The specification determines how the ship looks, how it handles and how capable it is in terms of carrying cargo, fighting, and maneuvering.
The following XML snippet demonstrates some of the tags that make up a ship XML file.
<?xml version="1.0" encoding="UTF-8"?> <ship name="Llama"> <base_type>Llama</base_type> <GFX>llama</GFX> <GUI>slim</GUI> <sound>engine</sound> <class>Yacht</class> <price>120000</price> <fabricator>Melendez Corp.</fabricator> <description>One of the most widely used ships in the galaxy. Renowned for its stability and stubbornness. The design hasn't been modified much since its creation many many years ago. It was one of the first civilian use spacecrafts, first used by aristocracy and now used by everyone who cannot afford better.</description> <movement> <thrust>180</thrust> <turn>150</turn> <speed>200</speed> </movement> <health> <absorb>0</absorb> <shield>100</shield> <armour>50</armour> <energy>320</energy> <shield_regen>3</shield_regen> <armour_regen>0</armour_regen> <energy_regen>16.7</energy_regen> </health> <characteristics> <cpu>18</cpu> <crew>2</crew> <mass>83</mass> <fuel>400</fuel> <cargo>20</cargo> </characteristics> <slots> <weapon x="7" y="0" h="1"/> <weapon x="-3" y="0" h="2"/> <utility/> <utility/> <structure/> <structure/> </slots> </ship>
The 'name' field is the ship's name. This is the name that will show up in the game, and it is also the name used to reference the ship in fleet definitions.
This is the base type of the ship. Ships that share the same base type are considered to be different models of the same basic design. This information can be used in mission and event scripts.
This tag determines what the ship looks like. The value is comprised of two parts, separated by an underscore. The first part is the name of the directory the sprite sheet is in. The first and second parts taken together form the file name of the sprite sheet (without the extension). This is all relative to gfx/ship/. The GFX tag takes optional 'sx' and 'sy' values that specify the size of the sprite sheet. If not specified, the game will assume 8x8.
This tag specifies which GUI to use when the player is using this particular ship. This is useful for making different ships feel unique. The GUI files are found in gfx/gui. Note that currently only one GUI is available.
This is the engine sound for the ship. Sounds are found in snd/sounds/. The value is the file name without the extension.
This is the ship's class.
This is the amount of money the player needs to shell out to purchase this ship.
This is the ship's fabricator.
This is the descriptive text for this ship. It is shown on the shipyard screen.
This section contains the thrust, turn and speed parameters that govern the ship's acceleration, turning speed and maximum speed, respectively. Note that the ship's final performance also depends on mass.
This section contains the shield, armour and energy parameters, as well as their recharge rates.
This section contains the amount of cpu, crew, mass, fuel and cargo capacity of the ship. Note that mass affects the ship's maneuverability.
This is a list of the slots on the ship. Each ship has a number of weapon, utility and structure slots. Weapon slots have a position on the ship's sprite, but utility and structure slots don't need a position definition.