From Prison Architect Wiki
Jump to navigation Jump to search

Modding (i.e. creating Mods) is a fun pastime and can be used to expand and enhance the gaming experience of Prison Architect.

Game data[edit | edit source]

Introversion has added official mod support in Alpha 15 and extended it substantially in Alpha 24. All mods should now come packaged in a zip file, to be extracted into the users mods folder.

  • Windows users can find this folder at:
    %UserProfile%\AppData\Local\Introversion\Prison Architect\mods
  • Mac users can find this folder at:
    /Users/Username/Library/Application Support/Prison Architect/mods
  • Linux users can find this folder at:
    ~/.Prison Architect/mods

Mods should contain a manifest.txt detailing the name, author, date, and version. A thumbnail.png can also be provided and is optional. This is the image that will display to users when they view it in-game.

Here are two official SAMPLE mods, showing how to put mods together correctly:

More detailed instructions can be found in this topic in the Prison Architect developer forums:

Getting Started[edit | edit source]

Using a tool (e.g 7-zip), extract the contents of the 'main.dat' file, found in your 'prison architect' folder, to the same directory. You will now have a 'data' folder. This is doing the same job as the 'main.dat' file but is being loaded as an addition to the already loaded files. Any changes you make here will affect the game. You may want to repeat this process with the 'sounds.dat' file as well.

Any file that is in these files will be loaded after the original game file is loaded, and will overwrite the files from the game in the memory. This will NOT overwrite the original files, and will only be an addition to the already loaded content. This means for example that e.g. if you are missing some new translation lines in your base-language.txt file, the English text will be loaded from the original file.

You can also define new objects, entities, items, materials, rooms, research, programs, grants, jobs, production rules, needs and need providers, and load your own sprites (please keep your sprites.png as small/compact as possible - so more mods can be loaded at once).

Extra note: If there are multiple mods active, the last one loaded will have the highest priority. This means that if there are multiple mods that are translating the game, the mod that is loaded the last will take precedence over the other mods.

For information about the internal structure of many files found in main.dat, see File Format.

The Steam Workshop can now be used to share mods.

Game Translation[edit | edit source]

Main article: Game Translation

To make a translation for the game, you need to edit base-language.txt found in data/language.

Lua[edit | edit source]

Main article: Lua

Prison Architect uses Lua extensively. Many of the game systems are written in Lua and can be easily modified.

Using Multiple Grant Mods[edit | edit source]

No special procedure required anymore as of Alpha 24.[verification needed] Before, the following needed to be done:

  1. Use 7-zip to extract "Main.dat" (you can download 7-zip from here).
  2. Open the new created "main" folder.
  3. Open "grants.lua" (a Lua IDE can be downloaded from this SourceForge link, but Lua scripts can be edited in every text editor as well).
  4. Copy the modified lines from both of the Grant mods.
  5. Paste them in the "Grant.Lua" inside the "main" folder.
  6. Go to Prison Architect > Main > Language and open "base-language.txt".
  7. Repeat Step 4.
  8. Paste them (the lines) inside "base-language.txt" on the: "Objectives, Grants" Section of the .txt (near the end)

Opening The Debug Console[edit | edit source]

To print some debugging output, call the following inside your Lua script:


As opposed to when errors happen with your script, this does not automatically open the debug console. To do so, press F3 when the modified object is selected (every object has its own debug console).

.prison files[edit | edit source]

Main article: .prison

Saves are made in .prison files which can be easily edited in any text editor.

Internals[edit | edit source]

Some reverse engineering work has been done on the internals of the game. This has been done before Prison Architect had official support for mods, but still may be useful for modders that wish to alter core game functionality, or provide bolt-on tools. At least Linux versions are distributed without stripping symbols, but much of the debug features are stubbed out with rep retn, so there is little hope of getting the neat debug window from the videos. However, it's likely possible to patch the renderer to render, for example, the red area where stuff is thrown into the prison with little effort.

If the Windows version is not shipped with symbols, it might be possible to use bindiff to map the symbols from the Linux version to Windows.

Right now, the following is known:

  • Most of the prisoner structure (position, velocity, destination, age, name, health, assigned cell ID, gang ID)
  • Most of the prisoner needs structure (need type, current level, max level, time to max level, time to failure)
  • Some of the actor type constants.
  • The list of need type constants.
  • Float loading code offset for money (used to leak money address on heap)