ArkFile

This documentation is intended to anyone who wants to learn or wants to read the Ark Save file Directly.

This file is a Binary File generated by UE4's Save World Function, the first part is a "Ark File Header" which contains important information about the file, after this we have to read something called the Name Table which contains a basic table which will be the backbone for our reading or the file.

To understand all of this you need a basic knowledge of binary files, C++, and Number representation on a file (Float, Int32, UInt32, etc)

We are going to concentrate in describing save file Version 9, there's ark savefiles from version 5 but that is not well documented.

The basic flow to read the data of the Ark save file is as follows:


 * Read the Ark File Header Object
 * Read the Binary Data Names Object
 * Read the Name Table Object
 * Read the Embeded Binary Data Object
 * Read the Unknown Data Object
 * Read the Game Objects Array
 * For each of the Game Objects read the Properties Object

Ark File Header Object
This is the start of the .ark savefile, which is a header containing some important information.



Binary Data Names Object
To read this table you need to read the String Data into the Object as many times as it was specified on the Array Length

Name Table Object
This table is crucial to keep reading the rest of the save file as it contains a lot of references needed to be able to understand the save file.

To read this Table you need to move your read cursor on the file to the Name Table Offset you got from the Ark File Header, do not forget to save the current cursor position as you need to go back to this position once you are done reading this data.

Embeded Binary Data Object
The use of this data is unknown, we will read an array of arrays, containing Int32 numbers. First we will read the Array Length and do a loop that many times, on each of these loops we will:

Read the next 4 bytes as Int32 and loop that many times reading each time another Int32 value into the SubArray.

Unknown Data Object
This is some unknown data object, we need to read it correctly in case Ark uses it at some point

Game Objects Array
This is the main object which contains all the game objects

Properties Object
This is one of the most "fun" parts to read data from. To create this object we will fill it with an array of the objects we read from the file, first we need to sum the Ark File Header Object's Properties Block Offset with the Game Object's Properties Offset and begin reading from there, until we reach a Class Name named "None"

Property Object
After reading the property's Class Name you need to read the data according to it's classification:

IntProperty Object
This is read the same as Int32Property Object

Ark Class Object
When reading an Ark Class Object you need to read always 8 bytes, and when an index is defined (more than 0) you need to append that index at the name of the class, so if you have your Name Table Object and in position #72 you have PrimalItem_WeaponEmptyCryopod_C (Note: There's no position 0 on the Name Table Object) it means that if your index = 1 you need to append _0 at the end making it PrimalItem_WeaponEmptyCryopod_C_0 and if your index=135 then you need to append _134.

Data Types
Below are the data types and how to read them accordingly.

Bool
Read 32Bit (4 Byte) In which the least significant bit indicates true

Double
Read 64Bit (8 Byte) Double Number

Float
Read 32Bit (4 Byte) Float Number

Int8
Read 8Bit (1 Byte) Signed Integer

UInt8
Read 8Bit (1 Byte) Unsigned Integer

Int16
Read 16Bit (2 Byte) Signed Integer

UInt16
Read 16Bit (2 Byte) Unsigned Integer

Int32
Read 32Bit (4 Byte) Signed Integer

UInt32
Read 32Bit (4 Byte) Unsigned Integer

Int64
Read 64Bit (8 Byte) Signed Integer

UInt64
Read 64Bit (8 Byte) Unsigned Integer

PropertyBoolean
Read 8Bit (1 Byte) In which the least significant bit indicates true.

ArkFile