Planet S

Planet S

Not enough ratings
Creating mods for Planet S
By lolmanjo
This guide explains how to create mods for Planet S.
   
Award
Favorite
Favorited
Unfavorite
Technical overview
Let's discuss the technical background first, so we get an idea how things work in the background when we mod the game.

Asset folders
The game tracks so called "asset folders" which are home to all assets used by the game. An asset is therefore basically a file inside an assets folder. These assets can be textures, models, sounds or lua-scripts. When starting the game, it scans it's current directory for asset folders. You can see examples for these if you inspect the "assets.aexassets" file or the "customFlagPresets" folder in the game install directory. The assets file is packed to speed up the loading process, so we will look at the "customFlagIcons" folder instead.

An assets folder requires a "assets.json" file at its root. This file tells the game that this folder is meant to be an assets folder and contains a few information like the priority. The priority is relevant if a file is present in more than one asset folder. In this case, the game will load the asset from the asset folder with the higher priority.
Yes, you can utilize this feature to effectively replace assets. But be aware that doing so can cause weird behavior which is hard to debug. Because of this we are NOT officially supporting this feature. You can play around with it or even replace whole menus, but we won't offer support if this causes bugs.

Back to the asset folders. Every asset has a "unique" asset ID. It's constructed using the relative path of the file inside the assets folder followed by the filename. So if the file "fi_research.png" is located in the assets folder "customFlagIcons" in the sub-directory "textures/flagIcons", its asset ID is "textures/flagIcons/fi_research.png". The "unique" is in quotes because there can be assets with the exact same asset ID in different asset folders. But this shouldn't concern you, as long as you are not trying to replace existing assets and choose meaningful names for your new assets.

Mod files
Why we are telling you about asset folders? That's because mods are technically also realized as asset folders!

We are registering mods via a lua script. This script can contains different functions. The function "registerMod" is always required and has to return the title, a description and a priority. If this function fails the mod won't be registered.

The mandatory mod script must be located in its mod directory in the path "scripts/mods/". It will be saved there automatically when you create a new mod via the Editor (explained in the next section). Besides the mod script all other assets introduced by the mod must be located in its assets folder too. Our suggested good practice is having separate folders like "textures", "models", "scripts", "sounds", etc.

Enabling the terminal
To assist you in debugging issues while creating your mods, we made it possible to show the terminal of the game. You can do so by passing "-console" as a start parameter to the game. It will show when launching the game. Closing the terminal will instantly terminate the game!
The editor: Planet S-Tools
Starting the editor

The editor is available besides the base game Planet S. You can either choose it when launching the game via Steam or, if you selected the base game as the default start option, by choosing Planet S-Tools manually.
Obviously the editor requires a internet connection to be able to create and update mods.

Creating a new mod

On startup the editor will show you a "Welcome!" popup, showing you three options. Their names reveal their purpose. To create a new mod we want to click "Create a new mod".



Then a new window pops up, requiring you to enter a name for your mod, a short description text and a priority.
The mod name will be used as the name of mod ingame, as well as for the title in the Steam Workshop. If you want to change it later, you have to edit it in the mod script for the ingame name and in Steam for the Workshop item title.
The description will only be used ingame. The priority will be used as the priority of the mods assets folder. You can leave it on its default value of 0. You can edit both values in the generated files later.



After filling out the text fields and clicking "Create new mod", the mod will be created. The generated files will be located in the game install directory, in the mods folder. There will be a sub-folder with the same name which you entered for your mod. In there you will find the "assets.json" and the mod script, as described in chapter 1 "Mod files". The mod script will also have the name of the mod and is a ".lua" file. If you open it, you will see a pre-generated "registerMod" function. For editing lua files we use "Visual Studio Code" which is available for free (https://code.visualstudio.com/).

Important to know is that you can inspect which mod the editor is currently "attached" to. Clicking on the "Modding" tab at the top will reveal the current state. If a mod is set, you will see its title and the unique workshop item ID. After creating a mod (or opening one) it should like this:



If you clicked "Just edit assets" or something went wrong while communicating with the Steam backend, the "Modding" tab will look like this:



Editing an existing mod

To edit an existing mod you first have to make sure you have the mod files. As you are the creator of the mod, you should usually have them on your PC. If you lose them, you have to subscribe your mod in the Steam Workshop and copy the files to the location where they once were created in the game install directory.

If you have the files, you start the editor and click "Open an existing mod" in the welcome popup. There you are required to select the mod script of the mod you want to edit. In the combo box "Steam workshop item" you select the correct workshop item. It contains all Planet S workshop items of which you are the owner. You can identify them by their name or their unquie workshop item ID. You can compare it with the number in the URL of the Steam page of the respective workshop item.



If everything works out, you will be able to see the mod details in the "Modding" tab again!

Setting a thumbnail

To define a thumbnail in the workshop, you have to place a PNG-file into the mod folder named "thumbnail". It will be uploaded automatically when updating the mod.



Updating your mod

Everytime you change your mod you have to upload it to Steam. The editor does that for you by uploading all files inside your mod's directory. You can update your mod by clicking "Update mod..." in the "Modding" tab mentioned before. Doing so will open another popup:



In there you can edit the mod title displayed in the Steam workshop and enter a change note. This is also the place where you can set the tags of your mod. They are orientated to the categories we configured for the Planet S workshop. Ideally they tell which content types are added by your mod.

A click on "Update mod" starts the upload to the Steam backend. This can take a few seconds, depending on your internet connection speed. You will see a success notification in the bottom right corner of the editor when the upload finished. Don't close the editor prior to that to prevent issues!

Editing assets

Besides creating and updating workshop items, the editors main purpose is creating and editing Planet S assets. While textures, models and sounds have to be created somewhere else, the editor is a tool to create Planet S assets. These are:
  • Ambient objects (planet decoration)
  • Resources (resource deposits like clay or iron)
  • Buildings
  • Spaceships
  • Particle types
  • Texture packs

You can have multiple different assets open at once. To create an asset, click on "File...", then on "New...". The "New asset" popup appears:



In there you select a name and a type. The asset location will be determined automatically. A click on "Create" creates an empty asset file and opens your new asset so you can start editing it.
You can also edit an existing asset. For that you click on "Open..." instead and select the asset file.
NOTE: To be able to select any type of file, select "All files" in the combo box in the bottom right of the file dialog.
Testing your mod
To avoid updating your mod to the Steam workshop each time you change something, you can simply let the base game load your mod as a local one.

For that you have to copy your mod into the "mods" folder in the game install directory. To find the game install directory you right-click Planet S in your Steam library --> "Manage" --> "Local files". In there you will find the folders "editor" and "mods".

In "editor" there is also a mods folder, containing the mod you created from Planet S Tools. You just copy the mod folder (e.g. named "Cryptoworld" or <yourModNameHere>) into the mods folder besides the "editor" folder. The base games scans it on startup and will find and load your mod.

Make sure to re-copy your mod if you change something. Planet S Tools uploads your mod files from the "editor/mods" folder.

REMINDER: Add the start option "-console" to the game via Steam to open up the game console. It can help you find problems more easily!
Registering content in the mod script
In the newly created mod script you will see a bunch of pre-generated functions. If the mod is active, the game will invoke these functions at certain points to get the content registered by the mod. Normally you don't want to touch the "registerMod" function and leave it as it was generated. You can remove the other functions if you don't need them, as they are optional. Whether they are present won't affect the mod tags in the Steam workshop.

The game registers content in a certain order. This is:
  1. World types
  2. Items
  3. Tile cultivation modes
  4. Population types
  5. Resources
  6. Ambient objects
  7. Planet types
  8. Rockets
  9. Turrets
  10. Buildings
  11. Building menu entries
  12. Spaceships
  13. Technologies

The register functions don't have to be in this order. Having it in order just helps understand a few dependencies between the content types. Imagine you are trying to register a new resource type and mention it in your custom planet type too. Now something goes wrong and your resource type can't be registered properly and is discarded. When the game now registers your planet type, it can't find your resource type and discards it from the planet type too. The planet will be registered without your resource.

We introduce to you: the ContentRegistry! It's purpose is to register and manage all types of game content. For each type there is a function requiring certain parameters.

In the following we describe all register functions and their parameters. We recommend you download our example mod "Cryptoworld" from the Steam workshop. In the mod script you see examples for all functions. It serves as a helpful reference.

Registering items
Register items

To start things off easy and understandable, we will start with item types instead of world types. Let's look at an example for registering items:

ContentRegistry.registerItem("i_coins", "i_coins.png", 100, ITEM_CATEGORY_CONSUMABLES, 1, 5, false, "Coins")

The function header therefore looks like this:

ContentRegistry.registerItem(<String>, <String>, <Number>, <Enum>, <Number>, <Number>, <Boolean>, <String>)

Nr.
Name
Type
Effect
1
ID
String
Unique item identifier
2
Icon texture ID
String
Asset ID of the item texture, Starting from "textures/items/"
3
GUI sequence number
Number
Index at which the item should be sorted in the UI
4
Category
Enum
Options:
  • ITEM_CATEGORY_CONSTRUCTION_MATERIALS
  • ITEM_CATEGORY_CONSUMABLES
  • ITEM_CATEGORY_INTERMEDIATES
  • ITEM_CATEGORY_RAW_MATERIALS
  • ITEM_CATEGORY_AGRICULTURE_PRODUCTS
5
Tier
Number
In which population tier the item is used for the first time
6
Reference price
Number
Used when creating trade entries
7
Construction material component
Boolean
Whether the item is used for producing a construction material. Required for bots.
8
Language key
String
The display name of the item

Registering world types
ContentRegistry.registerWorldType(<String>, <Table>)

Nr.
Name
Type
Effect
1
ID
String
Unique world type identifier
2
Parameters
Table
Lua-Table containing remaining parameters

The second parameter, the Lua-table, is hard to describe. It's best you look at the example. Anyway we want to describe the possible parameters and their effects here:

Name
Type
Effect
startSpaceshipID
String
The ID of the spaceship type players should get at the start
startItems
Table
Table describing the items to be put into the start spaceships. See example.
tinyPlanets
Boolean
Whether normal size planets or tiny planets are generated
sunSoundID
String
Asset ID of the sun sound
planetRings
Table
Table describing the generated planet rings. See example.

NOTE: The parameter names inside lua tables are case-sensitive!
Registering population types
ContentRegistry.registerPopulationType(<String>, <Table>)

Nr.
Name
Type
Effect
1
ID
String
Unique population type identifier
2
Parameters
Table
Lua-Table containing remaining parameters

Table parameters:

Name
Type
Effect
tier
Number
Tier. Example: Workers are tier 1, Developers are tier 2.
civilizationType
Enum
Options:
iconID
String
Asset ID of the icon texture
langKey
String
Display name
minResidents
Number
Minimum amount of residents living in a residence
maxResidents
Number
Maximum amount of residents living in a residence
economicScore
Number
Economic score granted per resident
needs
Table
Lua-Table defining the needs of this population type. See example.
subsequentBuildingIDs
Table
Lua-Table listing the buildingIDs of the buildings to upgrade to. In most cases just one. See example.
Registering tile cultivation modes
ContentRegistry.registerCultivationMode(<String>, <Table>)

Nr.
Name
Type
Effect
1
ID
String
Unique tile cultivation mode identifier
2
Parameters
Table
Lua-Table containing remaining parameters

Table parameters:

Name
Type
Effect
langKey
String
Display name
iconStyle
Table
Lua-Table defining the icon style for the tile cultivation mode. See example.
Registering ambient objects
Register ambient objects

ContentRegistry.registerAmbientObjects(<String>, <String>)

Nr.
Name
Type
Effect
1
ID
String
Unique ambient object identifier
2
Ambient object asset ID
String
Asset ID of the ambient object asset file (".pao")

Registering resources
ContentRegistry.registerResource(<String>, <Table>)

Nr.
Name
Type
Effect
1
ID
String
Unique ambient object identifier
2
Parameters
Table
Lua-Table containing remaining parameters

Table parameters:

Name
Type
Effect
resourceTypeID
String
Asset ID of the resource asset file (".prs")
langKey
String
Display name
iconTextureID
String
Asset ID of the icon texture file.
quickBuildBuildingID
String
buildingID of the building to be build upon "upgrading" resource deposit ("U" key)
refillPricePerUnit
Number
Used when playing with refillable resources
minAmount
Number
Minimum amount when playing with refillable resources
maxAmount
Number
Maximum amount when playing with refillable resources
Registering planet types
ContentRegistry.registerPlanetType(<String>, <Table>)

Nr.
Name
Type
Effect
1
ID
String
Unique planet type identifier
2
Parameters
Table
Lua-Table containing remaining parameters

Table parameters:

Name
Type
Effect
iconID
String
Asset ID of the planet icon used on the map
farmProductivity
Number
Base productivity of farms (1.0 = 100%)
enableWater
Boolean
Whether the planet has water. Default: true.
enableClouds
Boolean
Whether the planet has clouds. Default: true.
enableAtmosphere
Boolean
Whether the planet has an atmosphere. Default: true.
atmosphereScatteringCoefficients
Vector3f
Influences the color of the atmosphere. Default: (0.1066222407, 0.3244415644, 0.6830134553)
atmosphereScatteringStrength
Number
Influences the atmosphere in different ways. Default: 0.8
atmosphereAlphaFactor
Number
How transparent the atmosphere is. Default: 0.48
surfaceWaterColor
Vector3f
Default: (0.1, 0.5427927, 0.45935)
deepWaterColor
Vector3f
Default: (0.0, 0.1862, 0.3362)
waterWaveStrength
Number
Default: 0.8
waterReflectivity
Number
Default: 0.8
waterSpecularIntensity
Number
Default: 1.5
waterSpeed
Number
Default: 2.5
opaqueWater
Boolean
Default: false
emissiveWater
Boolean
Default: false
noiseSpikyness
Number
Default: 1.35
noiseHeightDifference
Number
Default: 0.58
noiseHillyness
Number
Default: 4.4
noiseWarpingStrength
Number
Default: 0.035
noiseSharpness
Number
Default: 0.075
noiseFrequency
Number
Default: 0.005
gasPlanet
Boolean
Whether this planet type is a gas planet. Default: false. Forces enableWater & enableClouds to false.
spaceportID
String
buildingID of the spaceport equivalent, default is "b_spaceport"
warehouseID
String
buildingID of the warehouse equivalent, default is "b_warehouse"
sandColor
Vector3f
RGB values of the sand color
mountainTextureID
String
Asset ID of the mountain texture asset
heightTransitions
Vector2f
Leave it be, default: (-0.15, 0.15)
unlockConditions
Table
Lua-table with conditions to be able to colonize planets of this type. See example.
biomes
Table
Lua-table defining the biomes generated on this planet. They matter for the generation of ambient objects and resources
ambientObjects
Table
Lua-table defining the generation of ambient objects. See example.
resources
Table
Lua-table defining the generation of resources. See example.
cultivationModes
Table
Lua-table listing possible cultivation modes on this planet. See example.
determineTileCultivationModeCallback
Function
Lua-function for custom tile cultivation modes. Standard generation if nil. See example.
Registering rockets
ContentRegistry.registerRocket(<String>, <Table>)

Nr.
Name
Type
Effect
1
ID
String
Unique rocket identifier
2
Parameters
Table
Lua-Table containing remaining parameters

Table parameters:

Name
Type
Effect
iconID
String
Asset ID of the texture asset file
langKey
String
Display name
constructionTime
Number
Construction time in seconds
constructionCostMoney
Number
Construction costs in credits
constructionCostItems
Table
Lua-table of items required to construct the rocket. See example.
speed
Number
Travel speed of the rocket
accelerationTime
Number
Time in seconds to accelerate
explosionDuration
Number
Duration of the impact
explosionRadius
Number
Radius of the damage area. The damage area grows during the impact ("explosionDuration") up to the explosion radius.
damagePerTick
Number
Damage applied inside the damage area per tick (20 times per second)
epicenterRadius
Number
Radius of the epicenter. The epicenter is an additional damage area to apply more damage around the impact.
epicenterDamageMultiplier
Number
Multiplier applied to buildings inside the epicenter damage area

Registering turrets
ContentRegistry.registerTurrets(<String>, <Table>)

Nr.
Name
Type
Effect
1
ID
String
Unique rocket identifier
2
Parameters
Table
Lua-Table containing remaining parameters

Turrets can have the type TURRET_TYPE_PROJECTILE or TURRET_TYPE_LASER. Because their parameters are fundamentally different, we present them in separate tables.

type = TURRET_TYPE_PROJECTILE:
Name
Type
Effect
type
Enum
TURRET_TYPE_PROJECTILE
salvoSize
Number
How many individual shots a salvo has
salvoSpeed
Number
Time in seconds between shots
salvoCooldown
Number
Time in seconds between salvos
projectileSpeed
Number
Speed of projectiles
damageSpaceships
Number
Damage per projectile to spaceships
damageBuildings
Number
Damage per projectile to buildings
scatterRadius
Number
Radius for AoE damage

type = TURRET_TYPE_LASER:
Name
Type
Effect
type
Enum
TURRET_TYPE_LASER
chargeTime
Number
Time in seconds to reach maximum damage
minDamage
Number
Minimum damage per tick
maxDamage
Number
Maximum damage per tick
laserColor
Vector3f
Color of the laser beam
Registering buildings
ContentRegistry.registerBuilding(<String>, <Table>)

Nr.
Name
Type
Effect
1
ID ("buildingID")
String
Unique building identifier
2
Parameters
Table
Lua-Table containing remaining parameters

Table parameters:

Name
Type
Effect
langKey
String
Display name
buildingTypeID
String
Asset ID of the building asset file (".psb")
placingMode
String
ID of the cultivation mode this building can be placed on
resourceID
String
ID of the resource this building has to be placed on
iconID
String
Asset ID of the icon texture file
upkeep
Number
Upkeep cost per minute
constructionCostMoney
Number
Construction costs in credits
constructionCostItems
Table
Lua-table of items required to construct the building. See example.
productionTime
Number
Used when producing or consuming items. Duration in seconds.
powerConsumption
Number
Power consumption while active
powerProduction
Number
Power production while active
numOfFields
Number
Maximum amount of fields (e.g. farms or solar power plant)
rotateToParent
Boolean
Used if a field to a farm (e.g. solar collectors). Default value is "false".
generatesMoney
Boolean
Whether this building generates money instead of consuming it. Default value is "false".
residentsCount
Number
Number of residents spawned from this building. Purely visual.
tier
Number
producedItemID
String
ID if produced item
maxHitpoints
Number
Maximum amount of hitpoints
militaryScore
Number
Military score granted by owning this building
suppressParticles
Boolean
Allows particles even if player isn't on the same planet (e.g. rocket silos)
modules
Table
Lua-table defining the modules of this building. Modules give a building its functioniality.
Building modules 1
There are many types of building modules. Some can combined with eachother, others can't. Generally speaking, you can't / shouldn't combine building modules which produce UI.

Module ID
Produces UI?
Description
inventory
No
Equips the building with an inventory, allowing it to store items.
logistic
Only if warehouse, spaceport or depot
Results in the building being taken into account by the planets logistic system.
pwr_consuming (stand for "Power consuming")
No
The building consumes power from the planet.
pwr_producing
Yes
Produces power. The power generation method can vary.
farming
Yes
Produces an item type when it has fields. Takes the planets fertility into account.
extracting
Yes
Like farming, but ignores planets fertility and consumes an additional item every few cycles.
mining
Yes
Produces an item. Typically placed onto a resource deposit.
assembling
Yes
Produces an item type by consuming up to three items.
constructing
Yes
Has the ability to construct spaceships.
residential
Yes
Can house residents, act as a city center or a public building.
military
Yes
After a certain time can shoot at enemy spaceships. Also acts as part of the planets defense.
shieldProjector
Yes
Projects a shield to nearby buildings, granting them shieldpoints.
laser
Yes
Can be an interplanetary laser main or upgrade building.
rocketSilo
Yes
Has the ability to build and launch rockets.
terraforming
Yes
Has the ability to place terraforming sites to change a tiles cultivation mode. No support for modded cultivation modes.

Each module type requires different parameters. The following tables describes them:

Module ID "inventory":
Parameter name
Parameter type
Description
items
Table
Lua-table listing item types possibly stored in the buildings inventory.

Module ID "logistic":
Parameter name
Parameter type
Description
warehouse
Boolean
Whether the buiding acts as an warehouse for drones. Default value is "false".
spaceport
Boolean
Whether the buiding acts as an spaceport for spaceships. Default value is "false".
depot
Boolean
Whether the buiding counts as a depot, increasing the planets inventory capacity. Default value is "false".
itemsToHoard
Table
Lua-table listing the item types the logistic system should bring to this building. The building should have an inventory slot for each item type.

The module type "pwr_consuming" doesn't have any parameters.

Module ID "pwr_producing":
Parameter name
Parameter type
Description
itemTypeConsumed
String
ID of the item type consumed to produce power, e.g. "i_coal".
moduleTypeID
String
ID of the building which acts as a "field-like" building, e.g. "b_solarCollector".
itemTypeConsumed2
String
ID of the item which is consumed every few production cycles. See parameter "cyclerPerInput".
cyclerPerInput
Number
After how many cycles the item specified by "itemTypeConsumed2" is consumed.
itemTypeProduced
String
ID of the item which is produced every few production cycles. See parameter "cyclerPerOutput".
cyclerPerOutput
String
After how many cycles the item specified by "itemTypeProduced" is produced.

Module ID "farming":
Parameter name
Parameter type
Description
fieldTypeID
String
ID of the building acting as a field.
itemTypeProduced
String
ID of the item produced.

Module ID "extracting":
Parameter name
Parameter type
Description
fieldTypeID
String
ID of the building acting as a field.
itemTypeProduced
String
ID of the item produced.
itemTypeConsumed
String
ID of the item which is consumed every few production cycles. See parameter "cyclerPerInput".
cyclerPerInput
Number
After how many cycles the item specified by "itemTypeConsumed" is consumed.

Module ID "mining":
Parameter name
Parameter type
Description
itemTypeProduced
String
ID of the item produced.

Module ID "assembling":
Parameter name
Parameter type
Description
inputs
Table
Lua-table listing the item types consumed.
outputs
Table
Lua-table listing the item types produced.

The module type "constructing" doesn't have any parameters.

Module ID "residential":
Parameter name
Parameter type
Description
type
Number
Specifies the type of residential building. 0 = residence, 1 = city center, 2 = public building.
populationTypeID
String
ID of the population housed in this residence.
cityCenterTier
Number
Tier of this city center building, starting from 1.
displayedPopulationTypeIDs
Table
Lua-table listing the population counts to show.
Building modules 2
Module ID "military":
Parameter name
Parameter type
Description
timeTillReady
Number
Time in seconds before the building can shoot.
turretID
String
ID of the turret type used by this building.

Module ID "shieldProjector":
Parameter name
Parameter type
Description
timeTillReady
Number
Time in seconds before the building can shoot.
shieldpointsProjected
Number
Amount of shieldpoints granted to nearby buildings in range.
projectorRange
Number
Range in which buildings are granted shieldpoints. Also influences the visual sphere.

Module ID "laser":
Parameter name
Parameter type
Description
type
Number
0 = main building, 1 = cooling unit, 2 = condensator, 3 = transformer
shieldpointsProjected
Number
Amount of shieldpoints granted to nearby buildings in range.
cooldown
Number
Cooldown duration in seconds.
chargeCapacity
Number
Power "points" required before shooting.
fireDuration
Number
Fire time in seconds.
damageBuildings
Number
Damage to hit buildings per tick.
damageSpaceships
Number
Damage to hit spaceships per tick.
impactRadius
Number
Radius of impact damage area.
laserIndex
Number
Index of building part to be used as laser.
bonus
Number
Depends on value of "type" parameter. If it's 1 = cooldown reduction, 2 = fire duration increase, 3 = damage increase.

Module ID "rocketSilo":
Parameter name
Parameter type
Description
rocketIDsConstructable
Table
Lua-table listing rocket types constructable by this silo. Maximum three.
launchTime
Number
Duration of launch sequence in seconds.
doorIndex1
Number
Index of building part to be used as the first door.
doorIndex2
Number
Index of building part to be used as the second door.
doorOpenTime
Number
Time in seconds the doors will take to open.
doorCloseTime
Number
Time in seconds the doors will take to close towards the end of the launch sequence.
maxDoorRotation
Number
Angle in degress.
rocketSpawnDepth
Number
Offset from the building center towards the planet center. Hint value "9.0".

Module ID "terraforming":
Parameter name
Parameter type
Description
isModule
Boolean
Whether this building is a terraforming size instead of the main terraformer building.
moduleBuildingID
String
ID of the building to use as terraforming sites.
Registering building menu entries
There are actually two functions to know here. You can either create a new civilization tab or add a building menu entry to an existing one. An example for a civilization tab is the "Science" tab in the building menu. It has the sub-tabs "Developers", "Researchers" and "Visionaries". To create a new tab use this function:

ContentRegistry.registerBuildingMenuCivilizationTab(<String>, <Table>)

Nr.
Name
Type
Effect
1
ID
String
Unique civilization tab identifier
2
Parameters
Table
Lua-Table containing remaining parameters

Table parameters:

Name
Type
Effect
langKey
String
Display name
iconStyleUnchecked
Table
Lua-table defining the icon style when not hovered nor selected. See example.
iconStyleChecked
Table
Lua-table defining the icon style when hovered or selected. See example.
unlockCondition
Table
Lua-table defining the unclock condition so it's visible. See example.
tiers
Table
Lua-table defining the sub-tabs of this civilization tab. See example.

Next we want to add building menu entries to a civilization sub-tab. This can be done using this function:

ContentRegistry.registerBuildingMenuEntry(<String>, <String>, <Table>)

Nr.
Name
Type
Effect
1
Civilization tab ID
String
Unique civilization tab identifier the building menu entry should be located in
2
Sub-tab ID
String
Unique sub-tab identifier the building menu entry should be located in
3
Parameters
Table
Lua-Table containing remaining parameters

Table parameters:

Name
Type
Effect
entryTitle
String
Display name
entryType
Enum
BUILDING_MENU_ENTRY_TYPE_PRODUCT or BUILDING_MENU_ENTRY_TYPE_LIST
entries
Table
Lua-table defining the actual entries. The structure depends on the given entryType. See example.
Registering spaceships
ContentRegistry.registerSpaceship(<String>, <Table>)

Nr.
Name
Type
Effect
1
ID
String
Unique spaceship identifier
2
Parameters
Table
Lua-Table containing remaining parameters

Table parameters:

Name
Type
Effect
spaceshipTypeID
String
Asset ID of the spaceship asset file (".pss")
langKey
String
Display name
iconID
String
Asset ID of the icon texture asset
speed
Number
Speed of the spaceship
accellerationTime
Number
Time in seconds required to accellerate to top speed
rotationSpeed
Number
Rotation speed
itemSlots
Number
Number of item slots
upkeep
Number
Upkeep costs per minute
spaceshipYard
String
buildingID of the spaceship yard able to build this spaceship
constructionTime
Number
Construction time in seconds
constructionCostMoney
Number
Construction costs in credits
constructionCostItems
Table
Lua-table of items required to construct the spaceship. See example.
possibleUnlockConditions
Table
Lua-table of unlock conditions. Meeting one unlocks the spaceship. See example.
maxHitpoints
Number
Maximum hitpoints
baseShieldpoints
Number
Maximum shieldpoints
militaryScore
Number
Military score granted by owning this spaceship
turretID
String
ID of the turret type used
maxTurretsActive
Number
Limit on active turrets
estimatedTurretsBuildings
Number
Estimate how many turrets will shoot at a target building at once. Used for DPS calculation.
estimatedTurretsSpaceships
Number
Estimate how many turrets will shoot at a target spaceship at once. Used for DPS calculation.
usedByPirates
Boolean
Whether pirates can choose to spawn spaceships of this type. Default value is "false".
disguiseEnabled
Boolean
Whether this spaceship can disguise near spaceships of the same faction
disguiseRange
Number
Range in which spaceships will be disguised
disguiseCap
Number
Maximum amount of disguides spaceships
revealRange
Number
Range at which enemy spaceships will reveal all disguides spaceships
victorySpaceship
Boolean
Whether this ship serves as a victory spaceship. Prevents normal usage. Default value is "false".
Registering technologies
ContentRegistry.registerTechnology(<String>, <Enum>, <Table>)

Nr.
Name
Type
Effect
1
ID
String
Unique technology identifier
2
Research orientation
Enum
RESEARCH_ORIENTATION_SCIENCE or RESEARCH_ORIENTATION_MILITARY
3
Parameters
Table
Lua-Table containing remaining parameters

Table parameters:

Name
Type
Effect
requiredPoints
Number
Required research points to complete this technology
linkID
String
Identifier to allow a technology being linked to another one (e.g. researching the depot in the science tree, automatically researches it in the military tree)
groupID
String
Identifier to group multiple technologies. Out of one group, only on technology can be researched.
unlockCondition
Table
Lua-table defining the unlock condition. See example.
requiredTechnologies
Table
Lua-table listing the required technologies to unlock this one. Only one of the given technologies has to be researched. If an unlock condition is defined.
unlockedBuildings
Table
Lua-table listing the buildings unlocked
unlockedSpaceships
Table
Lua-table listing the spaceships unlocked
unlockedRockets
Table
Lua-table listing the rockets unlocked
effect
Table
Lua-table defining the effect when this technology is researched. See example.

NOTE: To be able to research a technology, its unlock condition has to be fullfilled AND one of the requried technologies has to be researched, if defined.

There are three different effects types available:

Effect type
Description
MODULE_EFFECT_TYPE
Affects specific building modules. The effect-table requires a table named "moduleTypes", listing the affected module types. See list of building modules in chapter "Registering buildings".
BUILDING_EFFECT_TYPE
Affects specific building types. The effect-table requires a table named "buildingIDs", listing the affected building types.
SPACESHIP_EFFECT_TYPE
Affects specific spaceship types. The effect-table requires a table named "spaceshipIDs", listing the affected spaceship types.

Depending on the choosen effect type, different values need to be given in the effect-table:

Field name
Available for effect types
Description
moduleTypes
MODULE_EFFECT_TYPE
planetTypeIDs
MODULE_EFFECT_TYPE
Planet IDs
populationEffect
MODULE_EFFECT_TYPE
buildingIDs
BUILDING_EFFECT_TYPE
Affected buildings
spaceshipIDs
SPACESHIP_EFFECT_TYPE
Affected spaceships
productivityBonus
MODULE_EFFECT_TYPE
Production speed increase (1.0 = 100%)
itemLimitBonus
MODULE_EFFECT_TYPE
Additional storage capactity granted per depots
upkeepBonus
BUILDING_EFFECT_TYPE
Upkeep costs reduction
energyConsumptionBonus
BUILDING_EFFECT_TYPE
Power consumption reduction
energyProductionBonus
BUILDING_EFFECT_TYPE
Power produciton increase
speedBonus
SPACESHIP_EFFECT_TYPE
Speed increase
hitpointsBonus
BUILDING_EFFECT_TYPE and SPACESHIP_EFFECT_TYPE
Maximum hitpoints increase
damageBonus
BUILDING_EFFECT_TYPE and SPACESHIP_EFFECT_TYPE
Damage increase
readySpeedBonus
BUILDING_EFFECT_TYPE
Decreases the time a military building needs to start working
repairSpeedBonus
SPACESHIP_EFFECT_TYPE
Repair speed increase
shieldStrengthBonus
BUILDING_EFFECT_TYPE and SPACESHIP_EFFECT_TYPE
Projected shield points increase
shieldRegenerationSpeedBonus
BUILDING_EFFECT_TYPE and SPACESHIP_EFFECT_TYPE
Shield regeneration rate increase
attackRangeBonus
SPACESHIP_EFFECT_TYPE
Attack range increase
constructionSpeedBonus
SPACESHIP_EFFECT_TYPE
Construction time decrease
shieldProjectorActive
SPACESHIP_EFFECT_TYPE
Activates shield projection by this spaceship (e.g. protector & guardian)
shieldProjectorRange
SPACESHIP_EFFECT_TYPE
Range of shield projection
shieldProjectorPoints
SPACESHIP_EFFECT_TYPE
Amount of projected shield points
disguiseCapPlus
SPACESHIP_EFFECT_TYPE
Disguise cap increase
cooldownBonus
BUILDING_EFFECT_TYPE
Rocket silo cooldown reduction
Overriding content
To override or extend existing content objects you simply call the "register<X>" function again (e.g. "registerPlanetType"). Every element contained in your call will replace the previous elements, such as "modules" in buildings.
There are only a few exceptions:
  • Planet rings in world types can only be added, not replaced
  • Generated resources and ambient objects can only be added (threfore overriding the amount of the generated resources can be done indirectly by passing the new min / max values)
  • "overrideItem" can be used to override specific elements instead of passing all parameters again
  • The tiers in a civilization tab can only be added, not replaced
Ending
We hope this guide helped you understand how the modding for Planet S works. As mentioned before, looking at the files of the example mod "Cryptoworld" will help you a lot, as this guide is help pretty theoretical and abstract.

If you have any suggestions what may be missing in this guide, feel free to tell us in the comments.

We also want to point at our Discord server (https://discord.com/invite/JhA5M5EvXS) where you can discuss the modding with us and other players.
10 Comments
Klipsgoboom 2 Jun @ 9:31pm 
bread(7)
Klipsgoboom 19 Jan @ 5:45pm 
bread(6)
Klipsgoboom 3 Jan @ 12:26pm 
bread(5)
Klipsgoboom 23 Nov, 2024 @ 4:49pm 
bread(4)
Klipsgoboom 19 Oct, 2024 @ 11:52am 
bread(3)
Klipsgoboom 7 Sep, 2024 @ 8:12am 
bread (2)
Klipsgoboom 19 Jul, 2024 @ 4:29pm 
bread (1)
Klipsgoboom 4 Jun, 2024 @ 2:02am 
bread
Tea-tonky 1 Jun, 2024 @ 9:13am 
the time has come, it is time to put My little ponies in the game
Hoxton the second 1 Jun, 2024 @ 4:15am 
nice