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
Segmentdoes not know whether it blocks sight. APolygondoes 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.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kirby_terrain-0.3.0.tar.gz | 24.2 kB | Without provenance | Details for kirby_terrain-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kirby_terrain-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for kirby_terrain-0.3.0-py3-none-any.whl |
Total release size: 38.8 kB
Release files / kirby_terrain-0.3.0.tar.gz
| Download URL | kirby_terrain-0.3.0.tar.gz |
|---|---|
| Size | 24.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
af89be71a0b59d44cc618e827fd5a5bf25027cd678caf80a3c78df1517ab036b
|
|
BLAKE2b-256 checksum How to use checksums |
b788eb911bb02927d7e7e6afa821a4c0a4737804f8e442532a1fff3000f2ae54
|
| 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.3.0-py3-none-any.whl
| Download URL | kirby_terrain-0.3.0-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ebdb279ada952730fc66e7b595a0440a2ef5d4bd47e0284e2d94dcc63ac8a15
|
|
BLAKE2b-256 checksum How to use checksums |
0ae49a6268a09a94dd966df2f1bb0c5324df80ea9e0bb0b4abbc709fa257509e
|
| 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.3.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.