Skip to content

Refactor game engine with multi-enemy battles and pygame UI#1

Open
KollinRT wants to merge 10 commits intomainfrom
codex/add-multiple-enemies-and-ui-support
Open

Refactor game engine with multi-enemy battles and pygame UI#1
KollinRT wants to merge 10 commits intomainfrom
codex/add-multiple-enemies-and-ui-support

Conversation

@KollinRT
Copy link
Copy Markdown
Owner

Summary

  • refactor the core character models and inventory system to use dataclasses and deterministic helpers
  • replace the procedural game logic with a reusable GameEngine that supports multi-enemy combat, shops, fishing and map transitions, and add a pygame front-end
  • clean up supporting modules, refresh documentation and expand the pytest suite for the new features

Testing

  • pytest

https://chatgpt.com/codex/tasks/task_e_68d03b5ee9f08328bb284b9157a11ea2

KollinRT and others added 9 commits September 21, 2025 15:24
- Add CODEBASE_GUIDE.md with comprehensive documentation:
  * Architecture overview with visual diagrams
  * Detailed explanation of the 'AI-guided frontier map' system
    (clarifying it's procedural generation, not actual AI/ML)
  * Pygame UI issues and refactoring recommendations
  * Extension guide for adding new classes, features, and items

- Add ui/pygame_ui_refactored.py as alternative implementation:
  * Separates concerns into Panel, LayoutManager, GameRenderer,
    InputHandler, and GameUI classes
  * Uses panel-based layout that prevents text overlap
  * Centralized configuration via UIConfig dataclass
  * Easier to extend and maintain
  * Drop-in compatible with original interface (run_pygame_ui())

All existing tests pass (25/25).
- Fix ui/pygame_ui.py text rendering:
  * Add boundary checking to _render_lines() to prevent overflow
  * Add max_y parameter to stop rendering before reaching another region
  * Add max_width parameter to truncate long lines with '...'
  * Status panel now bounded to Y=20-280
  * Event log now bounded to Y=300-580
  * Log entries dynamically limited based on available space

- Add PYGAME_OVERLAY_FIX.md documentation:
  * Explains the three root causes of text overlap
  * Provides three solution approaches (quick fix, panel-based, scrollable)
  * Includes before/after visual diagrams
  * Step-by-step instructions for each approach

All tests pass (25/25).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant