Development Environment
In order to mod Amnesia comfortably, you will need to set up the game so you can easily test maps and reload scripts. To do that, it is recommended to have two in-game users; a regular one (for testing how the mod works for the player) and a developer one. This article is about the basic set up of a developer user.
Setting up a dev user
- Enter the game (or Full Conversion mod) normally, create a profile name (e.g. dev_user) and then exit.
- Enter the saves directory. Open
main_settings.cfg
and setLoadDebugMenu="true"
. - You must set
ForceCacheLoadingAndSkipSaving="false"
or certain map changes will not show! - (Optional) Set
ShowPreMenu="false"
(this will skip you some waiting on each game launch). SettingSaveConfig="false"
will make sure that the in-game changes don't overwrite changes to this file, and it is recommended to do. You can also setExitMenuDirectly="true"
if you wish to exit the game directly, without revisiting the main menu. - Open
user_settings.cfg
(in "dev_user" folder), inside theDebug
element addAllowQuickSave="true"
(F4=save, F5=load) and changeScriptDebugOn="true"
.
You can now press F1 in-game to open a debug menu to turn on/off various things and more importantly quick reload the map (F2). This is probably the most important thing to do when editing. When changing a script or adding entities to a map, do NOT restart the game, instead simply press "Quick reload" or F2. If a mesh or texture has been updated (e.g. in an Entity file), you need to press "Reload".
If you start the game with a syntax error in your script file, it will crash. But if you reload the script with F2 with a syntax error, it will instead give you an error description. Therefore it's a good idea to load up the game without errors before making uncertain changes to the script.
Script debug
By setting ScriptDebug="true"
in the user settings, you can use the script function ScriptDebugOn()
to conditionally program features based on whether or not debug mode is enabled. For example it allows you to easily add a lantern at the start of a map without having to worry about it ending up in the final release if you were to forget to remove it.
if (ScriptDebugOn()) {
GiveItemFromFile("lantern", "lantern.ent");
}
Create a separate user (such as prod_user) to test how the game works with a non-debug user.
Loading directly into a map
Sometimes it can be useful to make the game directly load into a map when launched, bypassing the time it takes from loading the menu and selecting the correct options.
- Open
user_settings.cfg
again, and inside theMap
element, setFolder
to the path of your maps folder, and setFile
to the name of the map file you want to load.