Skip to content
IMACULGY edited this page Dec 12, 2018 · 7 revisions

Ships

Every ship lives under the /moduleName/assets/ships directory, in it's own subfolder. To define a ship, you need to provide 3 files - a configuration file (shipName.json), a ship icon (shipNameIcon.png) and a texture (shipName.png). As things stand, the texture is a power-of-two (128x128, 256x256 or 512x512, depending on the size of ship) colored sprite with transparency, whereas the ship icon is a scaled down (32x32) white version of the texture.

Here is the JSON file for Imperial Tiny, which we'll be using as an example.

The configuration is a JSON file, consisting of the following attributes:

  • size: A float representing the scale of the ship sprite in-game.
  • maxLife: An integer representing the maximum hp of the ship.
  • type: A string representing the class of the ship. All ships will have the "std" type, whereas the Capital ships will have the "big" type.
  • price: An integer representing how expensive ship is in-game.
  • ability: A JSON object of the form described in this wiki page.
  • displayName: A string representing the user-friendly name of the ship.
  • engine: A fully qualified (for instance, core:imperialEngine) engine name.
  • particleEmitters: see here
  • gunSlots: Normalized coordinates of the guns. You can get the normalized positions by dividing the x coordinate of the pixel you choose by the width of the texture and the y coordinate by the height. There can be up to two gun slots in a ship.
  • rigidBody: The collision hull of the ship. Can be exported via the Physics Body Editor.