Dynamic Layer System for Grid #147
Labels
No Label
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: john/McRogueFace#147
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
Replace the current hardcoded grid layers with a flexible, user-defined layer system. Grids should only allocate memory for layers they actually use.
Current Problems
Wasted memory: Every
UIGridPointhas unused fields:color_overlay(4 bytes) - never renderedtile_overlay(4 bytes) - never rendereduisprite(4 bytes) - never renderedInflexible: Can't have multiple tile layers (ground + roof) or multiple overlays
Fixed entity ordering: Layers are hardcoded below/above entities
Proposed Design
Two Layer Types
ColorLayer: 4 bytes/cell (RGBA)
TileLayer: 4 bytes/cell (sprite index into texture atlas)
Layer Ordering via z_index
Backwards Compatibility
Default Grid behavior creates one TileLayer at z_index=-1:
Memory Comparison (1000×1000 grid)
API Design
Implementation Notes
walkable[],transparent[], entity list, TCOD mapUIGridPointbecomes minimal or eliminated (just accessors into layer data)Relationship to Other Issues
Definition of Done
grid.add_layer()/grid.remove_layer()API