Skip to content

Adding content to Modules

FieryPhoenix909 edited this page Nov 3, 2018 · 5 revisions

(This page assumes you already have an empty module set up from the Initializing a Module tutorial.)

Adding Content

Right now, modules in Destination Sol only support asset files, not code files. All these assets are placed under the assets directory, which is situated in the root directory of your module along with the module.json. The assets folder contains other sub-folders, that contain specific types of assets. Here is what the folder structure for draconic looks like:

draconic
└── assets
    ├── configs
    ├── items
    │   ├── clips
    │   │   └── fireballClip
    │   └── guns
    │       └── scorcher
    ├── ships
    │   ├── draconicCapital
    │   ├── draconicLarge
    │   ├── draconicMedium
    │   ├── draconicStation
    │   └── draconicTiny
    └── textures
        └── projectiles

Let us now look at the types of content that can be added to the game, and what files are required for each type of content.

Ships

Ships have their own creation guide, here.

Items

Every item type lives under the /moduleName/assets/items directory, in it's own subfolder. Depending on the type of item type, you need to provide a configuration file (itemName.json), an item icon (itemNameIcon.png), a texture (itemName.png), or some combination of these. As things stand, the texture is a power-of-two (for instance, 64x16) colored sprite with transparency, whereas the item icon is a scaled down (32x32) black-and-white version of the texture.

Note: The naming convention for the items and their respective icons is important. For example, if your gun is called the "Gun Gun", you might name your it's subdirectory gunGun. This means the config must be gunGun.json, the icon texture must be gunGun.png, and the icon must be gunGunIcon.png.

A typical items folder hierarchy might look like this (taken from the formic module):

items
├── clips
│   └── uraniumClip
│       ├── uraniumClipIcon.png
│       └── uraniumClip.json
└── guns
    ├── gryazevShipunov
    │   ├── gryazevShipunovIcon.png
    │   ├── gryazevShipunov.json
    │   └── gryazevShipunov.png
    └── superShotgun
        ├── superShotgunIcon.png
        ├── superShotgun.json
        └── superShotgun.png


Configuration files for items vary from item type to item type. We'll go over some of the basic ones here.

Gun Configs

As configuration files go, gun files are pretty straight forward. The following gun config belongs to the Gryazev Shipunov from the formic faction.

{
    "fixed": true,
    "maxAngleVar": 2,
    "angleVarDamp": 10,
    "angleVarPerShot": 1,
    "timeBetweenShots": 0.02,
    "reloadTime": 1,
    "price": 500,
    "clipName": "formic:uraniumClip",
    "gunLength": 0.25,
    "displayName": "Gryazev Shipunov",
    "lightOnShot": true,
    "shootSounds": [
        "core:fixedGunShoot0",
        "core:fixedGunShoot1"
    ],
    "reloadSounds": [
        "core:fixedGunReload"
    ]
}

Here is the function of each attribute:

  • fixed: A boolean the controls whether the gun can rotate or not. "true" indicates the gun cannot rotate
  • maxAngleVar: A float that controls the maximum angle variation for a shot from the center of the gun. The higher the number, the wilder the gun shoots.
  • angleVarDamp: A float that puts a "damper" on the angle variation. The higher the number, the longer it takes for the shots to spread out
  • angleVarPerShot: A float that controls how much the angle of the bullet can vary from shot to shot. A high number indicates more spread
  • timeBetweenShots: A float controlling how fast your gun fires, lower = faster.
  • reloadTime: The amount of time in seconds that it takes for the gun to reload
  • price: The amount the gun costs to buy at a station
  • clipName: The module path of the clip the gun uses to fire. Notice the formic: prefix. You must denote the module.
  • gunLength: A multiplier used to control the gun length. <1 means you're scaling the gun down, >1 means you're scaling it up
  • displayName: The name to be displayed in inventories and trading stations
  • lightOnShot: Whether the gun should show a light at the muzzle when it fires
  • shootSounds: An array to iterate over when firing the gun. Each string is a module path to an audio asset to be played
  • reloadSounds: Same as shootSounds but for when the gun reloads

Clip and Projectile config & creation

Clips and Projectiles have their own dedicated page, here.

Module Configs

Modules require 3 different types of configs - playerSpawnConfig.json, startingStation.json, systemsConfig.json, all of which should be created in the /moduleName/assets/configs/ directory of your module. Below is an explanation of the structure and function of each.

playerSpawnConfig

This config is what determines the ships that a player can choose to spawn in as when they start a new game. This config is necessary and will also allow you to test your ships in-game. The following is an example from the draconic module.

{
  "Draconic Medium": {
    "hull": "draconic:draconicMedium",
    "items": "6*rep core:mediumArmor-1 core:bigShield-1 draconic:scorcher-1",
    "money": 300
  },
  "Draconic Large": {
    "hull": "draconic:draconicLarge",
    "items": "20*rep core:advancedArmor-1 core:advancedShield-1 draconic:scorcher-1 draconic:scorcher-2",
    "money": 500
  },
  "Draconic Capital": {
    "hull": "draconic:draconicCapital",
    "items": "50*rep core:advancedArmor-1 core:advancedShield-1 draconic:scorcher-1 draconic:scorcher-2",
    "money": 1000
  },
  "Draconic Tiny": {
    "hull": "draconic:draconicTiny",
    "items": "3*rep core:lightArmor-1 core:smallShield-1 draconic:scorcher-1",
    "money": 150
  }
}

Below are the functions of each attribute:

  • "Draconic ---": The name that the ship that will be displayed under when the player is choosing their ship at the beginning of the game
  • hull: The ship that is being referred to (in the form of moduleName:shipName, where shipName should match the name of the ship's .json file)
  • items: The items that the ship starts off with (including armor, shields, weapons, and clips). In the case of guns, the -1 and -2 refers to the ship's gunSlots
  • money: The amount of money the ship starts off with

startingStation

This config specifies the station that the ships will spawn and start the game in. It is encouraged that you also create a unique station for your module (if you do, the station will go under the /assets/ships/ folder and the hull of this config would reference the station under your module. It will follow the same format as a normal ship save for a few minor tweaks - refer to the station ship under the core module for a template). The following is an example of what it would look like otherwise:

{
    "hull": "core:station",
    "items": "core:gun core:gun",

    "guard": 
    {
        "hull": "core:imperialBig",
        "items": "core:fixedGun core:fixedShotGun core:mediumArmor+core:heavyArmor core:shield+core:bigShield",
        "density": 3
    }
}

There will be multiple guard ships that spawn around a station, which is what guard refers to. You may want to change the guard ship to one from your own module, especially if you have created your own station, for cohesion.

systemsConfig

This config is essential in specifying the allies and enemies of your faction. It also allows you to make the ships/items in your module purchasable in-game. These can be done for both standard and hard mode, however as of now, it is most important to add allies and buying capabilities for standard mode. A good example is shown below.

{
  "standard": {
    "constantAllies": [
      {
        "hull": "tribe:serenity",
        "items": "core:shotGun 0.86|core:bigShield",
        "money": 120,
        "density": 2
      },

      {
        "hull": "tribe:serenityMedium",
        "items": "core:fixedGun 0.5|core:mediumArmor 0.75|core:smallShield+core:shield",
        "density": 2
      },

      {
        "hull": "tribe:serenityLarge",
        "items": "core:fixedGun 0.5|core:lightArmor 0.75|core:smallShield+core:shield",
        "density": 2
      },

      {
        "hull": "tribe:serenityCapital",
        "items": "core:fixedGun 0.5|core:lightArmor 1|core:smallShield+core:shield",
        "density": 2
      },

      {
      "trading": {
        "items": "rep core:sloMoCharge core:fixedGun core:bulletClip core:mediumArmor core:shield core:fixedShotGun core:shellClip core:bigShield",
        "ships": "tribe:serenitylMedium tribe:serenityBig",
        "mercenaries": [
          {
            "hull": "tribe:serenitylMedium",
            "items": "3*rep core:smallShield",
            "money": 200
          }
        ]
      }
     }
    ]
  }
}
  • constantAllies: Refers to the allies of you faction. Essentially, you can add all of the ships of your module.
  • trading: This is what makes the items and ships of your module purchasable in-game
    • items: Include all the items important for your module such as guns, clips, charges etc.
    • ships: Include all the ships of your module
    • mercenaries: Mercenaries are ships that players can hire. You may add at least 1 mercenary.

For more examples on creating content and configs, check out the files of the existing modules at https://github.com/DestinationSol. The content in the core module is also a good source for further reference.