Skip to main content

A 2D procedural tile framework for games.

Project description

jabutiles

A 2D Tile library for python.

Most of the backend is pillow (PIL fork), the rest is numpy.






About the classes:

jabutiles.base.BaseImage

This is the most basic class used by jabutiles.

It is nothing more than a PIL.Image wrapped around functional style methods.
This means that each operation returns a copy of the class with the change.

It is not used directly, but inherited by the other core classes.
Provides most of the Image operations: rotation, mirroring, cropping, ...


jabutiles.mask.Mask (BaseImage)

This class inherits from the BaseImage.

It is used to represent a pure L mask.
Used as an alpha for a Texture or to overlay two Textures.

Can have additional components:

jabutiles.shape.Shape

A class that defines what is the purpose of the Mask.

It's used to govern rotation and reflection operations.

Can be:

  • orthogonal: square (GB/GBC/GBA Pokemon, Stardew Valley)
  • isometric: diamond (Age of Empires II, Diablo II)
  • hexagonal: both flat (?) and point (Heroes of Might and Magic III)

jabutiles.edges.Edges

A class that governs how the Mask interacts with surrounding Masks.

Adds new methods:

  • invert: Inverts the grayscale values (0 <-> 255)

jabutiles.texture.Texture (BaseImage)

This class inherits from the BaseImage.

It is used to represent pure RGB(A) visual data, such as a Texture.
Usually generated in-code or loaded from an image file.

Adds new methods:


jabutiles.layer.Layer

A combination of a Texture and/or a Mask.
Must have at least one of them present.

If both exist, the Mask is the Texture's alpha.
If only Texture, it's regarded as a base Texture.
If only Mask, it's regarded as a Shape cutter.


jabutiles.tile.Tile

A collection of Layers (at least one).
If only one layer, MUST contain a Texture.

Usually follows this pattern:

[
  (Texture, None),        # 1. Base Layer, the Texture is the base
  (Texture, Mask),        # 2. Detail Layer, overlays information
  ...                     # Mask has no Shape nor Edges, is usually a pattern
  (Texture, Mask(Edges))  # 3. Edges Layer, defines how to interact with neighbours
  ...                     # Can be more than one if surrounded by different Textures
  (None,    Mask(Shape)), # 4. Shape Layer, defines the final appearance
]

Exporting the resulting Image means stacking up the layers.

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

jabutiles-0.0.2.tar.gz (53.1 kB view details)

Uploaded Source

Built Distribution

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

jabutiles-0.0.2-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file jabutiles-0.0.2.tar.gz.

File metadata

  • Download URL: jabutiles-0.0.2.tar.gz
  • Upload date:
  • Size: 53.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for jabutiles-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4f9d6abc6f7e1ff9fba82a71fde17262fc2c1636e6e42e57436ed9bb29564622
MD5 5f83f423b478e13f5f129538c1c1836a
BLAKE2b-256 291519aa478fb1ee3d209a9b868997ef3fe3bfae598bbd11810b23cbb3d6b07a

See more details on using hashes here.

File details

Details for the file jabutiles-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: jabutiles-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for jabutiles-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 779e2e869ece34e8882abba58cb82716927fd353d2924f7a679c9705dfd2dc3c
MD5 f9c4a07fb2406a84627f1104596e5b25
BLAKE2b-256 7e4dfc59eea045ecdf2cec48e5933122e1ff94c67b28a320228ee8b4a336b9b0

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