autoangel
AutoAngel is a general-purpose library designed to make it easy to work with angelica engine game files.
It supports the following file formats:
elements.data- load withread_elements, view, modify and save through theElementsDataobject.*.pck/*.pkx- load withread_pck, explore through thePckPackageobject.*.ecm- load withread_ecm, inspect composite model structure through theEcmModelobject.*.smd- load withread_smd, inspect skin model data through theSmdModelobject.*.bon- load withread_skeleton, inspect skeleton bones and hooks through theSkeletonobject.*.ski- load withread_skin, inspect meshes, textures and materials through theSkinobject.*.stck- load withread_track_set, inspect animation tracks through theTrackSetobject.*.gfx- load withread_gfx, inspect visual effect elements through theGfxEffectobject.
Quick Start
Working with elements.data
Let's start with importing autoangel:
import autoangel
Now you can load any elements.data you want using read_elements:
data = autoangel.read_elements('/path/to/elements.data')
By default read_elements will try to use one of the bundled config.
This should work for you, if you don't use exotic game version (otherwise, you should load config with read_elements_config and pass it manually).
You can inspect data:
print(f'Version: {data.version}')
print(f'Number of lists: {len(data)}')
You can explore all the entries among all the lists. For example:
weapons_list = data[3]
# print list name
print(f'List: {weapons_list.config.caption}')
# print first 10 entries in list
for i in range(10):
weapon = weapons_list[i]
print(f'ID: {weapon.ID}, name: {weapon.Name}')
You can also modify anything you want like changing durability of all the weapons:
for weapon in weapons_list:
weapon.durability_min = weapon.durability_max = 99999
All the modifications won't affect original elements.data until you save it:
data.save('elements2.data')
Working with pck/pkx
You can load a pck package using read_pck:
import autoangel
# Load a single pck file
package = autoangel.read_pck('/path/to/package.pck')
# Load a pck file with its corresponding pkx file
package = autoangel.read_pck('/path/to/package.pck', '/path/to/package.pkx')
Once you have a PckPackage object, you can explore its contents:
# Get a list of all files in the package
file_list = package.file_list()
print(f'Number of files: {len(file_list)}')
# Find files with a specific prefix
textures = package.find_prefix('textures/')
print(f'Number of texture files: {len(textures)}')
# Get the content of a specific file
file_content = package.get_file('path/to/file.txt')
if file_content is not None:
print(f'File content: {file_content.decode("utf-8")}')
else:
print('File not found')
A single bone in a skeleton.
Bone scale entry from an ECM model.
Old format: scale is (scale_x, scale_y, scale_z) and scale_type
is populated. New (BoneScaleEx) format: scale is (len, thick, whole)
and scale_type is None.
Per-bone animation track data.
Child model attachment from an ECM model.
A visual/sound event triggered during animation or as persistent CoGfx.
event_type determines which optional fields are populated:
100 = GFX (gfx_scale / gfx_speed), 101 = Sound
(volume / min_dist / max_dist / force_2d / is_loop).
Parsed ECM (composite model) file.
Number of events in combined action at index i.
Typed body for a GFX element. Accessed via GfxElement.body.
Instances are always one of the nested variant classes
(ElementBody.Decal, ElementBody.Trail, ...,
ElementBody.Unknown) — ElementBody itself is the common
base. Narrow with isinstance().
Body of a GfxContainer element (type 200) — nested .gfx reference.
Inherited Members
Body of a Decal element (types 100 / 101 / 102).
Inherited Members
Body of a GridDecal3D element (type 210) — freeform w × h vertex-grid decal.
Inherited Members
Body of a Light element (type 130) — dynamic light source (D3DLIGHT9-style parameters).
Inherited Members
Body of a Lightning element (type 150) — segmented lightning bolt between two points.
Inherited Members
Body of a LightningEx element (type 152) — extends Lightning with tail / render-side flags.
Inherited Members
Body of a LtnBolt element (type 151) — branching lightning bolt (no noise prefix).
Inherited Members
Body of a Model element (type 160) — embedded 3D model reference.
Inherited Members
Body of a Particle element (types 120 / 121 / 122 / 123 / 124 / 125).
Inherited Members
Body of a Ring element (type 140) — expanding ring effect.
Inherited Members
Body of a Sound element (type 170) — 3D positional sound emitter.
Inherited Members
Body of a Trail element (type 110) — ribbon trail between two moving endpoints.
Inherited Members
Body of an element whose type has no typed parser — raw text lines preserved.
Inherited Members
Configuration for elements.data.
Attributes:
- lists: elements.data lists configs
- name: name of config specified when parsing it (i.e. file name)
Object describing parsed elements.data. It also works as immutable array of data lists (ElementsDataList).
Implements basic list interface such as len(..) and __getitem__.
Attributes:
- version: elements.data version
See also: ElementsDataList
Find entry by ID and space ID.
Parameters
- id: Entry ID
- space_id: Optional space ID (
Noneby default). IfNone, find among all the lists, otherwise - only in lists with specified space_id. - allow_unknown: If set, include lists with
"unknown"space_id in search, otherwise - ignore them (Trueby default).
Returns
Found entry or
None
Single data entry.
Implements basic dict[str, object]-like and object-like interface such as len(..), __getattr__, __setattr__, __getitem__, __setitem__ and __contains__.
Number of fields, its names and types depend on elements.data version and list config.
Use entry.keys() to get field names.
One can access fields with either entry['name'] (by key) or entry.name (as an attribute) syntax.
Each field can be read and modified and has one of the following types:
intfloatstrbytes
See also: ElementsListConfig
Contains data of specific list in elements.data such as list info (like ElementsListConfig) and
all data entries (ElementsDataEntry). Implements basic list interface such as len(..), __getitem__ and __setitem__.
Attributes:
- config: list config
See also: ElementsDataEntry.
Configuration for a list in elements.data.
Attributes:
- caption: list caption
- data_type: list data type
- fields: array of fields
- offset: list offset
- space_id: list space id (may be
"unknown")
Array of list configurations.
Field metadata.
Attributes:
- name: field name
- type: field type
Array of field metadata.
Particle emitter block — shared emitter fields plus a shape-specific payload.
Emitter-shape-specific payload. Instances are one of the nested
classes EmitterShape.Point / EmitterShape.Box /
EmitterShape.Ellipsoid / EmitterShape.Cylinder /
EmitterShape.MultiPlane / EmitterShape.Curve.
Inherited Members
Inherited Members
Inherited Members
Inherited Members
Inherited Members
Inherited Members
Metadata for a single file entry in a pck package.
Animatable float value track (v>=102 lightning amplitude).
Parsed GFX (visual effect) file.
A single visual effect element within a GFX file.
Particle affector controllers — always empty for non-particle
element types (the engine only emits AffectorCount: inside
A3DParticleSystemEx::Load).
Typed element-specific body; unparsed types keep their raw lines in
ElementBody::Unknown.
Animation KeyPointSet appended to most elements. A small
minority of real-world elements (~0.6%) omit it — in that case
this field is None.
Grid-animation keyframe — modified vertex array at time time_ms.
Single vertex of a GridDecal3D grid — position plus packed ARGB color.
A hook (attachment point) in a skeleton.
Distinct from a bone: an attachment point parented to a bone with a
fixed local transform. ECM events typically target hooks (HH_*)
rather than bones directly.
One animation keyframe — transform snapshot plus per-frame controller overlays.
Animation keyframe track attached to most GFX elements.
Single keypoint controller — same wire format as a particle affector.
Typed controller body. Narrow with isinstance().
The full set of variants mirrors the CreateKPCtrl dispatch in
A3DGFXKeyPoint.cpp. Unknown CtrlTypes fall back to
KpCtrlBody.Unknown.
CtrlType 104 — centripetal force toward a point.
Inherited Members
CtrlType 107 — color noise overlay (NoiseCtrl prefix + BaseColor).
Inherited Members
CtrlType 108 — color transition track.
Inherited Members
CtrlType 105 — signed ARGB deltas per second.
Inherited Members
CtrlType 110 — movement along a cubic-bezier curve.
Inherited Members
CtrlType 100 — linear translation.
Inherited Members
CtrlType 112 — base Perlin-like noise controller.
Inherited Members
CtrlType 103 — revolution (orbit around an axis).
Inherited Members
CtrlType 101 — 2D rotation around origin.
Inherited Members
CtrlType 102 — rotation around arbitrary axis.
Inherited Members
CtrlType 109 — scale noise overlay.
Inherited Members
CtrlType 106 — scale delta with min/max clamp.
Inherited Members
CtrlType 111 — scale transition track.
Inherited Members
Unknown CtrlType — raw lines preserved for forward compatibility.
Inherited Members
Scalar payload shared by Lightning and LightningEx bodies.
A material definition from a skin file.
Perlin noise parameters — prefix of every Lightning / LightningEx body.
Builder for creating or modifying pck packages.
Add or overwrite a file. Path is normalized internally.
Parameters
- path: File path inside the package.
- data: File content as bytes.
List the final set of files (source - removed + added), sorted.
Returns
Sorted list of normalized file paths.
Remove a file from the package.
Parameters
- path: File path inside the package.
Returns
True if the file existed, False otherwise.
Save the package to a file.
Parameters
- path: Output file path.
- version: Package format version (default: source version or 0x20002).
- config: Package configuration. Defaults to standard Angelica Engine config.
Configuration for pck package encryption keys and guard values.
Object describing parsed pck package.
Returns list of file paths in package.
Returns
All paths in package.
Finds all files in archive with path prefixed by prefix.
Parameters
- prefix: Path prefix.
Returns
All paths in package prefixed by
prefixor empty list if no files were found.
Get file content by its path.
Parameters
- path: Path to file inside package.
Returns
Noneif file not found. Otherwise, returns file content.
Save the package to a file.
This method saves the package to a file at the specified path. The saved package will be identical to the original when loaded back.
Parameters
- path: Path where to save the package.
- config: Custom package configuration. Defaults to None.
Raises
- Exception: If any I/O error occurs during saving.
Scan file entries with metadata (including compressed data CRC32 hashes).
Hashes are computed from compressed (on-disk) data without decompression.
Results are delivered in chunks via on_chunk callback.
Parameters
- paths: List of file paths to scan.
- on_chunk: Callback receiving a list of
FileEntryfor each chunk. Raise an exception to cancel scanning. - interval_ms: Minimum interval in milliseconds between chunk callbacks (
100by default). The final chunk is always delivered regardless of throttling.
A rigid (static) mesh from a skin file.
Parsed BON (skeleton) file.
Parsed SKI (skin) file containing meshes, textures, and materials.
A weighted (skeletal) mesh from a skin file.
Flat array of bone indices [b0, b1, b2, b3, ...] per vertex (4 indices each).
Parsed SMD (skin model data) file.
Audio-event sub-block present on Sound bodies at v>=96.
GfxSoundParamInfo — sound parameter block with its own internal sound_ver gating.
A single animation track (position or rotation keyframes).
Parsed STCK (skeleton track set) file.
Trail Spreading perturb sub-block (v>=122, perturb_mode == 1).
Parse an ECM (composite model) file from bytes.
Parameters
- data: Raw ECM file content.
Returns
Parsed ECM model.
Raises
- ValueError: If the data is not a valid ECM file.
Parses elements.data from file elements_path and returns ElementsData.
Doesn't load file content into memory, uses memory-mapped I/O - so file cannot be modified while ElementsData is alive.
Parameters
- elements_path: Path to elements.data.
- config: Optional config describing elements.data structure (
Noneby default). If no config specified, one of predefined will be used.
Returns
Object describing parsed elements.data.
Raises
- Exception: If any I/O error occurs, elements.data has invalid internal structure or config has incompatible version.
Parses elements.data from byte array content and returns ElementsData.
Parameters
- content: Content of elements.data.
- config: Optional config describing elements.data structure (
Noneby default). If no config specified, one of predefined will be used.
Returns
Object describing parsed elements.data.
Raises
- Exception: If elements.data has invalid internal structure or config has incompatible version.
Parses elements.data config from file at path path and returns ElementsConfig describing parsed file.
Parameters
- path: Path to elements config.
Returns
Object describing parsed config.
Raises
- Exception: If any I/O error occurs or config has invalid internal structure.
Parses elements.data config from string content and returns ElementsConfig describing parsed file.
Parameters
- content: String containing elements config.
Returns
Object describing parsed config.
Raises
- Exception: If config has invalid internal structure.
Parse a GFX (visual effect) file from bytes.
Parameters
- data: Raw GFX file content.
Returns
Parsed GFX effect.
Raises
- ValueError: If the data is not a valid GFX file.
Parses pck package from file at path pck_path (and optionally pkx file(s)) and returns PckPackage describing parsed file(s).
Doesn't load file content into memory, uses memory-mapped I/O - so file(s) cannot be modified while PckPackage is alive.
Parameters
- pck_path: Path to pck package.
- pkx_paths: Optional pkx path(s) — a single string or list of strings (
Noneby default). - config: Custom package configuration. Defaults to None.
- on_progress: Optional callback
(index, total)called for each file entry during parsing. Raise an exception to cancel parsing. - progress_interval_ms: Minimum interval in milliseconds between progress callbacks (
0by default — no throttling). The last entry is always reported regardless of throttling.
Returns
Object describing parsed package.
Raises
- Exception: If any I/O error occurs or package has invalid internal structure.
Parses package from byte array content and returns PckPackage.
Parameters
- content: Content of package.
- config: Custom package configuration. Defaults to None.
- on_progress: Optional callback
(index, total)called for each file entry during parsing. Raise an exception to cancel parsing. - progress_interval_ms: Minimum interval in milliseconds between progress callbacks (
0by default — no throttling). The last entry is always reported regardless of throttling.
Returns
Object describing parsed package.
Raises
- Exception: If package has invalid internal structure.
Parse a BON (skeleton) file from bytes.
Parameters
- data: Raw BON file content.
Returns
Parsed skeleton.
Raises
- ValueError: If the data is not a valid BON file.
Parse a SKI (skin) file from bytes.
Parameters
- data: Raw SKI file content.
Returns
Parsed skin.
Raises
- ValueError: If the data is not a valid SKI file.
Parse an SMD (skin model data) file from bytes.
Parameters
- data: Raw SMD file content.
Returns
Parsed SMD model.
Raises
- ValueError: If the data is not a valid SMD file.
Parse a STCK (skeleton track set) file from bytes.
Parameters
- data: Raw STCK file content.
Returns
Parsed track set.
Raises
- ValueError: If the data is not a valid STCK file.