Skip to main content

kirby-terrain

Terrain objects, geometry and durability for the Kirby HERO System platform.

Overview

This package provides geometric primitives — points, segments and polygons — all measured in metres. It has zero dependencies and holds no game rules. It describes only what is physically present.

Key Properties

  • All units are metres. Scale conversion belongs at a source boundary (e.g. a map-tool reader) and does not leak inward.
  • No rules. A Segment does not know whether it blocks sight. A Polygon does not know how much damage breaks it. These types describe shape and space; rules live in other repositories.
  • Immutable. All types are frozen dataclasses, safe to share and reason about.

Geometry

Point

A position in three dimensions, with x, y, and optional z (height above ground, defaulting to 0.0).

Segment

A straight line between two points. Provides a length_m property (accounting for elevation) and an is_degenerate check.

Polygon

A closed region defined by a list of points. Provides:

  • is_degenerate: True if fewer than three points, or if points are collinear (no area).
  • centroid: The average of the vertices, suitable for labels or spawns.

Durability

Durability data (how hard materials are to break) comes from HERO System 6E2, p173. This package holds no durability logic; that belongs in other layers.

TerrainObject

TerrainObject is one primitive for everything physically present — a wall, a door, a window, a floor, a zone. It carries a shape (Segment or Polygon), a height_m, and an optional kind naming what it IS.

When kind is a row of OBJECT_DURABILITY (a wall, door or pane of glass from the 6E2 p173 Objects Table), pd, ed and body come from that table, overridable per object. When kind is None — "not identified": a floor, a tree, a vehicle, anything the table has no row for — the caller must supply pd_override, ed_override and body_override directly.

from kirby_terrain import OBJECT_DURABILITY, Point, Segment, TerrainObject

wall = TerrainObject(
    id="w1", name="north wall", kind="brick wall",
    shape=Segment(Point(0.0, 0.0), Point(5.0, 0.0)),
    height_m=3.0,
)
wall.pd, wall.ed, wall.body  # (5, 10, 3), from the table

Map Readers

Universal VTT

read_uvtt reads a Universal VTT export (.dd2vtt / .uvtt / .df2vtt — the format created for Dungeondraft and also emitted by other map tools, including Dungeon Alchemist) into a list of TerrainObject. Walls come from line_of_sight, one object per polyline segment — a polyline of N points becomes N−1 walls, though degenerate (zero-length) segments are dropped, so the count can be lower. Portals come from portals, as doors and windows.

from kirby_terrain import read_uvtt

objects = read_uvtt(
    "warehouse.dd2vtt",
    metres_per_square=1.524,
    wall_kind="brick wall",
    portal_kind="interior wood door",
    wall_height_m=4.0,
)

All four keyword arguments are required, and each names something the format does not state: it carries no real-world scale, no materials, and no heights, so metres_per_square, wall_kind, portal_kind and wall_height_m are assumptions the caller must make explicit rather than defaults this package could silently guess wrong.

Foundry Scene JSON is later work, and is not read by this package yet.

License

PolyForm Noncommercial License 1.0.0. See LICENSE for details.

Metadata

Release files for kirby-terrain 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kirby-terrain 0.4.0
File Size Uploaded Provenance Actions
kirby_terrain-0.4.0.tar.gz 24.4 kB Without provenance Details for kirby_terrain-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kirby-terrain 0.4.0
File Interpreter ABI Platform Actions
kirby_terrain-0.4.0-py3-none-any.whl Python 3 none any Details for kirby_terrain-0.4.0-py3-none-any.whl

Total release size: 39.2 kB

Release files / kirby_terrain-0.4.0.tar.gz

Download URL kirby_terrain-0.4.0.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9d064653bda3482c37f1a35cc78564bc0a1bc0ba63cb1eaddedc8d7fa454f312
BLAKE2b-256 checksum
How to use checksums
a13d633683786e8b95c7dafc3659db0e1b3a47f16e40e4a35eef0763defc1bb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / kirby_terrain-0.4.0-py3-none-any.whl

Download URL kirby_terrain-0.4.0-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71edd845f1785bf6a03311a5bc5aeafe1529b6746f9458648cbb9afdb61e30b3
BLAKE2b-256 checksum
How to use checksums
9b32f8883de0a62ecc41d8b118b3b284494decf8c7309a2975b8976e6d04c89b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for kirby-terrain 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page