Skip to main content

Read and write Abyss Engine Image (AEI) files from python, for Galaxy on Fire 2

Project description

AEPi

Abyss Engine Image (AEI) conversion for python
Join The Kaamo Club discord server for Galaxy on Fire fans and modding

GitHub Actions workflow status GitHub open bug reports Test coverage

Pypi package version Minimum supported Python version License

SonarCloud bugs analysis SonarCloud code smells analysis SonarCloud quality gate status

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing

About The Project

Abyss Engine is an internal-only game engine developed by Deep Silver FishLabs, for the development of the Galaxy on Fire game series.

The engine uses a proprietary file format for grids of images, called Abyss Engine Image (AEI). The image compression is platform dependant, for example Android texture files are compressed with Ericsson Texture Compression (ETC).

The AEI format was analysed by the Russian modding group 'CatLabs', who later created a GUI and command-line tool for conversion between PNG and AEI, named AEIEditor.

This tool was closed-source, and relied on a windows DLL for compression. AEPi is a minimal recreation of the image conversion logic provided by AEIEditor, leaning on open source image codecs:

See the project roadmap for currently supported and upcoming features.

Getting Started

Prerequisites

  • python 3.11+ is required, as this project uses structural pattern matching.

Installation

install AEPi from PyPi:

python -m pip install aepi

Usage

This library reflects the real representation of an AEI file on disk; though textures are added to and read from an AEI object as individual images, the underlying representation is a single image. This improves encoding/decoding performance, and enables overlapping textures.

For maximum flexibility, AEPi returns AEIs as BytesIO objects.

The recommended best practise is to wrap your AEPi call in a with statement, to ensure that all of the AEI's images are cleaned out of memory when it goes out of scope.

Open an .aei file on disk

from AEPi import AEI

with AEI.read("path/to/file.aei") as aei:
  print(
    f"The AEI is compressed in {aei.format.name} format, "
    f"with {len(aei.textures)} textures. "
    f"Width: {aei.shape[0]} Height: {aei.shape[0]}"
)
Reading textures as image segments

AEI.textures provides read access to all of the AEI's bounding boxes. The AEI.getTexture method returns the relevant segment of the AEI, as a Pillow Image.

Using this, you could for example, batch export all of the individual images within an AEI:

for i, tex in enumerate(aei.textures):
  with aei.getTexture(tex) as im:
    im.save(f"batch/export/{i}.png")

Create a new AEI

from AEPi import AEI, CompressionFormat,
from PIL import Image

image_path = "ship-texture.png"
image2_path = "another-texture.png"

# create a new .aei file
with Image.open(image_path) as image, Image.open(image2_path) as image2:
  # Images are always assumed to be RGB(A). AEPi handles channel swapping for ETC1 to BGR(A)
  with AEI(image) as new_aei:
    # 'textures' - image bounding boxes
    new_aei.addTexture(image2, 0, 0)
    # The below operation is legal, but would leave unused image content in the AEI!
    new_aei.removeTexture(0, 0, image2.width, image2.height, clearImage=False)

Write a new AEI file to disk

    with open("path/to/newFile.aei", "wb") as new_file:
      # compression format can be specified at write time, or in the constructor
      aei.write(new_file, format=CompressionFormat.DXT5)

Roadmap

The AEPi 1.0 release will mark feature parity with AEIEditor, which theoretically reflects all of the capabilities required to manipulate Galaxy on Fire 2 AEIs on all platforms.

For details of the work that needs to be done, see the issues listed under the 1.0 milestone: https://github.com/Trimatix/AEPi/milestones

Other work is needed (e.g documentation, QOL improvements...), but below is an overview of the features implementation progress towards AEIEditor parity:

Feature Read support Write support
Raw image content
Basic metadata
Texture regions
Mipmapping
Compression quality (l/m/h)
Symbol maps

And compression format support progress:

Format Read support Write support
Uncompressed
Uncompressed_UI
Uncompressed_CubeMap_PC
Uncompressed_CubeMap
PVRTC12A
PVRTC14A
ATC
DXT1
DXT3
DXT5
ETC1

Extra feature requests for after the 1.0 release are very welcome.

To report a bug or request a feature, please submit an issue to the open issues page of this repository.

Contributing

This project has a huge amount of potential to help the community and extend the lifetime of our beloved game series. Your contributions will make that possible, and so I thank you deeply for your help with this project.

Please star the repository to let me know that my work is appreciated!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aepi-0.8.4.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aepi-0.8.4-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file aepi-0.8.4.tar.gz.

File metadata

  • Download URL: aepi-0.8.4.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for aepi-0.8.4.tar.gz
Algorithm Hash digest
SHA256 1d379169225664df3d34138a4b6a19b4414767c71f5917fd80682234f0f855df
MD5 a0cae8d8178d68590e0a9d886af64f9c
BLAKE2b-256 d92375e31d52143315de1edc59042ca894ca0ec5af63fe31a4d77b3519147327

See more details on using hashes here.

File details

Details for the file aepi-0.8.4-py3-none-any.whl.

File metadata

  • Download URL: aepi-0.8.4-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for aepi-0.8.4-py3-none-any.whl
Algorithm Hash digest
SHA256 28c85f8f8126d53a67fff48a98924651862165cb29f1be3a7fe56971cad01d85
MD5 1b24fdd4c8fcc0ec0b08b43c69147954
BLAKE2b-256 9cf5e99db9f2f32fea822165c9ebb6114cf38e9bc3496f338e43b5b50a997b8e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page