GithubHelp home page GithubHelp logo

derekries / arkpy Goto Github PK

View Code? Open in Web Editor NEW
20.0 7.0 2.0 129 KB

Work in Progress. Reverse Engineering the file formats for Ark: Survival Evolved. Read/Write with python.

License: MIT License

Python 100.00%
ark python

arkpy's Introduction

ARKpy

v0.1.3

ARKpy is a library for reading and writing the file formats of ARK: Survival Evolved with the python programming language. ARKpy does not simply look for the offsets of particular strings to find the data (like other existing libraries/scripts), but reads the entire data structure of the file into memory.

For those interested in the reverse engineering of the file types the specifications can be found among the library docs.

Docs | File Format Specs | Examples

Features

  • Read and Write the following file types
    • .arkcharactersetting (Character creator preset files)
    • .arkprofile (LocalPlayer.arkprofile or steamid.arkprofile, no LocalPlayerData)
    • .arktribe
  • Create new characters or tribes dynamically
  • Friendly API wrapper around the data
  • Maps to enumerate through and identify the proper index for:
    • BoneModifierSlots (Head Size, Chest, etc...)
    • Body Colors (Skin, Hair, Eyes)
    • Stats (Health, Oxygen, Stamina, etc...)
    • Item Blueprint Paths/IDs

Installation

pip install arkgamepy

Usage

Reading an .arkprofile file

from arkpy.ark import ArkProfile
from arkpy.ark import BoneMap, StatMap, BodyColorMap

file_path = 'data/SavedArksLocal/LocalPlayer.arkprofile'
profile = ArkProfile(file_path)

print profile.character.name
print profile.character.level_ups
print profile.character.experience
print profile.character.engram_points

# Get all the Stat points allocated and print them with a string
# identifying which stat they are
stats = profile.character.stat_points
for stat in StatMap:
  print '%s: %s' % (stat.name, stats[stat])

# Get all the BoneModifier values and print them with a string
# identifying which bone it is
bones = profile.character.body_modifiers
for bone in BoneMap:
  print '%s: %s' % (bone.name, bones[bone])

arkpy's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

arkpy's Issues

Create Examples/Tutorials for Docs

Should shift examples into an examples directory like the tests directory, utilizing a context.py file hack to give access to the sibling package arkpy.

read failure

Traceback (most recent call last):
File "D:\arkprofile.py", line 5, in
profile = ArkProfile(file_path)
File "build\bdist.win32\egg\arkpy\ark.py", line 329, in init
File "build\bdist.win32\egg\arkpy\arktypes.py", line 28, in load_struct
File "build\bdist.win32\egg\arkpy\arktypes.py", line 659, in init
File "build\bdist.win32\egg\arkpy\arktypes.py", line 120, in load_and_set_next_property
File "build\bdist.win32\egg\arkpy\arktypes.py", line 39, in load_property
File "build\bdist.win32\egg\arkpy\arktypes.py", line 28, in load_struct
File "build\bdist.win32\egg\arkpy\arktypes.py", line 740, in init
File "build\bdist.win32\egg\arkpy\arktypes.py", line 120, in load_and_set_next_property
File "build\bdist.win32\egg\arkpy\arktypes.py", line 41, in load_property
File "build\bdist.win32\egg\arkpy\arktypes.py", line 219, in init
File "build\bdist.win32\egg\arkpy\binary.py", line 63, in readNullTerminatedString
File "build\bdist.win32\egg\arkpy\binary.py", line 194, in unpack
File "build\bdist.win32\egg\arkpy\binary.py", line 22, in readBytes OverflowError: Python int too large to convert to C long

Entity ID/Path Dictionary for ObjectPropertys

Need to set up the map/dict for human readable strings <--> Entity ID/Paths.

Example:

'campfire' <-> 'BlueprintGeneratedClass /Game/PrimalEarth/CoreBlueprints/Items/Structures/Misc/PrimalItemStructure_Campfire.PrimalItemStructure_Campfire_C'

Game won't load generated files

Reading and writing of files is working, BUT the SinglePlayer game isn't loading these files correctly. I'm not sure exactly what the problem is because even after deleting both LocalPlayer.arkprofile and LocalPlayer.profilebak, the game still ends up loading an older character. It's like if the game can't find a file or the file isn't valid (and the generated files aren't valid somehow), then the game looks in some hidden cache, the world file, or some other location to pull out a character.

Issue installing / running

not sure where else to post this so adding this any assistance is greatly appreciated thank you!

I’m wanting to open arktribe files from ASA which is probably the reason it’s not working but this one of the errors I keep getting before it even loads the file.

Should I be running this in python 2?
Is that possible ? Sorry I’m new at this !

(venv) G:\Downloads\arkpy-master\arkpy-master>python example2.py
Traceback (most recent call last):
File "G:\Downloads\arkpy-master\arkpy-master\example2.py", line 1, in
from arkpy import ark, utils
File "G:\Downloads\arkpy-master\arkpy-master\arkpy\ark.py", line 8, in
import arktypes
ModuleNotFoundError: No module named 'arktypes'

(venv) G:\Downloads\arkpy-master\arkpy-master>pip install arktypes
ERROR: Could not find a version that satisfies the requirement arktypes (from versions: none)
ERROR: No matching distribution found for arktypes

ID Generation

Need to investigate the ID Generation in game used for TribeID and PlayerDataID. At the moment I think just using a 9-digit integer will work.

Refactor ArkCharacterSetting

ArkCharacterSetting was initially written before the file types were fully understood, and before the property types were written.

Need to refactor ArkCharacterSetting to use the PropertyTypes like ArkProfile and ArkTribe

StrProperty crashing on unicode

The Bulk Reader test exposed a bug in trying to read files where the StrProperty value was unicode. StrProperty needs to be able to read and write unicode values.

Overflow Error with some .arktribe files (xpost from arkpy-examples)

Original issue posted in DerekRies/arkpy-examples#1

I'm encountering the following error when attempting to read in .arktribe files.

OverflowError: Python int too large to convert to C long

Some have issues however, the majority (83%) of the .arktribe files I've run worked fine.

I can reproduce this issue with a script as simple as this. I have also attached some examples of .arktribe files that encounter this issue.

from arkpy import ark, utils

def main():
    file_path = 'Fails/1115390102.arktribe'
    tribe = ark.ArkTribe(file_path)

if __name__ == '__main__':
    main()

Fails.zip

Full error traceback below:

Traceback (most recent call last): File "C:\Users\user\Desktop\codingprojects\arktribelogproject\arkpy-master\arkpy-master\tribetest.py", line 9, in <module> main() File "C:\Users\user\Desktop\codingprojects\arktribelogproject\arkpy-master\arkpy-master\tribetest.py", line 6, in main tribe = ark.ArkTribe(file_path) File "C:\Users\user\Desktop\codingprojects\arktribelogproject\arkpy-master\arkpy-master\arkpy\ark.py", line 416, in __init__ self._load_from_stream(file_path) File "C:\Users\user\Desktop\codingprojects\arktribelogproject\arkpy-master\arkpy-master\arkpy\ark.py", line 433, in _load_from_stream struct = arktypes.load_struct(stream) File "C:\Users\user\Desktop\codingprojects\arktribelogproject\arkpy-master\arkpy-master\arkpy\arktypes.py", line 28, in load_struct struct = STRUCTS.get(name, BaseStruct)(stream=stream) File "C:\Users\user\Desktop\codingprojects\arktribelogproject\arkpy-master\arkpy-master\arkpy\arktypes.py", line 895, in __init__ self.load_and_set_next_property(stream) File "C:\Users\user\Desktop\codingprojects\arktribelogproject\arkpy-master\arkpy-master\arkpy\arktypes.py", line 120, in load_and_set_next_property name, prop_type, value = load_property(stream) File "C:\Users\user\Desktop\codingprojects\arktribelogproject\arkpy-master\arkpy-master\arkpy\arktypes.py", line 41, in load_property return (name, prop_type, PROPERTIES[prop_type](stream=stream)) File "C:\Users\user\Desktop\codingprojects\arktribelogproject\arkpy-master\arkpy-master\arkpy\arktypes.py", line 219, in __init__ self.value = stream.readNullTerminatedString() File "C:\Users\user\Desktop\codingprojects\arktribelogproject\arkpy-master\arkpy-master\arkpy\binary.py", line 63, in readNullTerminatedString s = self.unpack(str(length - 1) + 's', length - 1) File "C:\Users\user\Desktop\codingprojects\arktribelogproject\arkpy-master\arkpy-master\arkpy\binary.py", line 194, in unpack return unpack(fmt, self.readBytes(length))[0] File "C:\Users\user\Desktop\codingprojects\arktribelogproject\arkpy-master\arkpy-master\arkpy\binary.py", line 22, in readBytes return self.base_stream.read(length) OverflowError: Python int too large to convert to C long

Default value for BodyColors

Need to find out the default rgba float values for each BodyColor (Skin, Hair, Eyes), and set those as the default values in the configstruct and exclude them when default.

Profile read error

Arkpy was working fine, but now arkpy give me back some profiles empty.
{'Steam_Name': u'', 'Steam_ID': '00000000000000000', 'Character_Name': u''}

Could it be due to the last update?
Can you help me?

Thank you very much.

File Format Specifications

Going to include the specifications for the .arkprofile, .arktribe, and .arkcharactersetting file formats among the docs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.