Skip to main content

A 1:1 Python conversion of the C# Ultima SDK

Project description

PyPI Python Version GitHub license GitHub last commit

Ultima SDK Python

A comprehensive 1:1 Python conversion of the C# Ultima Online SDK. This library provides full read access to Ultima Online client data files (.mul, .idx, and UOP formats) for use in tools, servers, and modding pipelines.

Features

  • Full access to UO client data files: Art, Animations, Gumps, TileData, Hues, Map, and more
  • Support for both legacy .mul/.idx and modern .uop file formats
  • Built-in PNG rendering helpers via Pillow
  • Automatic client directory discovery on Windows (registry lookup)
  • Manifest-based override support for custom client data
  • Typed API with type hints throughout
  • Comprehensive test suite including mocked and real-client smoke tests

Installation

From PyPI (coming soon)

pip install ultima-sdk-python

From Source

git clone https://github.com/UltimaWorks/ultima-sdk-python.git
cd ultima-sdk-python
pip install -e .

Requirements

  • Python 3.10+
  • Pillow 10.0+
  • An Ultima Online client installation (for reading .mul, .idx, and .uop files)

Quick Start

from ultima_sdk import Files, TileData, Art, Animations, Hues

# Initialize file paths (auto-detects UO client on Windows)
Files.initialize()  # or: Files.initialize("C:\\Ultima Online")

# Load tile data
TileData.initialize()
land_tile = TileData.get_land_tile(0)  # Get grass tile
static_tile = TileData.get_static_tile(3388)  # Get a static item

# Load hues
Hues.initialize()
hue_0 = Hues.get_hue(0)  # Default hue

# Load art
Art.initialize()
art = Art.get_art(0x4001)  # Load art by graphic ID
if art:
    img = art.to_image()  # Convert to PIL Image
    img.save("output.png")

# Load animations
Animations.initialize()
anim = Animations.get_animation(body=1, action=0, direction=0)

Module Reference

Files

The Files class manages all UO client data file paths and discovery.

from ultima_sdk import Files

# Auto-detect client directory (Windows registry)
Files.initialize()

# Or specify manually
Files.initialize("/path/to/ultima_online")

# Check if a file exists
if Files.file_exists("artidx.mul"):
    print("Art index found!")

# Get absolute path to a file
art_path = Files.get_file_path("artidx.mul")

TileData

Reads tiledata.mul for land and static tile definitions.

from ultima_sdk import TileData

TileData.initialize()

# Land tiles (ground textures)
land = TileData.get_land_tile(0)  # Grass
print(land.name, land.flags)

# Static tiles (items, walls, furniture)
static = TileData.get_static_tile(3388)  # Wooden chest
print(static.name, static.height)

Hues

Reads hues.mul for color/shader data.

from ultima_sdk import Hues

Hues.initialize()
hue = Hues.get_hue(1)  # Red hue
print(hue.name)  # "Crimson"

Art

Reads artidx.mul / art.mul for static item graphics.

from ultima_sdk import Art

Art.initialize()
art = Art.get_art(0x4001)  # Load by graphic ID
if art:
    img = art.to_image()  # Returns PIL.Image
    img.save("item.png")

Animations

Reads anim.idx / anim.mul and variant files for character/object animations.

from ultima_sdk import Animations

Animations.initialize()
# Get a single frame
frame = Animations.get_animation(body=1, action=0, direction=0)

# Export as GIF
Animations.export_gif(1, 5, "character.gif")

Gumps

Reads gumpidx.mul / gumpart.mul for UI element graphics.

from ultima_sdk import Gumps

Gumps.initialize()
gump = Gumps.get_gump(gump_id=0x829)
if gump:
    img = gump.to_image()

Map

Reads map data including statics, map markers, and multi-object placements.

from ultima_sdk import Map

Map.initialize()
# Get statics at a location
statics = Map.get_statics(0, 1396, 819)  # Britain
for s in statics:
    print(s.item_id, s.x, s.y, s.z)

Skills

Reads skills.def for skill definitions.

from ultima_sdk import Skills

Skills.initialize()
for skill_id in range(150):
    skill = Skills.get_skill(skill_id)
    if skill:
        print(f"{skill.name}: gainrate={skill.gain_rate}")

Rendering

All art, animation, and gump objects have a .to_image() method that returns a PIL.Image.

from ultima_sdk import Art

Art.initialize()
art = Art.get_art(0x4051)
img = art.to_image()
img.save("output.png")

File Structure

ultima-sdk-python/
├── pyproject.toml
├── README.md
├── LICENSE
├── .github/workflows/      # CI/CD pipelines
├── examples/               # Usage examples for each module
├── scripts/                # Utility scripts
├── tests/                  # Test suite
└── ultima_sdk/
    ├── __init__.py         # Package entry point
    ├── files.py            # File path management
    ├── tiledata.py         # TileData.mul reader
    ├── hues.py             # Hues.mul reader
    ├── art.py              # Art graphics reader
    ├── animations.py       # Animation reader
    ├── gumps.py            # Gump graphics reader
    ├── map.py              # Map data reader
    ├── skills.py           # Skills.def reader
    ├── multis.py           # Multi-object data
    ├── textures.py         # Texture reader
    ├── sound.py            # Sound/music reader
    ├── uop.py              # UOP file format support
    ├── verdata.py          # Version data (patching)
    ├── rendering.py        # PIL image helpers
    └── ...                 # Other utility modules

Examples

The examples/ directory contains runnable scripts for every major module:

File Description
art_example.py Load and save art tiles as PNG
animations_gif_example.py Export animations to GIF
map_example.py Query static objects on a map
rendering_example.py Render art/animations to images
uop_example.py Work with UOP-format data files
verdata_example.py Apply patch data from verdata
... See examples/ for all 30+ examples

Tests

# Run all tests
pytest -v

# Run with coverage
pytest --cov=ultima_sdk --cov-report=term

# Run a specific test module
pytest tests/test_art.py -v

Platform Support

Platform Support Notes
Windows Full Auto-detection via registry
Linux Supported Manual path configuration
macOS Supported Manual path configuration

License

Written under the Pickleware License. See LICENSE for full terms.

Contributing

Contributions are welcome! See CONTRIBUTING.md for setup instructions, code standards, and the PR workflow.

Related Projects

  • UOFiddler — Original C# Ultima SDK this project converts from
  • ServUO — Popular Ultima Online server implementation
  • JSmith.UoSdk — .NET SDK for UO client data

Support

For issues, questions, or feature requests, please open an issue on the GitHub Issues page.

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

ultima_sdk_python-1.1.0.tar.gz (71.7 kB view details)

Uploaded Source

Built Distribution

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

ultima_sdk_python-1.1.0-py3-none-any.whl (67.1 kB view details)

Uploaded Python 3

File details

Details for the file ultima_sdk_python-1.1.0.tar.gz.

File metadata

  • Download URL: ultima_sdk_python-1.1.0.tar.gz
  • Upload date:
  • Size: 71.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ultima_sdk_python-1.1.0.tar.gz
Algorithm Hash digest
SHA256 906fb29abfb7f3c04fd0be36e33cbb507c5e09bd2d670a3a41f292ef6262ee73
MD5 fa829d3c611e84a5fe6fb70628a47da3
BLAKE2b-256 f942f38e6d4be47c190bc09a70a39ad7c5553b3a034e24daa83ef18167b8c599

See more details on using hashes here.

Provenance

The following attestation bundles were made for ultima_sdk_python-1.1.0.tar.gz:

Publisher: workflow.yml on UltimaWorks/ultima-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ultima_sdk_python-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ultima_sdk_python-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd23016c92bc40124cf5ba9ed26160c85da93839c375f94b65876d8dc997185c
MD5 fc7d038265a22cd88739d6dacf8e47f9
BLAKE2b-256 8cb83bf8bdde1666de5538dcc7de28ae1c362571ec3d165611152b2d36577ab3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ultima_sdk_python-1.1.0-py3-none-any.whl:

Publisher: workflow.yml on UltimaWorks/ultima-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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