RampantTrackGeneration is..
.. the Track generation logic for Rampant on the Tracks.
The logic is invoked by calling
@staticmethod
def generateTrack(
diagramWidth: int,
diagramHeight: int,
numDiagramRegions: int,
diagramEdgePercentageToProcess: float,
newConnectionAngleMinQuantile: float,
lonelyConnectionMinLengthQuantile: float,
connectionLengthVertexPadding: float,
connectionLengthNodeBuffer: float
) -> Track:
in TrackGenerator.
Track
@dataclass(frozen=True)
class Track:
nodes: dict[uuid4, Point]
stops: dict[uuid4, tuple[Point]]
edges: dict[uuid4, EdgeVertexInfo]
describes a set of edges, each a connection between two Points. nodes are the Points - stops are intervals on each edge, a gameplay mechanic that'll be elaborated later.
generateTrack derives the Track from a randomly generated Voronoi diagram.
It preserves the organic appeal of the diagram's shape - connectivity of varying lengths between unevenly spaced points - and goes on to enhance that by removing a subset of the smallest edges, replacing them with longer " reconnections ". The reconnections' intersections with other edges are calculated. Intersections that could be removed without newly isolating either of the involved Points are removed - this, and further trimming, increase the variance of the resulting Track's shape and its appeal in both visual and gameplay terms.
It uses Voronout to generate the diagram and networkX to model the diagram's transformation into a Track.
RampantTrackGeneration works by..
.. doing the following:
- generating #
numDiagramRegionsVoronoi diagram sites (0 <= x <= diagramWidth,0 <= y <= diagramHeight) - generating the Voronoi diagram
- using
newConnectionAngleMinQuantileto calculateinitialDiagramMinAcceptableAngle, the minimum angle any new reconnection should make with any of the edges at either of its vertices- rejecting any reconnection that does not satisfy that constraint minimizes the probability of getting
Trackedges that make awkwardly small angles with other edges
- rejecting any reconnection that does not satisfy that constraint minimizes the probability of getting
- reconnecting
diagramEdgePercentageToProcess * 100% of the smallest edges in the diagram - removing all intersection edges created by reconnection that can be safely removed
- removing all " lonely " edges (ones where one vertex is only connected to that edge) with length <=
lonelyConnectionMinLengthQuantile * 100% of all edge lengths - adjusting all edges with length <
minEdgeAdjustLength, either..- .. combining them with another collinear edge such that the combination would make the longest edge possible
- .. deleting the edge, reconnecting all edges involving the vertex with the fewest neighbors to the other vertex
- placing
Stopson the remaining edges- to avoid the awkwardness of placing on " too small edges ", we only place on edges whose length is greater than
(connectionLengthVertexPadding + connectionLengthNodeBuffer) * 100% of edges - to space
Stopsorganically on an edge, we place them at leastconnectionLengthVertexPadding * 100% of the edge length away from either of points - and make the distance between eachStopat leastconnectionLengthNodeBuffer * 100% of the edge length
- to avoid the awkwardness of placing on " too small edges ", we only place on edges whose length is greater than
The resulting enhancement can be seen in the below illustration of Voronoi diagram -> Track:
Metadata
Release files for RampantTrackGeneration 0.0.1.2.1
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 |
|---|---|---|---|---|
| rampanttrackgeneration-0.0.1.2.1.tar.gz | 3.9 MB | Without provenance | Details for rampanttrackgeneration-0.0.1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rampanttrackgeneration-0.0.1.2.1-py3-none-any.whl | Python 3 | none | any | Details for rampanttrackgeneration-0.0.1.2.1-py3-none-any.whl |
Total release size: 3.9 MB
Release files / rampanttrackgeneration-0.0.1.2.1.tar.gz
| Download URL | rampanttrackgeneration-0.0.1.2.1.tar.gz |
|---|---|
| Size | 3.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
193e5d1f52ca5b4e0af3c61dbb70873b24be1246b85093f1088f7a875e98a98a
|
|
BLAKE2b-256 checksum How to use checksums |
6ced30cd3e79440cc9ea3070e51c726c2a6413f2062b0e66c729ac7a4486932b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / rampanttrackgeneration-0.0.1.2.1-py3-none-any.whl
| Download URL | rampanttrackgeneration-0.0.1.2.1-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
221204f0677753e7743aac2cf442106a0a2f9699382458562bd1df493d882245
|
|
BLAKE2b-256 checksum How to use checksums |
7a5df89f7452d5bcc93db324584a83b415e094ca7fa3b74ba04a14ad378991bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for RampantTrackGeneration 0.0.1.2.1
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.