Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 8 (modified by noep, 11 years ago) (diff)

Big Ships

A BigShip (aka ModularSpaceShip) should consist of multiple parts which can be individually destroyed, and the state of the individual parts should alter the behaviour of the entire vessels systems, such as shield, weapons or engines.

Ticket #356: Big Ships
Ticket #418: Big Ships implementation


Example

The HeavyCruiser spaceship is used to show how a complex big ship could look.

HeavyCruiser is composed of (at least) 9 parts: (the names used to refer to the parts are in gray)

  • Body (body)
    • Front extension L/R (frontL and frontR)
    • Sidebox L/R (partL and partR)
    • Sidearm L/R (sidearmL and sidearmR)
      • Sidearm front L/R (sidearmLfront and sidearmRfront)
Partattached todescription/function
bodyN/AMain part of the ship.
frontL/RbodyFront extensions of the ship. A rapid firing, weak laser is mounted on each of them.
partL/RbodyBoxes on the side of the ship. Provide extra shield-and boost power.
sidearmL/RbodyLarge sidearms of the ship. An engine is mounted on each of them, providing the ship with more acceleration.
sidearmL/RfrontsidearmL/RFront ends of the sidearms. A strong weapon can be mounted on them.
turretsbodyRapid firing autonomous turrets, defending the ship against nearby opponents.


Detailed Specification

We assume there is two kind of objects needed to create a big ship:

  • The main ship body (subsequently referred to as BigShip), which is controlled like any other spaceship by a player or AI.
  • Sub-parts of the ship (subsequently referred to as ShipPart), which are attached to either a BigShip or a ShipPart. They can interact with their parent-part in many ways.


Desired final form

Big ships should easily be assembled in an XML template like any other ship.

Here an example how this could look:

<BigShip [parameters]>

    <engines>
        ...
    </engines>
   
    <attached>   
        <Model [parameters] />
       
        <ShipPart [parameters]>
            <attached>
                <Model [parameters] />
            </attached>
            <collisionShapes>
                ...
            </collisionShapes>
        </ShipPart>
       
        <ShipPart [parameters]>
            ...
        </ShipPart>
    </attached>
   
    <collisionShapes>
        ...
    </collisionShapes>
   
<BigShip>


Possible interactions of parts

The parameters of BigShip and ShipPart describe how the parts interact with each other. This requires the objects to support a wide range of functions, here's a few examples:

  • Damage-sharing: Hits received by a BigShip or ShipPart can be shared to other parts attached to it
  • Variable-modification: Destruction of a part can e.g. reduce shield reload rate
  • Destruction events: If a part is destroyed, it can destroy objects like weapons or engines


BigShip

Note: As of PPS FS14, this has been implemented as "ModularSpaceShip". The BigShip class could be an extension of the existing SpaceShip class.
Additionally to a normal spaceships functions, it has a list of ShipParts which are attached to it. The BigShips engines, weapons etc. can be modified by its subparts.


ShipPart

In order to make a ShipPart attachable, it has to be a static entity.


Problems

With the current implementation of Pawns, it is impossible to nicely implement such a big ship into the game. This is due to the only destructible entities being Pawns, which are dynamic entities, which again cannot be attached in XML. Therefore the structure of Pawns needs to be changed, in order to create destructible static entities, which Bullet (the physicsengine) can attach to a spaceship.

Another problem is how to attach turrets. They need an AI controller and they need to be able to move (rotate), yet they need to be attachable.

A discussion on this topic can be found on the Forum.


Implementation

Currently the HeavyCruiser ship created in the HS13 PPS provides a model for such a large spaceship.
In a demonstration level the vessel can be flown, and all its parts are individually destructible. This was achieved by literally hooking multiple Pawns together using collisionboxes hidden inside the spaceship. However the destruction of parts does not influence the ships systems behaviour at all.

As part of PPS FS14 a system allowing parts to be attached to SpaceShips and being destroyed individually is being developed.

In order to implement this for a spaceship, it needs to be a "ModularSpaceShip". 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:

healthSame as for a normal Pawn
initialhealthSame as for a normal Pawn
maxhealthSame as for a normal Pawn
damageabsorptionValue 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)


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.