Ship Mod Creation

To create a ship mod, you'll need to do the following things:

#### First, create an XML file with the ship description.

The file should be created inside my\_custom\_mod/ships/player folder. XML is a text markup format which the game can process. Name the file [shipname].xml. The basic ship XML looks like this:

```
                <ship>
                    <hull>0</hull>
                    <name>Red Rhino</name>

                    <type>fighter</type>
                    <bbox x="18" y="0" w="41" h="29"></bbox>

                    <base_hp>125</base_hp>
                    <hp_per_25_levels_multiplier>2</hp_per_25_levels_multiplier>
                    <hp_increase_per_level>2</hp_increase_per_level>
                    <base_speed>240</base_speed>
                    <turn_speed>30</turn_speed>

                    <base_fuel_cost>2000</base_fuel_cost>
                    <fuel_cost_multiplier>1.045</fuel_cost_multiplier>

                    <base_metal_cost>8000</base_metal_cost>
                    <metal_cost_multiplier>1.05</metal_cost_multiplier>

                    <base_upgrade_cost>100</base_upgrade_cost>
                    <upgrade_cost_multiplier>1.075</upgrade_cost_multiplier>

                	<crew>3</crew>
                	<armor>composite</armor>

                    <weapons>
                        <torpedo>
                            <base_dmg>8</base_dmg>
                			<type>ballistic</type>
                            <dmg_increase_per_level>1</dmg_increase_per_level>
                            <dmg_per_25_levels_multiplier>3</dmg_per_25_levels_multiplier>
                            <reload_time>6</reload_time>
                            <speed_up_time>0.5</speed_up_time>
                            <projectile_speed>750</projectile_speed>
                            <x>10</x>
                            <y>-2</y>
                            <bullet_anim>2</bullet_anim>
                            <homing>True</homing>
                            <base_angle>45</base_angle>
                            <projectile_rotation_speed>120</projectile_rotation_speed>
                        </torpedo>

                        <torpedo>
                            <base_dmg>8</base_dmg>
                			<type>ballistic</type>
                            <dmg_increase_per_level>1</dmg_increase_per_level>
                            <dmg_per_25_levels_multiplier>3</dmg_per_25_levels_multiplier>
                            <reload_time>6</reload_time>
                            <speed_up_time>0.5</speed_up_time>
                            <projectile_speed>750</projectile_speed>
                            <x>10</x>
                            <y>-15</y>
                            <bullet_anim>2</bullet_anim>
                            <homing>True</homing>
                            <base_angle>45</base_angle>
                            <projectile_rotation_speed>120</projectile_rotation_speed>
                        </torpedo>

                        <torpedo>
                            <base_dmg>8</base_dmg>
                			<type>ballistic</type>
                            <dmg_increase_per_level>1</dmg_increase_per_level>
                            <dmg_per_25_levels_multiplier>3</dmg_per_25_levels_multiplier>
                            <reload_time>6</reload_time>
                            <speed_up_time>0.5</speed_up_time>
                            <projectile_speed>750</projectile_speed>
                            <x>-10</x>
                            <y>-2</y>
                            <bullet_anim>2</bullet_anim>
                            <homing>True</homing>
                            <base_angle>315</base_angle>
                            <projectile_rotation_speed>120</projectile_rotation_speed>
                        </torpedo>

                        <torpedo>
                            <base_dmg>8</base_dmg>
                			<type>ballistic</type>
                            <dmg_increase_per_level>1</dmg_increase_per_level>
                            <dmg_per_25_levels_multiplier>3</dmg_per_25_levels_multiplier>
                            <reload_time>6</reload_time>
                            <speed_up_time>0.5</speed_up_time>
                            <projectile_speed>750</projectile_speed>
                            <x>-10</x>
                            <y>-15</y>
                            <bullet_anim>2</bullet_anim>
                            <homing>True</homing>
                            <base_angle>315</base_angle>
                            <projectile_rotation_speed>120</projectile_rotation_speed>
                        </torpedo>
                    </weapons>

                    <abilities>
                        <ability type="speed_up" unlock_level="15" cooldown="10" percent="200" duration="2"></ability>
                        <ability type="self_mend" unlock_level="25" cooldown="12" percent="25" trigger-percent="30"></ability>
                    </abilities>

                    <sprites>
                		<sprite>redrhino1.png</sprite>
                		<sprite>redrhino2.png</sprite>
                		<sprite>redrhino3.png</sprite>
                        <sprite>redrhino4.png</sprite>
                        <sprite>redrhino5.png</sprite>
                    </sprites>
                </ship>

```

####

#### **Basic Parameters**

It looks much bigger than item mod, but don't be intimidated :) We'll go through ship parameters one by one:

* **hull** - hull type identifier. For now: always leave as zero
* **name** - ship name
* **type** - ship type. used to determine AI behavior (and there's a chance it will happen later on again), so use **battleship** for bigger ships and **fighter** for smaller ships
* **bbox** - bounding box. Somewhat tricky now. Additional parameters: **x** and **y** parametersindicate bounding box shift according to **sprite center**. Can be negative. So if your ship is perfectly centered on sprite - leave as zero. in case of red rhino: the ship itself is moved to the right (a bit) due to huge flames. Therefore the bounding box is located 18 pixels to the right of the center. **w** and **h** indicate bounding box width and height
* **base\_hp** - hp on first level
* **hp\_increase\_per\_level** - how much hp is increased on every level
* **hp\_per\_25\_levels\_multiplier** - how much hp is multiplied every 25 levels. i.e. level 25 hp will be (base\_hp + hp\_increase\_per\_level \* current\_level) \* hp\_per\_25\_levels\_multiplier
* **base\_fuel\_cost** - ship fuel cost on first level
* **fuel\_cost\_multiplier -** by how much does the fuel cost increases on every level (i.e. level 2 ship will be base\_fuel\_cost \* fuel\_cost\_multiplier ^ 2)
* **base\_metal\_cost**  - ship metal cost on first level
* **metal\_cost\_multiplier -** by how much does the metal cost grows on every level (similar to fuel formula)
* **base\_upgrade\_cost**  - how much exp does upgrade cost on the first level
* **upgrade\_cost\_multiplier** - by how much does upgrade cost increases on every next level
* **crew** - specimen cost of the ship
* **armor** - armor type of the ship. can be **composite, energy, kinetic, generic**
* **sprites** - list of ship sprites, each written under own tag **sprite**. Those are played one after another.

####

#### **Ship Weapons**

After that, there is the list of different weapons that ships have. Don't make more than 8 weapons. All weapons are located under <weapons> tag. There are three weapon types at the moment.

##### 1) <weapon>

Normal projectile weapon. Example:

```

                    <weapon>
                        <base_dmg>10</base_dmg>
            	    <type>heat</type>
                        <dmg_increase_per_level>0.5</dmg_increase_per_level>
                        <dmg_per_25_levels_multiplier>4</dmg_per_25_levels_multiplier>
                        <reload_time>1</reload_time>
                        <spread_angle>4</spread_angle>
                        <shot_interval>0.1</shot_interval>
                        <clip_size>3</clip_size>
                        <projectile_speed>1500</projectile_speed>
                        <x>0</x>
                        <y>14</y>
                        <bullet_anim>1</bullet_anim>
                    </weapon>

```

Parameters:

* **base\_dmg -** base weapon damage on level 0 ship
* **type** - weapon type. determines the damage versus different weapon types. can be **energy**, **proton, plasma, heat, ballistic, acidic, chaotic**
* **dmg\_increase\_per\_level** - how much damage per level grows
* **dmg\_per\_25\_levels\_multiplier** - by how much the damage is multiplied every 25 levels
* **reload\_time** - how quickly the weapon reloads
* **spread\_angle** - the angle at which bullets can fly from the weapon (bigger angle = less accuracy)
* **shot\_interval** - the time between shots
* **clip\_size** - how many bullets can weapon fire before it needs to reload
* **projectile\_speed** - how fast is the bullet. battlefield width = 1920, therefore projectile\_speed of 1500 would mean that the bullet traverses ~3/4 of the screen per second
* **x, y** - the location of weapons relative to the ship sprite (0,0) is the center
* **bullet\_anim** - from 0 to 7. determines how the bullet looks (see gallery below)

Bullet 0Bullet 1Bullet 2Bullet 3Bullet 4Bullet 5Bullet 6Bullet 7Bullet 8Bullet 9
##### 2) <laser>

A laser weapon that shoots continuous ray, heating and then damaging the enemy. Example:

```
                   <laser>
                       <base_dmg>4</base_dmg>
           			<type>proton</type>
                       <dmg_increase_per_level>0.4</dmg_increase_per_level>
                       <dmg_per_25_levels_multiplier>5</dmg_per_25_levels_multiplier>
                       <fire_time>2</fire_time>
                       <reload_time>1</reload_time>
                       <x>42</x>
                       <y>-22</y>
                       <color>0</color>
                   </laser>

```

Parameters:

* **base\_dmg -** base weapon damage on level 0 ship
* **type** - weapon type. determines the damage versus different weapon types. can be **energy**, **proton, plasma, heat, ballistic, acidic, chaotic**
* **dmg\_increase\_per\_level** - how much damage per level grows
* **dmg\_per\_25\_levels\_multiplier** - by how much the damage is multiplied every 25 levels
* **reload\_time** - how quickly the weapon reloads
* **fire\_time** - how long is the laser beam firing before damaging the enemy
* **x, y** - the location of weapons relative to the ship sprite (0,0) is the center
* **color** - color of the laser. number from a preset list of colors [**0-6**]. default is 0

 0
 1
 2
 3
 4
 5
 6

##### 3) <torpedo>

Flying rocket weapon. Can be homing. Usually quite slow to turn. Example:

```

                 <torpedo>
                     <base_dmg>10</base_dmg>
         			<type>ballistic</type>
                     <dmg_increase_per_level>2</dmg_increase_per_level>
                     <dmg_per_25_levels_multiplier>4</dmg_per_25_levels_multiplier>
                     <reload_time>6</reload_time>
                     <speed_up_time>0.5</speed_up_time>
                     <projectile_speed>750</projectile_speed>
                     <x>15</x>
                     <y>10</y>
                     <bullet_anim>2</bullet_anim>
                     <homing>True</homing>
                     <base_angle>45</base_angle>
                     <projectile_rotation_speed>120</projectile_rotation_speed>
                 </torpedo>

```

Parameters:

* **base\_dmg -** base weapon damage on level 0 ship
* **type** - weapon type. determines the damage versus different weapon types. can be **energy**, **proton, plasma, heat, ballistic, acidic, chaotic**
* **dmg\_increase\_per\_level** - how much damage per level grows
* **dmg\_per\_25\_levels\_multiplier** - by how much the damage is multiplied every 25 levels
* **reload\_time** - how quickly the weapon reloads
* **projectile\_speed** - how fast is the bullet. battlefield width = 1920, therefore projectile\_speed of 1500 would mean that the bullet traverses ~3/4 of the screen per second
* **speed\_up\_time** - torpedos start at zero speed. This parameter sets how quickly the rocket speeds up from 0 to projectile\_speed
* **homing**- is torpedo homing or will it fly directly, disregarding enemy position change? can be **true** or **false**
* **base\_angle** - the base angle at which the weapon is fired (relative to current ship turn angle)
* **projectile\_rotation\_speed** - how quick will homing torpedo turn (degrees / second)
* **x, y** - the location of weapons relative to the ship sprite (0,0) is the center
* **bullet\_anim** - from 0 to 3. determines how the rocket looks (see gallery below)

#### **Ship Abilities**

Each ship can have up to 2 abilities. Those are listed under <abilities> tag. Each ability tag has the following parameters:

* **type** - ability type, listed below
* **unlock\_level** - at which level will this ability become available
* **cooldown** - ability cooldown (in seconds)

In addition to that, each ability has its own separate parameters

List of current abilities and their parameters:

#### 2) Put the ship sprites into the sprites folder

For ships to be displayed in the game properly, you need to put their images into sprites folder of your mod folder. For the previous item, there would be five sprites, their paths:

* my\_sample\_mod/sprites/redrhino1.png
* my\_sample\_mod/sprites/redrhino2.png
* my\_sample\_mod/sprites/redrhino3.png
* my\_sample\_mod/sprites/redrhino4.png
* my\_sample\_mod/sprites/redrhino5.png

The image should be in png format, any size you want. They should be facing right (zero degrees) The screen is 1920x1080, you can put any sprite according to the size that you want it to take on the screen.

Rhino is about 78x80 (For reference)

After that - you can go back to Modding Guide to verify/upload/enable your mod.

You can also download the sample ship mod here: red rhino sample mod