HPL2/Development Environment

From Frictional Wiki
< HPL2
Revision as of 14:47, 9 July 2020 by Maintenance script (talk | contribs) (Upload from wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Setting up Development Environment

In order to make maps for Amnesia you will need to set up the game, so you can easily test maps and reload scripts. First of all, follow these steps to create a dev user:

    1. Enter the game normally, create a profile name (e.g. MyName) and then exit.
    2. Enter the save directory ("My Documents/Amnesia/Main" in windows by default; "~/.frictionalgames/Amnesia/Main" in Linux) and rename the user name (e.g. MyName) to "dev_user".
    3. Open main_settings.cfg and set ShowMenu="false", ShowPreMenu="false", ExitMenuDirectly="true", LoadDebugMenu="true" (also setting SaveConfig="false" should be good).
    4. If Amnesia is 1.0.1 or above, you must set ForceCacheLoadingAndSkipSaving="false" main_settings.cfg, or else map changes will not show!
    5. Open user_settings.cfg (in "dev_user" folder), inside the Debug element add AllowQuickSave="true" (F4=save, F5=load) and change ScriptDebugOn="true".
    6. In user_settings.cfg, inside the Map element set Folder="" to the root folder for your maps (eg Folder="MyMaps/"), this folder MUST be located inside the maps folder in the game directory (where you put the tools).
    7. In user_settings.cfg, inside the Map element set File="" to point to the map you want to load (eg File="my_map.map").
    8. In order to avoid running into "File index out of bounds" errors when designing your custom story in the level editor, edit the file resources.cfg located in the root the directory of Amnesia (i.e. where Amnesia is installed) and add the custom_stories directory to the list.

Now you can simply run Amnesia and the map will be loaded directly without any menu. You can now press F1 to open a debug menu to turn on/off various things and more importantly quick reload the map. This is probably the most important thing to do when editing. When changed a script or added entities to a map, do NOT restart the game, instead simply press "Quick reload". If a mesh or texture has been updated, you need to press "Reload".

By setting ScriptDebugOn="true" you have set the script function ScriptDebugOn() to return true. This is extremly important as you can add in your startup code something like:

if(ScriptDebugOn()) {
//Do your setup stuff
}

This will enable you to easily add all kinds of debug stuff (giving lantern, extra items, etc) wihout having to worry about removing it for the final release.

Now you should be ready to start some editing!