Expert guidance for building and modifying a physics-based battle simulation game built with Phaser 3, Matter.js, and TypeScript
Expert guidance for building and modifying **Charge Conquerer**, a physics-based battle simulation game with Vampire Survivors-style progression, built with Phaser 3 and Matter.js.
This skill helps you work on a mobile-optimized WebGL game with:
Always adhere to these mobile optimization rules:
1. **Physics Limits**
- Maximum 160 active bodies (hard cap: 240)
- Fixed 60 Hz physics simulation
- Use circular colliders for units (not polygons)
- Compound shapes only for siege units and large props
- Aggressive body sleeping and damping
2. **Rendering Limits**
- Keep draw calls under 120
- Use texture atlases for all sprites
- LOD system for particles and lights based on FPS
- Off-screen AI updates at 1/4 tick rate
- Ragdolls have 2-3 second TTL
3. **Asset Specs**
- Iso tiles: 32×16 pixels
- Unit sprites: 32×32 (normal), 48×48 (elite/large)
```
src/
├── systems/ # Modular game systems (PhysicsManager, CombatSystem, etc.)
├── scenes/ # Phaser scenes (Boot, Preload, Battle, UI, SkillSelection)
├── entities/ # Game object classes (Unit, Projectile, etc.)
├── data/ # Configuration and data definitions
└── utils/ # Helper functions and utilities
```
When modifying or creating systems, follow these patterns:
When implementing or modifying status effects, use these definitions:
When working with units, respect these constraints:
NEVER propose changes to code you haven't read. Always:
```bash
cat src/systems/PhysicsManager.ts
cat src/data/unitStats.ts
cat src/scenes/BattleScene.ts
```
After making changes:
```bash
npm run typecheck
npm run lint
npm run dev
```
Before adding new features:
For balance changes, modify data files (never hardcode):
1. Add unit definition to `src/data/unitStats.ts`
2. Create sprite atlas entry (32×32 or 48×48)
3. Define physics collider (prefer circle)
4. Add unit class in `src/entities/Unit.ts` if custom behavior needed
5. Register in `UnitManager` unit registry
6. Add to deployment UI in `UIScene`
1. Define skill in `src/data/skills.ts` with rank 1-5 progressions
2. Implement skill logic in `LevelUpSystem` or new skill system
3. Add skill icon to atlas (32×32)
4. Update skill selection UI in `SkillSelectionScene`
1. Define effect enum in `src/systems/CombatSystem.ts`
2. Implement effect logic in `CombatSystem.applyStatusEffect()`
3. Add visual indicator in `IsometricRenderer`
4. Add effect removal/expiration logic
When physics is slow:
1. Check body count: `PhysicsManager.getActiveBodyCount()`
2. Increase sleeping thresholds in `PhysicsManager`
3. Reduce collision pairs with collision filters
4. Simplify compound shapes to circles where possible
5. Increase damping for faster settling
For visual glitches:
1. Check y-sort order in `IsometricRenderer.updateDepth()`
2. Verify sprite pivot points (center for units)
3. Check camera bounds and culling
4. Profile draw calls in Chrome DevTools
5. Verify texture atlas packing
Current vertical slice includes:
1. **No Backward Compatibility Hacks**: Delete unused code completely
2. **No Over-Engineering**: Only implement what's requested
3. **Mobile-First**: Always test with mobile throttling
4. **Designer-Owned Data**: Balance changes go in data files
5. **Performance Budget**: Never exceed physics/draw call limits
```
Boot (assets load manifest)
↓
Preload (load all assets)
↓
Battle (main gameplay)
+ UI (overlay HUD)
+ SkillSelection (pause on level-up)
```
Before making changes, familiarize yourself with:
1. `src/scenes/BattleScene.ts` - Main gameplay orchestration
2. `src/systems/PhysicsManager.ts` - Physics optimization patterns
3. `src/systems/UnitManager.ts` - Unit lifecycle management
4. `src/data/unitStats.ts` - Unit configuration format
5. `src/systems/LevelUpSystem.ts` - Progression mechanics
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/project-conquerer-development-assistant/raw