Skip to content

Add battle simulator sweep mode for enemy stat factor analysis#28

Merged
Null000 merged 2 commits intomainfrom
claude/rpg-event-tracking-U89bD
Feb 19, 2026
Merged

Add battle simulator sweep mode for enemy stat factor analysis#28
Null000 merged 2 commits intomainfrom
claude/rpg-event-tracking-U89bD

Conversation

@Null000
Copy link
Copy Markdown
Owner

@Null000 Null000 commented Feb 19, 2026

Summary

This PR adds a comprehensive "sweep" mode to the battle simulator that allows testing how different enemy stat multipliers affect gameplay progression. The simulator can now run parametric sweeps across HP and attack power factors to analyze balance and difficulty curves.

Key Changes

  • New sweep mode: Added runSweep() function that tests combinations of HP and attack factors (0.8x to 1.2x in 0.05 increments) across multiple lives
  • Event tracking system: Introduced SimEvent type to track significant battle events (deaths, level-ups, area changes) with turn numbers and game state
  • Stat factor application: Added applyStatFactors() function to selectively modify enemy stats based on enemy type
  • Enhanced simulation return type: Changed runSimulation() to return SimulationResult containing both final state and event history
  • Configurable enemy targeting: Sweep can target specific enemy types (currently Rat and DireRat) for factor application
  • Dual output formats: Generates both detailed JSON results and summary CSV for easy analysis
  • CLI mode selection: Added command-line argument parsing to switch between standard simulation and sweep mode (bun run src/rpg/simulator.ts sweep)
  • Imported getWizardLevel: Added utility function import to track level-up events during simulation

Implementation Details

  • The sweep generates a grid of factor combinations and runs full 3-life simulations for each combination
  • Event tracking captures turn numbers relative to the start of each life, enabling detailed progression analysis
  • Areas array is padded to 1000 entries during sweep to prevent out-of-bounds access
  • Results are written to sweep_results.json (detailed) and sweep_summary.csv (summary statistics) for analysis
  • The original runSimulations() behavior is preserved and remains the default mode

https://claude.ai/code/session_01AZfaVGqp9oMkBk5F7d8SBL

claude and others added 2 commits February 19, 2026 12:36
…ator

Track hero death, level-up, and area change events by player input turn.
Add ability to scale enemy HP and attack stats by configurable factors.
Add sweep mode (0.8-1.2 in 0.05 steps) that reports events across 81
factor combinations, outputting sweep_results.json and sweep_summary.csv.

https://claude.ai/code/session_01AZfaVGqp9oMkBk5F7d8SBL
@Null000 Null000 merged commit cd23342 into main Feb 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants