Skip to main content

A library to handle the 3D data format XBF from the game Emperor: Battle for Dune.

Project description

xanlib

Run tests PyPI

A Python library to handle the 3D data format XBF of the Xanadu engine, used in the game Emperor: Battle for Dune.
It may be used to load and save all 1521 XBF files from the game.

Installation

The library can be installed with pip:
pip install xanlib

Examples

Console Usage

The following commands entered into a python console will edit the sidebar to move it to the left:

from xanlib import load_xbf, save_xbf
scene = load_xbf('Data/UI0001/SIDEBAR/SIDEBAR1.XBF')
scene['~~0hide#'].transform = tuple(v - 100 if i == 12 else v for i, v in enumerate(scene['~~0hide#'].transform))
save_xbf(scene, 'Output/SIDEBAR1.XBF')

Explanation:

  1. Import the load and save functions
  2. Load the sidebar file
  3. Subtract 100 from the x-coordinate of the translation component of the transformation matrix. It is a flat tuple in column-major order, thus need to modify the element at index 12. Because it is a tuple, it has to be entirely replaced.
  4. Save to a new file.

Put the new file in a UI/SIDEBAR folder in the game's DATA folder to override the original and view the change in-game.

blender_import.py

A script that can be run within Blender to import the meshes of a XBF file. missile_tank_blender

extract_animations.py

A script that extracts animation info from the FX Data Header of an xbf file, provided as a command line argument.
Currently stand-alone, the code has yet to be integrated into the library.

Example usage:

python extract_anim_info.py Data/3DDATA0001/Buildings/AT_MGT_H0.xbf

will produce:

Stationary: 104-133, 0-50, 51-104, 133-163, 163-193
Idle 0: 200-240
Fire 0: 193-275

xbf_viewer.py

A rudimentary vertex animation viewer made with pygame. It highlights the normals in these animations.
(A more functional viewer is under development) pygame_viewer_animation

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

xanlib-0.1.1.post1.dev0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

xanlib-0.1.1.post1.dev0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file xanlib-0.1.1.post1.dev0.tar.gz.

File metadata

  • Download URL: xanlib-0.1.1.post1.dev0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Linux/5.15.0-124-generic

File hashes

Hashes for xanlib-0.1.1.post1.dev0.tar.gz
Algorithm Hash digest
SHA256 eeed804e181b17b1650fd356f3018df3e06b4639f6e150f6f3c1562e2fb06c07
MD5 ff0695baf787719d4a2e36885fdb7015
BLAKE2b-256 a8ca6ba84bb11cebe13699746c29692d8cdf6b916e662ca1a552e38b15b2b613

See more details on using hashes here.

File details

Details for the file xanlib-0.1.1.post1.dev0-py3-none-any.whl.

File metadata

  • Download URL: xanlib-0.1.1.post1.dev0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Linux/5.15.0-124-generic

File hashes

Hashes for xanlib-0.1.1.post1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 18bebefad7c7e337d23b98b18baf5156ab880ccefb4b827296cdec6a43d4d24f
MD5 33f08b479e58251f9f24197dd7e95f01
BLAKE2b-256 136313de69054273fd0487433d240c71dec85d59d32ffa202aba2437b8a1d47f

See more details on using hashes here.

Supported by

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