This wiki is archived from 2021-09-05

Creating Your First Planetary Annihilation Mod: Difference between revisions

From Planetary Annihilation: TITANS and Classic PA Wiki
Jump to navigation Jump to search
(Created page with "Category:Modding = 50px Creating your first mod = == 50px Introduction == Mods can generally be downloaded from t...")
 
Line 3: Line 3:


== [[File:platinum-rank-icon.png|50px]] Introduction ==
== [[File:platinum-rank-icon.png|50px]] Introduction ==
Mods can generally be downloaded from the Community Mods manager built into Planetary Annihilation. However, when developing your own mod, you should start with a local copy for development purposes. Once you are happy with the way the mod works, you can upload it to the Community Mods manager so other players can download it.
 
Released mods are downloaded from the in-game Community Mods.
 
When developing your own mod we use filesystem mods.


The first step is to pick a Mod Identifier.
The first step is to pick a Mod Identifier.
{{Mod Identifiers}}
{{Mod Identifiers}}


== [[File:platinum-rank-icon.png|50px]] File structure ==
== [[File:platinum-rank-icon.png|50px]] Mod Directory Structure ==
Local mods are located in a special directory inside the [[Planetary Annihilation Data Directory]]. If you wish to create [[Client Mods]], make a new subdirectory in the "client_mods" folder. If you want to create [[Server Mods]], create a new subdirectory in the "server_mods" folder. The recommended practise is to use the mod identifier as the name of your new subdirectory.
 
Local filesystem mods are saved in the [[Planetary Annihilation Data Directory]] based on the type of mod:


Inside that new subdirectory, you need to make a new text file called "modinfo.json". This file contains the metadata for your mod, such as your name, the name and type of your mod, and others. The file is formatted in JSON and the fields are described in [[Mod Structure]].
* Client Mods: client_mods
* Server Mods: server_mods
 
Every mod must be contained a single top level directory with a JSON modinfo.json file as documented in [[Mod Structure]].
 
A new game lobby UI client mod would be installed a filesystem client mod using:
 
* [[Planetary Annihilation Data Directory]]
** client_mods
*** com.pa.mikeyh.some-mod-name
**** modinfo.json
**** ui
***** mods
****** com.pa.mikeyh.some-mod-name
******* new_game.js


== [[File:platinum-rank-icon.png|50px]] Enabling the mod ==
== [[File:platinum-rank-icon.png|50px]] Enabling the mod ==
Start Planetary Annihilation and press the Community Mods button. The go to the Installed tab. Your mod should now be visible there. If it is not, check if the modinfo.json you created is valid JSON and contains all of the mandatory fields and press Reload File System Mods.


Click on your mod and press the Enable button. The orange bar in front of your mod name should now change to green, indicating that the mod is active. This means you are good to go and can start developing the mod.
Filesystem mods with a valid modinfo.json will automatically appear in the installed tab.
 
To avoid conflicts with your released version use a different identifier. eg com.pa.mikeyh-some-mod-name-dev
 
If your mod does not appear check the following:
* modinfo.json is valid JSON with all mandatory properties as documented in [[Mod Structure]]
* mod directory is in the correct mod directory
 
You can edit modinfo.json then reload file system mods to update your info without restating PA.
 
File changes typically require a restart of PA.
 
== [[File:gold-rank-icon.png|50px]] Submitting Your Mod ==
 
Mods are currently still submitted to the old PAMM server using your GitHub account via: http://pamm-mereth.rhcloud.com/mod
 
The PAMM server requires a downloadable URL to a ZIP archive of your top level directory.

Revision as of 01:15, 5 January 2017

File:Titans-icon.png Creating your first mod

File:Platinum-rank-icon.png Introduction

Released mods are downloaded from the in-game Community Mods.

When developing your own mod we use filesystem mods.

The first step is to pick a Mod Identifier. Every mod must have a unique identifier.

The required format is lowercase reverse domain name notation.

eg com.palobby.some-mod-name

If you don't have your own domain or prefer to use your forum / game handle then prefix with com.pa.handle.some-mod-name

eg com.pa.mikeyh.some-mod-name

My personal preference is dashes (-) over underscores (_) for readability.

File:Platinum-rank-icon.png Mod Directory Structure

Local filesystem mods are saved in the Planetary Annihilation Data Directory based on the type of mod:

  • Client Mods: client_mods
  • Server Mods: server_mods

Every mod must be contained a single top level directory with a JSON modinfo.json file as documented in Mod Structure.

A new game lobby UI client mod would be installed a filesystem client mod using:

File:Platinum-rank-icon.png Enabling the mod

Filesystem mods with a valid modinfo.json will automatically appear in the installed tab.

To avoid conflicts with your released version use a different identifier. eg com.pa.mikeyh-some-mod-name-dev

If your mod does not appear check the following:

  • modinfo.json is valid JSON with all mandatory properties as documented in Mod Structure
  • mod directory is in the correct mod directory

You can edit modinfo.json then reload file system mods to update your info without restating PA.

File changes typically require a restart of PA.

File:Gold-rank-icon.png Submitting Your Mod

Mods are currently still submitted to the old PAMM server using your GitHub account via: http://pamm-mereth.rhcloud.com/mod

The PAMM server requires a downloadable URL to a ZIP archive of your top level directory.