Big Ships
NOTE: Not all features mentioned in this article are implemented yet. |
A BigShip (aka ModularSpaceShip) is a spacecraft consisting of multiple parts, which can be destroyed individually. [PartDestructionEvent PartDestructionEvent]s can be used to alter the behaviour of the vessel when parts are destroyed, for example by weakening shields, engines or disabling weapons.
Ticket #356: Big Ships
Ticket #418: Big Ships implementation
Implementation
All you need to create such a ModularSpaceShip is the model of a spacecraft which is cut into different pieces, so that the parts can be implemented as individual StaticEntities.
To assign an attached StaticEntity to a ShipPart, give it the same name as the ShipPart you want it to belong to (c.f. example below). (Note: Multiple StaticEntities can be assigned to the same ShipPart.)
<ModularSpaceShip . . . > <attached> <StaticEntity name="wing" . . . /> <StaticEntity name="tail" . . . /> </attached> <parts> <ShipPart name="wing" . . . /> <ShipPart name="tail" . . . /> </parts> <engines> <Engine /> <Engine /> </engines> </ModularSpaceShip>
Now hits received on StaticEntities assigned to a ShipPart will forward their damage to the corresponding ShipPart instead of to the main SpaceShip. Every ShipPart has multiple parameters to customize its behaviour, which can be defined in the XML files:
health | Same as for a normal Pawn |
initialhealth | Same as for a normal Pawn |
maxhealth | Same as for a normal Pawn |
damageabsorption | Value ranging from 0 to 1. Defines how much of the damage received is absorbed by the part, while the rest is forwarded to the main Spaceship. This can be used e.g. to create "physical" shields which get destroyed after getting too damaged (high absorption value) |
explosionposition | Position where an explosion should appear upon destruction |
If you want the destruction of ShipParts to alter the vessels behaviour, add PartDestructionEvent to the ShipParts.
Example
Currently the HeavyCruiser ship created in the HS13 PPS provides a model for such a large spaceship.
In a demonstration level ("Modular Ships - Test 1") the vessel can be flown, and all its parts are individually destructible and alter the ships behaviour.
HeavyCruiser is composed of (at least) 9 parts:
Part | attached to | description | Event on destruction |
body | N/A | Main part of the ship. | Death |
frontL/R | body | Front extensions of the ship. | Loss of the weapon mounted on the part. |
partL/R | body | Boxes on the sides to the front of the ship. | Boost regenerates slower. Speed, acceleration and boost of the body's engine are weakened. |
sidearmL/R | body | Large sidearms of the ship. | Loss of the engine mounted on the part. Less controllability of the ship. (As well as destruction of sidearmL/Rfront) |
sidearmL/Rfront | sidearmL/R | Front ends of the sidearms. | Engines mounted on sidearms don't provide any more boost. |
turrets | body | (optional) Rapid firing autonomous turrets, defending the ship against nearby opponents. |
Look at the HeavyCruiser.oxt template to see an implementation of this!
Development
TODO
- Implement turrets to be attached as ShipParts
- Add sound to explosion
Problems
- N/A
More Ideas
- BigShips could use an own HUD, to show individual parts health.
- Systems of the BigShip could be controlled, e.g. power can be manually directed to engines, shields or weapons.