This wiki is archived from 2021-09-05
Example Mod Custom Skybox
File:Titans-icon.png Example Mod: Custom Skybox
This example will demonstrate how to make a client mod that will shadow files. Shadowing means that files in this mod will take the place of the original files that come with PA. It also shows the use of the papatran tool to generate textures readable by Planetary Annihilation.
File:Gold-rank-icon.png Custom Skybox
Here, we will change the background of a Planetary Annihilation system, also called the skybox. The planet system background is rendered on the inside of a large cube. The six sides are papa textures that can be found in /pa/terrain/sky/textures and are named:
- skybox_01_back.papa
- skybox_01_bottom.papa
- skybox_01_front.papa
- skybox_01_left.papa
- skybox_01_right.papa
- skybox_01_top.papa
These images need to fit in a special way such that they all connect to each other at the edges of the cube as depicted here:
File:Gold-rank-icon.png Mod structure
To create a new local client mod, navigate to the Planetary Annihilation Data Directory and if it does not already exist, create a new directory called "client_mods". Inside that directory create a directory for our new mod, for example: "com.pa.demo.mycustomskybox". And inside of that directory, create a new text file called "modinfo.json". This will contain the information about our mod. It should look like this:
{ "context": "client", "identifier": "com.pa.you.skybox.name", "display_name": "My Custom Skybox", "description": "This is a demonstration of a custom skybox", "author": "demo", "version": "1.0", "build": "105067", "date": "2017-11-13", "signature": "not yet implemented", "forum": "", "priority": 100, "icon": "", "category": ["skybox"] }
See here for more details on the meaning of these entries.
Next, we are going to add the files we are going to shadow. To do so, we need to create the exact same file structure that PA uses. Since the skybox textures in Planetary Annihilation are located in pa/terrain/sky/textures, we have to create a new directory called "pa", then inside that directory a new directory called "terrain", and inside that "sky", and then finally inside that "textures".
Now we should have the following structure:
- Planetary Annihilation Data Directory
- client_mods
- com.pa.demo.mycustomskybox
- modinfo.json
- pa
- terrain
- sky
- textures
- sky
- terrain
- com.pa.demo.mycustomskybox
- client_mods
File:Gold-rank-icon.png Generating textures
Textures for the skybox are generated from PNG images that have a resolution of 1024x1024. We need six of them for all of the sides as shown above in the reference image.