Custom units have two or three components:
A more complex unit can have multiple components, where each component is named in the base or root JSON, and each component can be made up the same as the root or base component.
To make a custom unit, the 2 required pieces are a unit image and a unit JSON, both of which will need to be placed in the map folder for the map you are making. At time of writing this requires external tools and we do not yet have access to a list of the unit JSON parameters or IRPL calls; we intend to update this page as we get that information.
The unit image is an image file, at time of writing we do not yet have a list of what image formats are supported and have mostly been using png files. Every 2×2 area of ship pixels will correspond to a single tile of terrain. So if your image is 39 pixels wide and 15 pixels tall, your ship will be 20 terrain tiles wide and 8 terrain tiles tall. Also note that the bigger the ship the higher the build cost will be.
You want a program that can make pixel art png files, including deleting pixels so you can have non-rectangular shapes.
To get to your Creeper World IXE files you can copy
%Appdata%\CreeperWorldIXE\gamedata
into file explorer or navigate to
Appdata\Roaming\CreeperWorldIXE\gamedata
If the map you intend to change is in the map editor, click the 'mapeditor' folder and then the folder that shares the name of the map in your list of editor projects and you should see a save.cwi file in there. You can just place the files next to the save.cwi file, but for organisation purposes and ease of copying the unit to other maps, it is easiest to place the unit inside a folder.
At time of writing we do not have access to the full list of JSON calls, we are currently making unit JSONs by copying information from known JSONs and some guesswork. Below is a standard setup for custom player units; there are a few fields that need to be filled out to function though.
{ "type": "unit", "displayname": "My Awesome Unit", "image": "body.png", "position": [0, 0], "pivot": [0.5, 0.5], "maxammo": 100, "maxcammo": 3000, "ammorequesttime": 6, "cammorequesttime": 6, "permanentinventory": true, "movable": true, "parts": [ ], "controllers": [ { "name": "ondestroy_sandexplosion", "amt": 500, "minvelocity": 1.5, "maxvelocity": 3, "color0":[0.2, 0.4, 2], "color1":[0.2, 0.6, 2], "sandtype": 98, } ], }
Copy paste this into a text editor and fill out the following fields:
All that remains is to add the parts; below the “parts” line, paste any of the following to add that part to your ship. Don't worry about position yet, it is easier to position the weapons once the unit is placed in game.
{"part": "$/weapon_cannon/weapon_cannon.json", "position": [0, 0]},
{"part": "$/weapon_rocket/weapon_rocket.json", "position": [0, 0]},
{"part": "$/weapon_lathe/weapon_lathe.json", "position": [0, 0]},
{"part": "$/weapon_freeze/weapon_freeze.json", "position": [0, 0]},
{"part": "$/weapon_sentrygun/weapon_sentrygun.json", "position": [0, 0]},
{"part": "$/weapon_phantombeam/weapon_phantombeam.json", "position": [0, 0]},
{"part": "$/module_sanddropper/module_sanddropper.json", "position": [0, 0]},
{"part": "$/weapon_maker/weapon_maker.json", "position": [0, 0]},
Save the file name as what you want your ship to be named in code (make sure to use the extension .json) and place that file with the image from the first step.
To add a global script to your map - one that will run without the need of a unit - you need to add a global.json file to the root of your project with the following content
{ "type": "global", "scripts": [ {"name": "mission.irpl", "run_when_paused" : false}, ] }
At this point your unit should be ready to be placed in game. Go to the map with your unit and navigate to the scripting tab of the editor. The 'Build Modules' button is in the top left corner of that tab, hit it and you will hopefully see “Success: Added Module:”. If this fails, welcome to programming; at time of writing we only have had access to this for about 5 hours so we can't provide much assistance in troubleshooting.
Going over to the units tab you should see your creation added to the units list. Place it in the map and now we can start tweaking the module and weapon positions. In the copied blocks above, you should see [0, 0] in each line. The first number moves the module left and right, the second moves it up and down. A value of 1 corresponds to 1 terrain pixel or 2 ship pixels so don't be afraid to use numbers like 0.5 or -1.2 to get the positioning correct. After you make the position adjustment, save the JSON file and hit the 'Build Modules' button again; it should reposition the modules on the placed ship.
And with that, congratulations! You have made your own ship.