Prey Modding Guide

by RoSoDude, with help from Buzboy (creator of the SHOCK overhaul mod)

Getting started
  1. Obtain Prey Covert.exe here (mirror)
  2. Obtain BinXMLDecode.exe here (mirror)
  3. Copy “…\Prey\GameSDK\GameData.pak” and “…\Prey\GameSDK\Precache\patch.pak” into your working directory
    (To mod Mooncrash, use “…\Prey\Whiplash\GameSDK\GameData.pak”, “…\Prey\Whiplash\GameSDK\ArkGameData.pak”, and “…\Prey\Whiplash\GameSDK\Precache\patch.pak”)
  4. Open the command line in your working directory (click on the address bar in Windows Explorer and type “cmd”) and run the following two commands:
    PreyConvert.exe GameData.pak
    PreyConvert.exe patch.pak
  5. Unzip the newly converted GameData.zip and patch.zip files
  6. Run the following command:
    for /r .\ %f in (*.xml) do BinXMLDecode.exe "%f" "%f"
    Now you have all of the .xml files (defining the properties of many game elements) in human-readable format
  7. Create a new folder in your working directory and copy whichever .xml files you wish to edit into it, maintaining the original file structure
    Note that if a file is in patch.pak, it is the more recent version and you should work from that rather than from the version in GameData.pak
    There is no need to merge all of the files from patch.pak and GameData.pak, only work with the .xml files you need (but maintain the original file structure!)
  8. Edit the .xml files in Notepad++ (not Notepad, as it can’t observe proper whitespace rules)
  9. Once you are done with your edits, select all of the edited files and folders and compress them into patch_[YOUR MOD NAME].zip (don’t include [])
  10. Rename the file extension to patch_[YOUR MOD NAME].pak
  11. Copy patch_[YOUR MOD NAME].pak into “…\Prey\GameSDK\Precache\”
  12. Start your game and test your changes. Note that you will need to create a new game file for changes in e.g. PlayerConfig.xml to go into effect

If you wish to uninstall your mod, simply remove patch_[YOUR MOD NAME].pak. Note that this may break modded savegames.
To expedite steps 9-10, check out the Prey Mod Packer Utility:
https://rosodudemods.wordpress.com/prey-mod-packer-utility/
This will also ensure that only the correct files are zipped.

What can I modify?

The .xml files you unpacked and decoded contain configuration files which allow you to tweak certain variables in Prey. These essentially define the default properties of game objects.
You can’t alter any game scripts (the instructions and rules that the game follows), but thankfully Arkane designed Prey in a fairly modular, data-driven manner that leaves a lot on the table.
So while you can’t alter something like the AI routines or how a kinetic blast power works, you can change NPC awareness and player visibility, or tune the precise radius and impulse of the blast.
The downsides are: you’re out of luck if the developers didn’t softcode what you want and leave a tweakable parameter in the .xml file, and you have to treat the game code as a black box (can only observe input and output in the game’s state). Moreover, many changes require you to start a new game, which makes testing very cumbersome. Learn a speedrunning strat or two: https://vimeo.com/307421344
All of my modding efforts have been towards gameplay changes. I have no experience with model replacements, audio, or level changes — apologies if these are what you’re after.

Guide to the file structure

Thankfully, Arkane used rational names for their variables and sometimes left some helpful notes in key places, so it’s not too hard to figure out how things work. Here are some basic tips.
Most gameplay-relevant files are in \Ark\, but some are also in \Lib\. Some highlights follow (but are no means comprehensive, as I’ve not explored everything):

  • Ark\Player\PlayerConfig.xml contains all manner of player statistics, from health and speed to ability-specific stats like Mimic Matter visibility. Many stats modified by chipsets, traumas, and Neuromod skills can be found here. Note that these are just the default statistics the player starts with when they begin the game, and a new game file must be created to test any changes
  • Ark\Player\PsiPowers\ contains files for every psi power, listing psi costs, ranges, and other relevant statistics
  • Ark\Player\Abilities.xml lists all of the Neuromod skills, with variables affecting Neuromod costs, NightmareHeat (alien skills attract the Nightmare and make turrets target you), a binary psychoscope scanner requirement, any alterations to the default stats from playerconfig.xml, and activation for any signal modifiers in Ark\SignalSystem\Modifiers.xml (more on this later)
  • Ark\Player\StatPackages.xml lists any temporary changes to stats in PlayerConfig.xml due to active skills or chipsets (Abilities.xml modifiers are permanent). Note that stat modifiers are ADDITIVE, so for example, recyclingYieldScale is 1 by default in PlayerConfig.xml, Materials Expert in Abilities.xml adds a permanent 0.2, and Chipset_RecyclerLootBonus in Statpackages.xml adds another 0.1 for a total of 1.3 (30% bonus)
  • Ark\Player\Traumas.xml lists any temporary changes to player stats from status effects with the same rules as StatPackages.xml, as well as activation for any signal modifiers, catchers for signals that remove them or accumulate to activate them, maximum accumulation, drain rates if applicable, and whether status effects can stack
  • Ark\Player\PlayerSignalReceiverConfig.xml lists all of the signals that the player can receive from Ark\SignalSystem\Signals.xml
  • Ark\Player\ResearchTopics.xml lists all of the research requirements for alien Neuromod skills (set ScansRequired to 0 and change RequireScanner in Abilities.xml to false to remove)
    • WARNING: Don’t remove Kinetic Blast I AND Mimic Matter I research requirements, or you will be locked in Psychotronics (you need to gain access to one scanned power to proceed in the game)
  • Ark\SignalSystem\Signals.xml lists all of the signal types (or “stims”, as some Immersive Sim junkies might call them). These include damage signals, trauma signals, and other stimuli that game elements use to talk to one another and communicate what kind of effect they’re propagating (and how much). A mod by bombum adds comments for the name of each signal in the associated game files
  • Ark\SignalSystem\Modifiers.xml lists all of the modifiers to signals. These can range from difficulty damage modifiers to rate modifiers from Neuromod skills and chipsets, to enemy resistances to certain damage types. Note that, unlike changes to player stats, these modifiers are MULTIPLICATIVE, meaning that all possible rate modifiers acting from the source or recipient are multiplied together
  • Ark\SignalSystem\SignalGroups.xml lists groupings of signals, like signals that break GLOO or damage electrical junction boxes
  • Ark\SignalSystem\Packages.xml lists signals associated with game actions, like weapon firing, enemy attacks, psi powers, or even a few “active” chipset effects. Numbers for each of these signals (e.g. damage, healing, nullwave stun) are also set here. Note that health and damage values are multiplied by 10x from what is seen in-game
  • Ark\Items\LootTables.xml lists loot tables for non-scripted containers and corpses. Each container can have a number of slots, each with a percentage chance to contain any item at all and a list of items that can appear in that slot with an associated weight (a weight of 5 with two other items with a weight of 1 means that if the slot contains anything, it will be that item 5 times in 7)
  • Lib\EntityArchetypes\ArkPickups.xml lists all of the pickups (inventory items) in the game. Can edit inventory size, stack limits, crafting output, weapon degradation stats, and more
  • Lib\EntityArchetypes\ArkInteractiveProps.xml lists all of the physics objects in the game. Can edit (i.e. remove) signals to gain health and psi from fountains here
  • Lib\EntityArchetypes\ArkNpcs.xml lists all of the Typhon enemies and their stats, such as health. Note that health values are multiplied by 10x from what is seen in-game
  • Lib\EntityArchetypes\ArkHumans.xml lists all of the human NPCs and their stats
  • Lib\EntityArchetypes\ArkRobots.xml lists all of the robotic enemies and their stats
  • Lib\EntityArchetypes\ArkGameplayObjects.xml lists special objects like grav shafts and keypads. Hack skill requirement IDs can be set here

You can also edit in-game descriptions, but the process is a little different. Navigate to “…\Prey\Localization\”. English_xml.pak and English_xml_patch.pak contain the relevant strings (for English users).
English_xml_patch.pak needs to be converted with PreyConvert.exe, but English_xml.pak does not.
While the “…\Prey\GameSDK\Precache\” folder allows you to load any number of .pak files with individual (overwriting) changes, you must replace the entire English_xml_patch.pak file to make changes to it.
This means that you should only edit or add to the files in English_xml_patch.pak, and then replace it with your own English_xml_patch.pak in the “…\Prey\Localization\” folder when you’re done
Inside the game files, you will find references to localized strings, such as @rpg_CombatFocusName. Search through the localization paks for these strings to change game descriptions.

Limitations

While you can add, subtract, or edit many of the existing variables listed in the game files, it is impossible to add new elements or variables, like new player stats, skills, chipsets, or signals.
Basically, if something is associated with a 20-digit ID, it corresponds to something in the game code that we can’t see or edit, let alone extend with new game objects.
The same goes for variables, such as e.g. player stats listed in PlayerConfig.xml, or e.g. weapon degradation variables listed in ArkPickups.xml.
You CAN repurpose existing elements. For example, you can take an existing Neuromod or chipset ID and associate it with totally different effects. Search for unused elements to swap in.
Some objects will have an implicit hierarchy of IDs. For example, chipsets can activate signal modifiers, signal packages, or player statpackages.
To swap these around, you will need to modify an existing block in modifiers/packages/statpackages, and add its ID to the relevant variable under the chipset properties in ArkPickups.xml.
Also, it is a good idea to search through the game files for all other instances of a variable or game object before you edit it, lest you bring about unintended consequences.

What could go wrong?

None of your changes will load if your .pak file doesn’t contain the correct file structure. A common mistake of this kind is zipping up the containing folder rather than the correct game files within them.
e.g. zipping \patch\Ark\ -> patch.pak rather than zipping \Ark\ -> patch.pak
All files in the Precache are loaded in alphabetical order. Files contained within a .pak further down the alphabet supersede any prior copies of the the file (including in GameData.pak).
A new game is required to test any changes to PlayerConfig.xml. This can be somewhat circumvented by adding stat modifiers to existing entries in abilities.xml, statpackages.xml, or traumas.xml.
Changes to LootTables.xml will only go into effect for levels that have never been visited in a save file. The same is true of some changes to ArkPickups.xml and so on.
Proper formatting is extremely important to maintain when editing the game files. Use Notepad++ for proper whitespacing, and observe all syntax that you see, otherwise errors WILL occur.
Errors in abilitylayout.xml will scramble the Neuromod skill tree, errors in abilities.xml will crash the game on load, errors in modifiers.xml will make entities take no damage, and so on.
NEVER remove or change the IDs declared for game entities (you may change referenced IDs, but never change ID="____"). The game will throw errors, spawn every NPC in a T-pose, prevent actions, crash, etc.
I’ve already said it, but you cannot add new IDs to create new game entities. Just don’t try; it’s a waste of your time.

Bonus: Tip for getting NotePad++ as your default XML editor in Windows 10 (there are issues for some reason)

  1. Run Notepad++ as an Administrator
  2. Go to Settings -> Preferences -> File Association
  3. Select “web script” in the first box, then “.xml” in the second, then press the right arrow to move it into the third
  4. Close Notepad++
  5. Right click an .xml file in Windows Explorer and go to Open With -> Choose Another App. Locate Notepad++ and check “Always use this app to open .xml files”

Bonus: Tip for searching for a string in all files in the working directory

Open the command line in your working directory (click on the address bar in Windows Explorer and type “cmd”) and run the following command:
findstr /snip "[string]" .\*.xml
/s is recursive search, /n prints line numbers, /i is case-insensitive, /p skips binary files, and .\*.xml searches all .xml files in the current directory.
This command is useful if you want to find all places where a string (e.g. stat or signal) shows up. It will print the directory, file, and line number along with the full line containing the string.
If you need to search a string which contains a ” character, type \” inside the search quotation marks. e.g. to search for every modifier on the fire signal, run:
findstr /snip "signalID=\"7745561656291547931\"" .\*.xml