Isotopeia:Modding

From matthyWiki
Jump to navigation Jump to search
Page quality
★★★★★

In Isotopeia, the modding API was introduced in the version 1.4.0 and is a way to add upgrades to the game without modifying the source code directly. The modding API is most commonly used to add upgrades using the custom JSON format, but direct JavaScript additions are also included.


Utilities[edit]

Utilities are methods through which the modding API can be accessed or utilized more effectively/easily.

combinemods.html[edit]

./combinemods.html is a file included in the Isotopeia source code which enables compressing 2 mods' contents into 1 singular JSON object.

Usage[edit]

To use the combinemods.html tool, one must input the JSON for one mod in the first text input, and the JSON for the second mod in the second text input. Then, the user must click the "Combine" button to the right of the "Mod 2" input to compress the mods into one. The outputted, combined mod will be put into the "Mod 1" box to easily add more mods to the same JSON object.


Modding API documentation[edit]

All of the following headers and contents in code blocks (like this) are formatted in JSON, contained in an object.

buildings[edit]

buildings can be made at the root of the object, like this:

{
    "buildings": {...}
}

buildings contains the properties for all types of currencies' upgrades (Ve or en, e- or e, and u or u).

buildings:e[edit]

buildings:e means the e object contained in the buildings object, which itself is in the main object. The e stands for electron, which represents that the buildings:e object contains electron upgrades.

buildings:en[edit]

buildings:en means the en object contained in the buildings object, which itself is in the main object. The en stands for electron neutrino, which represents that the buildings:en object contains electron neutrino upgrades.

buildings:u[edit]

buildings:u means the u object contained in the buildings object, which itself is in the main object. The u stands for up quark, which represents that the buildings:u object contains up quark upgrades.


Upgrade format for buildings:+e/en/u[edit]

The upgrade format is how the upgrades are defined in the e/en/u objects in thebuildings object (in the main object). These are contained within another object.

price[edit]

price is the starting price for the upgrade; in other words, if you were to buy 1 of this upgrade starting at 0, this is what it would cost. The curves of how the price is modified for more than 1 or past your first upgrade is always set at Math.floor(1.25*previousPrice).

name[edit]

name is the display name of the upgrade that the end user will see, as opposed to id which is purely internal and for discerning different upgrades.

perSecond[edit]

perSecond represents how many of the currency (e/en/u) that you will gain per second after buying one upgrade.

id[edit]

id is a purely internal identifier to differentiate between 2 objects. This is traditionally formatted in camelCase while trying to avoid abbreviating unless the name is too long.

customBehaviors[edit]

The customBehaviors section under the main object allows you to include your own JavaScript that will be ran when the webpage is loaded and never again until you reload or close/reopen the game. This is programatically implemented using the window.onload function while iterating through each mod added.