[Proc Gen] HeightMap - Terrain generation methods #195

Closed
opened 2026-01-12 00:07:48 +00:00 by john · 0 comments
Owner

Parent Issue: #192

Overview

Add libtcod terrain generation algorithms to HeightMap.

Specification

def add_hill(self, center: tuple[int, int], radius: float, height: float) -> HeightMap
def dig_hill(self, center: tuple[int, int], radius: float, depth: float) -> HeightMap
def add_voronoi(self, num_points: int, 
                coefficients: tuple[float, ...] = (1.0, -0.5),
                seed: int = None) -> HeightMap
def mid_point_displacement(self, roughness: float = 0.5,
                           seed: int = None) -> HeightMap
def rain_erosion(self, drops: int,
                 erosion: float = 0.1,
                 sedimentation: float = 0.05,
                 seed: int = None) -> HeightMap
def dig_bezier(self, points: tuple[tuple[int, int], ...],
               start_radius: float, end_radius: float,
               start_depth: float, end_depth: float) -> HeightMap
def smooth(self, iterations: int = 1) -> HeightMap

Implementation Notes

  • All map to corresponding TCOD_heightmap_* functions
  • center accepts tuple, list, or mcrfpy.Vector
  • points for bezier must be exactly 4 control points
  • smooth is a simplified kernel transform (averaging neighbors)
  • seed=None uses random seed

Acceptance Criteria

  • All terrain methods produce expected results
  • mid_point_displacement followed by normalize gives usable terrain
  • dig_bezier carves visible paths
  • rain_erosion produces erosion patterns
  • Visual demo in tests/demo/screens/heightmap_terrain_demo.py
**Parent Issue:** #192 ## Overview Add libtcod terrain generation algorithms to HeightMap. ## Specification ```python def add_hill(self, center: tuple[int, int], radius: float, height: float) -> HeightMap def dig_hill(self, center: tuple[int, int], radius: float, depth: float) -> HeightMap def add_voronoi(self, num_points: int, coefficients: tuple[float, ...] = (1.0, -0.5), seed: int = None) -> HeightMap def mid_point_displacement(self, roughness: float = 0.5, seed: int = None) -> HeightMap def rain_erosion(self, drops: int, erosion: float = 0.1, sedimentation: float = 0.05, seed: int = None) -> HeightMap def dig_bezier(self, points: tuple[tuple[int, int], ...], start_radius: float, end_radius: float, start_depth: float, end_depth: float) -> HeightMap def smooth(self, iterations: int = 1) -> HeightMap ``` ## Implementation Notes - All map to corresponding `TCOD_heightmap_*` functions - `center` accepts tuple, list, or `mcrfpy.Vector` - `points` for bezier must be exactly 4 control points - `smooth` is a simplified kernel transform (averaging neighbors) - `seed=None` uses random seed ## Acceptance Criteria - [ ] All terrain methods produce expected results - [ ] `mid_point_displacement` followed by `normalize` gives usable terrain - [ ] `dig_bezier` carves visible paths - [ ] `rain_erosion` produces erosion patterns - [ ] Visual demo in `tests/demo/screens/heightmap_terrain_demo.py`
john closed this issue 2026-01-12 03:00:16 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
john/McRogueFace#195
No description provided.