Skip to main content

A zero dependency, lightweight and fast library to manipulate RPG images written in Rust.

Project description

rpg_map

PyPI version Documentation Status

A fast, zero-dependency Python library for visualizing exploration and movement across large pixel-based maps. Built in Rust for speed and efficiency, rpg_map is perfect for turn-based or real-time RPGs, strategy games, and D&D-style map reveals.

Key Features

  • Hides unexplored areas of the map

  • Reveals areas as they’re explored or passed through

  • Draws travel paths using A* pathfinding

  • Fast and lightweight with zero Python dependencies

  • Operates directly on pixel data

  • Customizable visual styles and highlight zones

  • Includes examples using static image processing and Pygame

Install

Install via pip:

pip install rpg-map

Documentation

Full documentation and examples available at: https://rpg-map.readthedocs.io/

How It Works

The library uses step-by-step image processing to reveal and annotate the map. Here’s an overview of the process:

  1. Draw Obstacles The Map class accepts an obstacles parameter which allows you to define N-sided polygons. These are rendered onto the map as solid barriers.

    demos/1.png
  2. Add Padding and Convert to Pathfinding Grid Obstacles and map edges are padded and the image is converted into a binary map (1 = path, 0 = obstacle) for pathfinding.

    demos/2.png
  3. Pathfinding with A* The library uses the A* algorithm to find the shortest path from point A to point B. The path is drawn on the map using a customizable style.

    demos/3.png
  4. Draw Dots Optional dots can be placed on the map (e.g., for points of interest, the player, markers).

    demos/4.png
  5. Divide into Grid Squares The image is divided into equal squares based on the grid_size parameter.

    demos/5.png
  6. Reveal Explored Areas A mask overlays the map. Areas near the travel path or manually unlocked via Map.unlock_point are revealed in circular zones.

    demos/6.png
  7. Fill Transparent Areas Any remaining transparent pixels are filled with a background layer.

    demos/7.png
  8. Final Map Output The completed map shows explored areas, paths, markers, and hidden regions yet to be discovered.

    demos/8.png

Advanced Features

  • You can define special grid points where the reveal radius is larger — perfect for cities or key landmarks.

  • The library supports tons of styles for different themes and usecases.

    demos/9.png demos/10.png demos/11.png demos/12.png

Examples

Check out these demos:

Contributing & Development

We welcome contributions and ideas! If you’d like to work on rpg_map locally, here’s how to get started.

Set Up the Development Environment

  1. Compile the Rust Extension Locally

    Use maturin to build and install the Rust extension module in your local Python environment:

    maturin develop --features "extension-module"
  2. Generate Python Typings ( .pyi )

    The library includes a binary that auto-generates Python type stubs. Run it with:

    cargo run --bin stub_gen --features stubgen
  3. Build the Documentation

    The documentation uses Sphinx and can be built locally as follows:

    python3 -venv env && source env/bin/activate
    cd docs
    pip3 install -r requirements.txt
    sphinx-apidoc -o source/ ../ -f
    make html

    The output will be available in the docs/build/html/ directory.

Additional Notes

  • The Rust project uses pyo3 to create Python bindings — see Cargo.toml for feature flags and build options.

  • Type hints are manually generated via the stub_gen tool, ensuring compatibility with type checkers and IDEs. Interestingly sphinx uses the docs defined in the Rust code though, the pyi file is only for IDE type hinting when using the library.

License

MIT

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

rpg_map-0.0.2.tar.gz (19.8 MB view details)

Uploaded Source

Built Distributions

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

rpg_map-0.0.2-cp39-abi3-win_amd64.whl (196.7 kB view details)

Uploaded CPython 3.9+Windows x86-64

rpg_map-0.0.2-cp39-abi3-win32.whl (185.4 kB view details)

Uploaded CPython 3.9+Windows x86

rpg_map-0.0.2-cp39-abi3-musllinux_1_2_x86_64.whl (517.2 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

rpg_map-0.0.2-cp39-abi3-musllinux_1_2_i686.whl (544.1 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

rpg_map-0.0.2-cp39-abi3-musllinux_1_2_armv7l.whl (611.4 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARMv7l

rpg_map-0.0.2-cp39-abi3-musllinux_1_2_aarch64.whl (523.9 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

rpg_map-0.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (346.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

rpg_map-0.0.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (388.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ s390x

rpg_map-0.0.2-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (411.7 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ppc64le

rpg_map-0.0.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (349.5 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARMv7l

rpg_map-0.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (345.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

rpg_map-0.0.2-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl (368.4 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.5+ i686

rpg_map-0.0.2-cp39-abi3-macosx_11_0_arm64.whl (309.4 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

rpg_map-0.0.2-cp39-abi3-macosx_10_12_x86_64.whl (323.9 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rpg_map-0.0.2.tar.gz
  • Upload date:
  • Size: 19.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.3

File hashes

Hashes for rpg_map-0.0.2.tar.gz
Algorithm Hash digest
SHA256 81dd39bb9c36f6dbc805e637f6f27d741183dd0cc78d8142cc89dc9b51dfcd35
MD5 0049b14efc0ab1a4e75c11d04abeda74
BLAKE2b-256 714e82d8ffb423e41488e9bb3090856f8953ae31fe6701b6628735845ac88ac9

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: rpg_map-0.0.2-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 196.7 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.3

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 05e22d35c954a74d43ca63961e640ceb381bc069363610e46f6a3e23c7b44d28
MD5 49b43b05435f6ab06259618cb7fc6ca4
BLAKE2b-256 8575caca4c9288cbff715254de1fe65ddebf2b92533760d6db36b602a9834d36

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-win32.whl.

File metadata

  • Download URL: rpg_map-0.0.2-cp39-abi3-win32.whl
  • Upload date:
  • Size: 185.4 kB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.3

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 63e8ffa9b50612bc3a605a7939a536e14bb21683cbdef31218d9ad2abcf8c1f2
MD5 9ab432e4f4eb4c19974d09d2531723bf
BLAKE2b-256 d44a2e8c22ca60f2af7b24fffa04abcddddcbbf0f001f9c570ec242597236e69

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 454752030563d06b46b3da1c978f19db473a8ec2eb6dcf021e44fe67323cab99
MD5 c176e34f3185f9d35dc3d056487a9ec4
BLAKE2b-256 82d69c7090480b3011e81274e0c8efe8a490c7c5303e0c833c2e60513990409e

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 9f0b61995b468e9cfe9d3f7cdc2e84bfcfcd3b7725519964ec68db63ab747100
MD5 84e6f950943deae9c2bd261f943a4318
BLAKE2b-256 d63973ed8268b1ecbf95962cb76892dbe4c1c2bf5b996dc78be8e14c0c6ecbf9

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 edc66458fe9b34d3ee2b981c561842705dc2341c1616016b456981402aa46c7e
MD5 dd0f7b42bc38e888caf0781998d55582
BLAKE2b-256 586f78b5fc5f9ba0373da9296fa9d9dd5697d5e5fbf5f3418ebbfb3d3381775e

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 1017b06d603ca10df01f00f150dab6acbf2af97b0769118fd3e3fcc4cc077985
MD5 faec247c6d9d7df2ce490df35c11c2da
BLAKE2b-256 023284560722acbdf4c97cfadb77b0ca032b564324f643b03d54e41501fa3c5c

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ec5b308906745900abdba05339bbae0f5a1f50e19452f430b2e2010779a5b9e
MD5 d53c85406361be1c87bbdc3a9bec72c7
BLAKE2b-256 ea680046a29256c1bb5b855b8dc1cf0c1e7db36de7c58b70c99b0a9c37c0eab8

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 88d03d9c2389d38ac288fe94fb8276f51741b3774f97a1deed8566f9518fb3d8
MD5 f667473a2f3bd5a2d93363a16ac01598
BLAKE2b-256 75ba3f6fbd1cda2c3de72f2034c3580bcddf552d1a1c1b31319afef1020e0e3f

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 55de5e25ec94934445bcad6719340058e21f89b96d709ea8c940068a2fd2e492
MD5 471486bd759a707fe4ace5d1e811f0c8
BLAKE2b-256 ef25386e100d04d1686ffcab7ad4cac14650c6f4c05ae3ebe20badf384aac6ec

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 d08ed5182a42446b115cbc1338f23c2db59d1d022b078e5d5b4e8e083c83a479
MD5 76eef9b02a6a425a970563f6f674d585
BLAKE2b-256 f0cdf3cfa3a7b4f89acd84111c967e4b9197604dd0fa717effeacae20ed7c74d

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f0887e60845c2cdc96b8bccb0d10c640149ce1787a295814d9a731da5a1ecf44
MD5 b4d3ac6feef56e581cfc8b94c9034933
BLAKE2b-256 e1e6c7cfc2a4ab32b183090461ef548c0e8c999593c61d382ee84202dff65925

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 236253d0385736ba3a59bef3aac6bc85ea35f5d91adf9ba88120122aec65919e
MD5 7e187b7d1df013a921230b2c73a8f740
BLAKE2b-256 59f57256e5dc37ff88bd24545b2a9f644eb727b282dece653ecc52a9ca6464e1

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e469dcbbc62df5f9ce93941d87c0f49aa2993be0d51d3b81b42bfabb67431d81
MD5 9469ad5770219cd33e14b62883a1c4c9
BLAKE2b-256 f62c2e6d96f8758ed516ca1b3996102a34cce3e911924c0117a70efbb69e8598

See more details on using hashes here.

File details

Details for the file rpg_map-0.0.2-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rpg_map-0.0.2-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 45145b6161a2ca47336e605ef86b021c70c3693412aaacbf749ca480c13bc9e7
MD5 4b904d47060c9ef5988f8623e5929c8b
BLAKE2b-256 e423712a4564953748d25325ae8432c8fa77b7c2b9e205711b56456c2cafae4b

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