start
Differences
This shows you the differences between two versions of the page.
| — | start [2022/03/30 10:53] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Welcome to the Foundation Modding Wiki ====== | ||
| + | **Warning** | ||
| + | |||
| + | Modding capabilities are very embryonic. Expect a lot of improvement and changes in the future. | ||
| + | |||
| + | This documentation is a draft with a few guidelines, it will evolve gradually with the development of modding features. | ||
| + | |||
| + | * ** [[changelog|Changelog]] ** | ||
| + | * ** [[migration|Migration Notes]] ** | ||
| + | * ** [[guides|Community Guides]] ** | ||
| + | |||
| + | ===== More info on: ===== | ||
| + | * [[data-types|Data types]] | ||
| + | * [[enumerations|Enumerations]] | ||
| + | * [[annotations|Annotations]] | ||
| + | * [[example-mods|Example Mods]] | ||
| + | * [[texture-usage-policy|Game texture usage policy]] | ||
| + | * [[debugging-mods|Debugging mods]] | ||
| + | |||
| + | * [[foundation-library-functions|Foundation library functions]] | ||
| + | * [[mod-management-functions|Mod management functions]] | ||
| + | * [[version-library|Version library]] | ||
| + | * [[mod-io-functions|Mod IO functions]] | ||
| + | |||
| + | * [[dependencies|Mod Dependencies]] | ||
| + | * [[custom-classes|Custom classes]] | ||
| + | * [[components|Components]] | ||
| + | * [[asset-override|Game asset override]] | ||
| + | * [[behavior-trees|Behavior trees]] | ||
| + | * [[events|Events]] | ||
| + | * [[building-asset-processor|Building asset processor]] | ||
| + | * [[level-of-detail|Level Of Detail (LOD)]] | ||
| + | |||
| + | * [[workplaces|Create workplaces]] | ||
| + | * [[monuments|Create monuments and bridges]] | ||
| + | * [[walls|Create walls]] | ||
| + | * [[particle-effects|Create particle effects]] | ||
| + | * [[construction-steps|Construction steps]] | ||
| + | * [[material-sets|Material sets]] | ||
| + | |||
| + | ===== Where do I start? ===== | ||
| + | * Create a new folder in '' | ||
| + | * In your mod folder, create a '' | ||
| + | |||
| + | ===== The mod.json file ===== | ||
| + | The json file is loaded early and give basic information on your mod, without having to load your LUA scripts. | ||
| + | |||
| + | In addition, this file contains the list of your mod's custom maps and their info, if any. | ||
| + | |||
| + | <file json mod.json> | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | |||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== metadata folder ===== | ||
| + | |||
| + | For files that don't need to be loaded, you can add those files to a '' | ||
| + | |||
| + | ===== The mod.lua script ===== | ||
| + | First, you have to create your new mod instance: | ||
| + | <file lua mod.lua> | ||
| + | local myMod = foundation.createMod(); | ||
| + | </ | ||
| + | You can then include other script, declare new assets, [[asset-override|override existing assets]], etc... | ||
| + | |||
| + | ===== Including other LUA files ===== | ||
| + | '' | ||
| + | |||
| + | In order to include another LUA file, you can call the '' | ||
| + | <code lua somescript.lua> | ||
| + | myMod: | ||
| + | </ | ||
| + | |||
| + | This will execute the script '' | ||
| + | <code lua anotherscript.lua> | ||
| + | local myMod = ... -- retrieve arguments passed to the script | ||
| + | |||
| + | -- do stuff with myMod | ||
| + | -- ... | ||
| + | </ | ||
| + | |||
| + | In addition, you can pass any number of variable to the called script: | ||
| + | <code lua somescript.lua> | ||
| + | myMod: | ||
| + | </ | ||
| + | |||
| + | <code lua anotherscript.lua> | ||
| + | local myMod, anInteger, aString, anArray = ... -- retrieve arguments passed to the script | ||
| + | </ | ||
| + | |||
| + | ===== Enabling / Disabling a mod ===== | ||
| + | You can enable / disable mods from the '' | ||
| + | |||
| + | Be aware that even when a mod is disabled, most of the mod assets are loaded anyway, but are not active. | ||
| + | |||
| + | If you want to fully ignore a mod, you can either remove it from your mods folder, or rename the '' | ||
| + | ===== Logging / Debugging ===== | ||
| + | |||
| + | ==== Log ==== | ||
| + | |||
| + | You can log your own logs into foundation log file: | ||
| + | |||
| + | <code lua> | ||
| + | myMod: | ||
| + | myMod: | ||
| + | myMod: | ||
| + | </ | ||
| + | |||
| + | In order to isolate mods related logs, Foundation will log most of mod related information in a specific log file located in '' | ||
| + | |||
| + | However, keep in mind that a mod can interact with the game in various indirect way, and some valuable information could still be hidden in the global game log in '' | ||
| + | |||
| + | ==== Message box ==== | ||
| + | |||
| + | You can also open a blocking message box for debugging purpose. This function is recommended for mod development only. | ||
| + | |||
| + | <code lua> | ||
| + | myMod: | ||
| + | </ | ||
| + | |||
| + | For this function to work, the user must manually set the field '' | ||
| + | |||
| + | ===== What is this generated_ids.lua file? ===== | ||
| + | |||
| + | Internally, Foundation uses random unique IDs (GUID) to identify most objects and resources. | ||
| + | When a new asset is added to the mod, Foundation will create a new ID for it, and will store the association between the " | ||
| + | |||
| + | The '' | ||
| + | |||
| + | ===== Sharing a mod ===== | ||
| + | |||
| + | Modders are encouraged to use **mod.io** to share their mods. Mods shared this way can be found and downloaded from the in-game mod browser. | ||
| + | |||
| + | Here is the Foundation page: [[https:// | ||
| + | |||
| + | You'll have to upload a zip of your mod. Make sure the zip contains directly the mod files ('' | ||
| + | |||
| + | ===== Quickly reload mods ===== | ||
| + | |||
| + | When developing and testing a mod, you can quickly reload your game by pressing '' | ||
start.1588796456.txt.gz · Last modified: 2020/05/06 16:20 (external edit)
