Dockingbay

Last modified by Volodymyr Boichuk on 2024/05/29 15:42

NOTE: this page covers the 3ds Max workflow, but blender one should be identical, so the guide is still applicable even if screenshots are from 3ds Max

Info

A dockingbay is the platform where the ship will touch down. It's like a helicopter pad.
S and M sized ships can land here.

These ships can be loaded into internal storage via a ship lift/elevator animation.
It does need to be placed into a dockarea to work.

image2016-7-8 14:9:24.png

Class

Dockarea

Setup

Size_s/m

Geometry

image2016-7-8 14:17:50.pngimage2016-7-8 15:8:51.png

  1. Lightcones
    (e.g. anim_lightcones)
    Works in combination with the lightsource and will be toggled on/off.  
    Is a child of the lightsource.

    tags = part nocollision detail_s textureanimation animation iklink

     

  2. Lightsource
    (e.g. anim_lights)
    The physical representation of the emitted light.
    Turns on/off depending on the status of the dockarea.

    tags = part animation textureanimation nocollision forceoutline
    states = #(#("dockingbay_unassigned", 0, 0), #("dockingbay_assigning", 1, 30), #("dockingbay_assigned", 30, 30), #("dockingbay_unassigning", 30, 60))

     

  3. Fence
    (e.g. anim_fence)
    Blocks the landing pad for the player, when it is not safe to stand there.

    tags = part animation walk_forbidden
    states = #(#("dockingbay_fence_closed", 0, 0), #("dockingbay_fence_opening", 0, 25), #("dockingbay_fence_open", 25, 25), #("dockingbay_fence_closing", 25, 50))
    soundstartanims = #("dockingbay_fence_opening", "dockingbay_fence_closing")
  4. Doors
    (e.g. anim_door01 / anim_door_02)
    The doors make sure that you do not see the ship disappearing, when it is being put into internal storage.
    When the ship is moved downwards, the doors will close above it and form the new "floor" for the next ship.
    This animation is played backwards for unloading from internal storage, and has to look seamless in both directions.

    tags = part animation
    states = #(#("dockingbay_idle", 0, 0), #("dockingbay_storingship", 0, 200), #("dockingbay_retrievingship", 200, 400))
    soundstartanims = #("dockingbay_retrievingship")
  5. Ship lift
    (e.g. anim_floor ; anim_floor.col ; anim_floor_wreck)
    The ship will land on this patch of geometry.
    This area is restricted for walking NPCs.
    This geometry needs a .col mesh as collisionmesh. It is also used for the calculation of the walkable area for NPCs.
    This geometry needs a _wreck geometry.

    tags = part animation walk_dockingbay
    states = #(#("dockingbay_idle", 0, 0), #("dockingbay_storingship", 0, 200), #("dockingbay_retrievingship", 200, 400))

     

  6. Platform base
    (e.g. part_main ; part_main.col ; part_main_wreck)
    This is the main geometry where NPCs can walk without restrictions.
    This is the place where the transporter room will be located.
    This geometry has a .col mesh as collisionmesh. Its also used for the calculation of the walkable area for NPCs.
    This geometry needs a _wreck geometry.

    tags = part
    class = dockingbay
  7.  Cargotubes
    (e.g. detail_xl_cargotube_top; detail_xl_cargotube_bottom)
    This is the cargo loading system.
    It has two separate moving parts (moved by code):
    "detail_xl_cargotube_bottom" is a child of the "anim_main" (the solid floor of the dockingbay where the todock connection is attached) and moves along the Y-axis.
    "detail_xl_cargotube_top" is a child of the "detail_xl_cargotube_bottom" and moves along the Z-axis.
      
    image2016-9-22 15:30:10.png

    //for "detail_xl_cargotube_bottom"
    tags = part detail_xl nocollision forceoutline iklink
    rotconstraint = rotation_xyz
    scaleconstraint = scale_xyz
    transconstraint = translation_y
    transmin = -35.0
    transmax = 0.0

    //for  "detail_xl_cargotube_top"
    tags = part detail_xl nocollision forceoutline iklink
    rotconstraint = rotation_xyz
    scaleconstraint = scale_xyz
    transconstraint = translation_z
    transmin = 0.0
    transmax = 20.0

Animation

A lot of animations are necessary to support all the needed functionality of a dockingbay.
The following animation sequences are specifically created for the dockingbay.
All animations for the dockarea have to be in this template. E.g. animations from referenced objects do not work.

dockingbay_assigned

This sequence is used, for example, for signal lights.
When there is no ship assigned to a dock, no lights will light up. As soon as a ship requests a dockingspot and gets assigned to it, the lights will light up to guide the ship into the right location.

 Type

State

Comment

dockingbay

unassigned

Single-frame animation. Animationstates for the lights

dockingbay

assigning

 

dockingbay

assigned

Single-frame animation.

dockingbay

unassigning

 

dockingbay_fence

This sequence is used to stop a player from entering the platform when it is unsafe to do so.
Examples are:

  • A ship is assigned to a dock and prepares to land there.
    A player on the dock will be crushed, if he is standing on the ship lift area.
  • A ship is going to be put into internal storage.
    If a player is on the ship lift while the ship is being put into internal storage, he will get stuck at the bottom of the dock.

Type 

State

Comment

dockingbay

closed

Single-frame animation. The player should not be able to walk onto the docking bay.
Animationstate for the fences

dockingbay

opening

 

dockingbay

open

Single-frame animation. The player should be able to walk onto the docking bay.

dockingbay

closing

 

dockingbay_doors

This animation sequence is used for the doors and the ship lift.
Each animationstate has to seamlessly blend into "dockingbay_idle".
     The last frame of the other animationstates have to be identical to the "dockingbay_idle" frame as the animations can be played in an undefined order.
     E.g.: two ships get put into internal storage after each other and then undock again.
     "dockingbay_idle" -> "dockingbay_storingship" -> "dockingbay_idle" -> "dockingbay_storingship" -> "dockingbay_idle" -> "dockingbay_retrievingship" -> "dockingbay_idle" -> "dockingbay_retrievingship"

 Type

State

Comment

dockingbay

idle

Animationstates for the "lift" part

dockingbay

storingship

Goes back to "idle" state when finished, used when there are few ships waiting to dock or undock.

dockingbay

storingship_faster

Goes back to "idle" state when finished, used when there are several ships waiting to dock or undock.

dockingbay

storingship_fastest

Goes back to "idle" state when finished, used when there are lots of ships waiting to dock or undock.

dockingbay

retrievingship

Goes back to "idle" state when finished, used when there are few ships waiting to dock or undock.

dockingbay

retrievingship_faster

Goes back to "idle" state when finished, used when there are several ships waiting to dock or undock.

dockingbay

retrievingship_fastest

Goes back to "idle" state when finished, used when there are lots of ships waiting to dock or undock.

Examples

There are 2 default state combinations a dockingbay can be in:

  1. Empty: dockingbay_closed, dockingbay_unassigned, dockingbay_idle
  2. Ship docked: dockingbay_open, dockingbay_assigned, dockingbay_idle

A docking ship will cause these state changes:

  • When the dock is assigned: dockingbay_unassigned -> assigning -> assigned
  • When the ship has touched down:
    • If it's going to be stored away immediately: dockingbay_idle -> storingship -> idle
    • Otherwise: dockingbay_closed -> opening -> open
  • When a docked ship is being stored away: dockingbay_open -> closing ->closed ; then dockingbay_idle -> storingship ->idle ; then dockingbay_unassigned -> assigning -> assigned
  • When a stored ship is being retrieved: dockingbay_idle -> retrievingship -> idle and dockingbay_unassigned -> assigning -> assigned; then:
    • If it's going to immediately undock: no animationstate change necessary
    • Otherwise: dockingbay_closed -> opening -> open
  • Before a docked ship undocks: dockingbay_open -> closing -> closed
  • When the dock is unassigned: dockingbay_assigned -> unassigning -> unassigned

Connections

To place the ship/NPCs we need connections.

dockpos

This is the connection which defines the exact position and orientation of the parked ship.
The connection is placed at the very front end of the ship lift.
image2016-7-8 16:53:17.png

Positioning of the connections "dockpos" (bottom) and "todock" (top) in relation to the boundingbox of a ship.

image2016-7-8 16:54:42.png
 

Name

Tags =

Description

con_todock

todock

First step, ships fly here (with normal flight behaviour) for dock approach.

This connection helps the AI find a good path to the "dockpos" - it can be positioned in either direction from the dock position, but having it offset in one axis only is recommended. The rotation is also taken into account, and it is also recommended that it matches that of the "dockpos".

con_todock/con_dockpos/con_launchpos have to be exactly aligned on the vertical axis! Otherwise you will get sliding ships on the platform.

con_dockpos

dockpos

Second step, ships approach this connection and land here (final resting position for landing/docking).

This connection is matched with the corresponding one in the ship, to get the final position and rotation where the ship will come to rest.

con_dockpos_pivot

dockpos_pivot

As you can dock in two directions, we use this connection to rotate the con_dockpos around.
The dockpos_pivot is the position around which the con_dockpos is rotated. No parent/child relation.

con_launchpos

launchpos

Last step, ships undock again and will fly to this position before changing to normal flight behaviour.

The ship will launch from this connection.

Launchpos case: if the dockingbay is not in a dockarea, movement to launchpos is aborted (undocking continues).

 

con_transporter_01

transporterroom

An elevator can be added here to make it possible to travel between rooms.

con_npc_01

npc

 

Database setup

When the dockingbay template is completely modelled and set up, you can export it to the database with DB upload enabled.
The following things have to be done, before you can export it from the database.

  • Create a macro from the template
  • A transporter room must be connected
  • The docksize must be set to dock_m
  • Visible when docked must be true
     

Size_l/xl

image2016-8-18 13:46:26.png

Size L/XL dockareas are needed for locations where these ships dock (shipyard/repairdock).
The asset is invisible and just contains the connections (dockpos/todock/launchpos).