Line and Arc drawing primitives for path visualization #128

Open
opened 2025-10-31 02:49:03 +00:00 by john · 0 comments
Owner

Feature Request

Add native line and arc drawing primitives to visualize movement paths, orbital trajectories, and other vector graphics directly in the rendering system.

Use Case: PINSHIPS Game

The PINSHIPS space roguelike requires:

  • Movement path visualization: Straight-line paths showing where ships will move
  • Orbital arc rendering: Curved paths around planets/gravity wells
  • Multi-turn path preview: Showing several turns of movement in advance
  • Trajectory indicators: Missile paths, intercept courses

Current Workaround

Using Grid.at() to color grid cells along the path:

# Crude but functional
for x, y in path_points:
    grid.at(x, y).sprite = "path_marker.png"

Problems with workaround:

  • Only works at grid cell granularity (no sub-pixel precision)
  • Requires sprite assets for path markers
  • Doesn't look as polished as vector lines
  • O(n) cell updates for each path

Proposed API

# Simple line
line = mcrfpy.Line(start=(10.5, 20.3), end=(50.7, 80.2), 
                   color=(255, 255, 0, 128), thickness=2)
scene.ui.append(line)

# Arc for orbital paths
arc = mcrfpy.Arc(center=(100, 100), radius=25, 
                 start_angle=45, end_angle=135,
                 color=(0, 255, 0, 128), thickness=2)
scene.ui.append(arc)

# Polyline for complex paths
path = mcrfpy.Polyline(points=[(10,10), (20,15), (35,20), (50,18)],
                       color=(255, 0, 0, 128), thickness=2)
scene.ui.append(path)

Implementation Notes

Backend: SFML provides sf::VertexArray for efficient line rendering

UIDrawable Integration:

  • Create UILine and UIArc classes inheriting from UIDrawable
  • Support position, color, thickness, opacity
  • Implement bounding box for culling
  • Support animation of endpoints/angles

Optional Features:

  • Dashed/dotted line styles
  • Arrow heads
  • Anti-aliasing control
  • Gradient colors along path

Priority

Tier 1 Active - Critical for PINSHIPS MVP visual polish (Week 1-2)

Can defer to Week 3-4 if using grid cell workarounds initially

  • Complements #128 (Circle drawing) for complete 2D primitive set
  • Enables better visualization than pure grid-based approaches
  • Foundation for potential #107 (Particle system) trails

Labels

[Major Feature] [priority:tier2-foundation] [system:rendering] [system:ui-hierarchy]

## Feature Request Add native line and arc drawing primitives to visualize movement paths, orbital trajectories, and other vector graphics directly in the rendering system. ## Use Case: PINSHIPS Game The PINSHIPS space roguelike requires: - **Movement path visualization**: Straight-line paths showing where ships will move - **Orbital arc rendering**: Curved paths around planets/gravity wells - **Multi-turn path preview**: Showing several turns of movement in advance - **Trajectory indicators**: Missile paths, intercept courses ## Current Workaround Using `Grid.at()` to color grid cells along the path: ```python # Crude but functional for x, y in path_points: grid.at(x, y).sprite = "path_marker.png" ``` **Problems with workaround:** - Only works at grid cell granularity (no sub-pixel precision) - Requires sprite assets for path markers - Doesn't look as polished as vector lines - O(n) cell updates for each path ## Proposed API ```python # Simple line line = mcrfpy.Line(start=(10.5, 20.3), end=(50.7, 80.2), color=(255, 255, 0, 128), thickness=2) scene.ui.append(line) # Arc for orbital paths arc = mcrfpy.Arc(center=(100, 100), radius=25, start_angle=45, end_angle=135, color=(0, 255, 0, 128), thickness=2) scene.ui.append(arc) # Polyline for complex paths path = mcrfpy.Polyline(points=[(10,10), (20,15), (35,20), (50,18)], color=(255, 0, 0, 128), thickness=2) scene.ui.append(path) ``` ## Implementation Notes **Backend:** SFML provides `sf::VertexArray` for efficient line rendering **UIDrawable Integration:** - Create `UILine` and `UIArc` classes inheriting from `UIDrawable` - Support position, color, thickness, opacity - Implement bounding box for culling - Support animation of endpoints/angles **Optional Features:** - Dashed/dotted line styles - Arrow heads - Anti-aliasing control - Gradient colors along path ## Priority **Tier 1 Active** - Critical for PINSHIPS MVP visual polish (Week 1-2) **Can defer to Week 3-4** if using grid cell workarounds initially ## Related Issues - Complements #128 (Circle drawing) for complete 2D primitive set - Enables better visualization than pure grid-based approaches - Foundation for potential #107 (Particle system) trails ## Labels `[Major Feature]` `[priority:tier2-foundation]` `[system:rendering]` `[system:ui-hierarchy]`
john added the
Bugfix
Documentation
priority:tier1-active
priority:tier2-foundation
labels 2025-10-31 12:16:17 +00:00
john removed the
Documentation
Bugfix
priority:tier1-active
priority:tier2-foundation
labels 2025-10-31 12:44:27 +00:00
john added the
Major Feature
Bugfix
priority:tier1-active
priority:tier2-foundation
labels 2025-10-31 13:22:19 +00:00
john added
system:python-binding
priority:tier3-future
and removed
Bugfix
priority:tier1-active
labels 2025-10-31 13:48:44 +00:00
john added
system:rendering
system:ui-hierarchy
and removed
system:python-binding
priority:tier3-future
labels 2025-10-31 13:59:29 +00:00
john added a new dependency 2025-11-01 07:39:20 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
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#128
No description provided.