User Tools

Site Tools


start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
start [2020/05/06 16:01]
maxime
start [2022/03/30 10:53] (current)
maxime
Line 9: Line 9:
   * ** [[changelog|Changelog]] **   * ** [[changelog|Changelog]] **
   * ** [[migration|Migration Notes]] **   * ** [[migration|Migration Notes]] **
-  * ** [[guides|Guides]] **+  * ** [[guides|Community ​Guides]] **
  
 ===== More info on: ===== ===== More info on: =====
   * [[data-types|Data types]]   * [[data-types|Data types]]
   * [[enumerations|Enumerations]]   * [[enumerations|Enumerations]]
 +  * [[annotations|Annotations]]
   * [[example-mods|Example Mods]]   * [[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]]   * [[dependencies|Mod Dependencies]]
-  * [[components|Components ​and custom components]]+  ​* [[custom-classes|Custom classes]] 
 +  ​* [[components|Components]]
   * [[asset-override|Game asset override]]   * [[asset-override|Game asset override]]
 +  * [[behavior-trees|Behavior trees]]
 +  * [[events|Events]]
   * [[building-asset-processor|Building asset processor]]   * [[building-asset-processor|Building asset processor]]
   * [[level-of-detail|Level Of Detail (LOD)]]   * [[level-of-detail|Level Of Detail (LOD)]]
- 
-  * [[mod-io-functions|Mod IO functions]] 
  
   * [[workplaces|Create workplaces]]   * [[workplaces|Create workplaces]]
Line 28: Line 37:
   * [[walls|Create walls]]   * [[walls|Create walls]]
   * [[particle-effects|Create particle effects]]   * [[particle-effects|Create particle effects]]
 +  * [[construction-steps|Construction steps]]
   * [[material-sets|Material sets]]   * [[material-sets|Material sets]]
  
Line 35: Line 45:
  
 ===== The mod.json file ===== ===== The mod.json file =====
-The json file is loaded early and give basic information on your mod, without having to load your LUA scripts: +The json file is loaded early and give basic information on your mod, without having to load your LUA scripts
-<​file ​javascript ​mod.json>​+ 
 +In addition, this file contains the list of your mod's custom maps and their info, if any. 
 + 
 +<​file ​json mod.json>​
 { {
- "​Name":​ "​Simple Example Mod",​ +    ​"​Name":​ "​Simple Example Mod",​ 
- "​Author":​ "​Leo",​ +    "​Author":​ "​Leo",​ 
- "​Description":​ "A very simple mod example",​ +    "​Description":​ "A very simple mod example",​ 
- "​Version":​ "​2.0.0"​+    "​Version":​ "​2.0.0"​
 + 
 +    "​MapList":​ [ 
 +        { 
 +            "​Id":​ "​MY_MAP_ID_01",​ 
 +            "​Name":​ "My Custom Map",​ 
 +            "​Description":​ "This is a simple description of my map.",​ 
 +            "​PreviewImage":​ "​metadata/​my_map_preview.png"​ 
 +        } 
 +    ]
 } }
 </​file>​ </​file>​
 +
 +===== metadata folder =====
 +
 +For files that don't need to be loaded, you can add those files to a ''​metadata''​ folder at the root of your mod. This can be used for example to contain the map thumbnail images listed in the ''​mod.json''​ file.
  
 ===== The mod.lua script ===== ===== The mod.lua script =====
Line 56: Line 82:
  
 In order to include another LUA file, you can call the ''​dofile''​ function on your mod: In order to include another LUA file, you can call the ''​dofile''​ function on your mod:
-<code lua>+<​code ​lua somescript.lua>
 myMod:​dofile("​anotherscript.lua"​) myMod:​dofile("​anotherscript.lua"​)
 </​code>​ </​code>​
  
 This will execute the script ''​anotherscript.lua''​ from your mod folder. This will also pass the mod variable ''​myMod''​ to the script. So you will be able to access ''​myMod''​ from ''​anotherscript.lua''​ this way: This will execute the script ''​anotherscript.lua''​ from your mod folder. This will also pass the mod variable ''​myMod''​ to the script. So you will be able to access ''​myMod''​ from ''​anotherscript.lua''​ this way:
-<file lua anotherscript.lua>​+<code lua anotherscript.lua>​
 local myMod = ... -- retrieve arguments passed to the script local myMod = ... -- retrieve arguments passed to the script
  
 -- do stuff with myMod -- do stuff with myMod
 -- ... -- ...
-</file>+</code>
  
 In addition, you can pass any number of variable to the called script: In addition, you can pass any number of variable to the called script:
-<code lua>+<​code ​lua somescript.lua>
 myMod:​dofile("​anotherscript.lua",​ 42, "A Super String",​ { 1, 4, 12 }) myMod:​dofile("​anotherscript.lua",​ 42, "A Super String",​ { 1, 4, 12 })
 </​code>​ </​code>​
  
-<file lua anotherscript.lua>​+<code lua anotherscript.lua>​
 local myMod, anInteger, aString, anArray = ... -- retrieve arguments passed to the script local myMod, anInteger, aString, anArray = ... -- retrieve arguments passed to the script
-</file>+</code>
  
 ===== Enabling / Disabling a mod ===== ===== Enabling / Disabling a mod =====
Line 84: Line 110:
 If you want to fully ignore a mod, you can either remove it from your mods folder, or rename the ''​mod.lua''​ file into something else (''​mod_.lua''​ for instance). If you want to fully ignore a mod, you can either remove it from your mods folder, or rename the ''​mod.lua''​ file into something else (''​mod_.lua''​ for instance).
 ===== Logging / Debugging ===== ===== Logging / Debugging =====
 +
 +==== Log ====
  
 You can log your own logs into foundation log file: You can log your own logs into foundation log file:
 +
 <code lua> <code lua>
-myMod:​log("​Hello World!"​) +myMod:​log("​Hello World!"​) ​-- creates an INFO log entry 
-myMod:​logWarning("​This is a warning!"​) +myMod:​logWarning("​This is a warning!"​) ​-- creates a WARNING log entry 
-myMod:​logError("​This is an error!"​)+myMod:​logError("​This is an error!"​) ​-- creates an ERROR log entry
 </​code>​ </​code>​
  
-You can also open a blocking message box for debugging purpose:+In order to isolate mods related logs, Foundation will log most of mod related information in a specific log file located in ''​Documents/​Polymorph Games/​Foundation/​mod-%NAME%.log''​ 
 + 
 +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 ''​Documents/​Polymorph Games/​Foundation/​foundation.log''​. 
 + 
 +==== Message box ==== 
 + 
 +You can also open a blocking message box for debugging purpose. This function is recommended for mod development only. 
 <code lua> <code lua>
 myMod:​msgBox("​Hello there!"​) myMod:​msgBox("​Hello there!"​)
 </​code>​ </​code>​
  
-In order to isolate mods related logsFoundation will log most of mod related information ​in a specific log file located in ''​Documents/​Polymorph Games/​Foundation/​mod-%NAME%.log''​+For this function ​to workthe user must manually set the field ''​ModMsgBoxEnabled''​ to ''​true'' ​in the user settings ​file (''​usersetting.config''​). Otherwise, it will only create a new log entry, like the ''​log''​ function.
  
-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 ''​Documents/​Polymorph Games/​Foundation/​foundation.log''​.+===== What is this generated_ids.lua file? =====
  
-===== What is this generated_ids.lua file? =====  
 Internally, Foundation uses random unique IDs (GUID) to identify most objects and resources. ​ 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 "​modding name" and the ID of the asset. When a new asset is added to the mod, Foundation will create a new ID for it, and will store the association between the "​modding name" and the ID of the asset.
Line 108: Line 143:
  
 ===== Sharing a mod ===== ===== 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. 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.
  
Line 113: Line 149:
  
 You'll have to upload a zip of your mod. Make sure the zip contains directly the mod files (''​mod.lua''​ needs to be at the root of the zip). You'll have to upload a zip of your mod. Make sure the zip contains directly the mod files (''​mod.lua''​ needs to be at the root of the zip).
 +
 +===== Quickly reload mods =====
 +
 +When developing and testing a mod, you can quickly reload your game by pressing ''​Ctrl + Shift + R''​.
start.1588795276.txt.gz · Last modified: 2020/05/06 16:01 by maxime