Skip to main content

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

  1. Enter the game (or Full Conversion mod) normally, create a profile name (e.g. dev_user) and then exit.
  2. Enter the saves directory. Open main_settings.cfg and set LoadDebugMenu="true".
  3. You must set ForceCacheLoadingAndSkipSaving="false" or certain map changes will not show!
  4. (Optional) Set ShowPreMenu="false" (this will skip you some waiting on each game launch). Setting SaveConfig="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 set ExitMenuDirectly="true" if you wish to exit the game directly, without revisiting the main menu.
  5. Open user_settings.cfg (in "dev_user" folder), inside the Debug element add AllowQuickSave="true" (F4=save, F5=load) and change ScriptDebugOn="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".

tip

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.

  1. Open user_settings.cfg again, and inside the Map element, set Folder to the path of your maps folder, and set File to the name of the map file you want to load.