Add browser debugging support
This commit is contained in:
33
docs/debugging.md
Normal file
33
docs/debugging.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Debugging
|
||||
|
||||
## VS Code
|
||||
|
||||
1. Open this folder in VS Code.
|
||||
2. Run `Debug Heros Web (Chrome)` from Run and Debug.
|
||||
3. VS Code starts the Vite dev server and opens Chrome at `http://localhost:5173`.
|
||||
4. Set breakpoints in `src/game/scenes/*.ts`.
|
||||
|
||||
## Browser Console
|
||||
|
||||
Development builds expose:
|
||||
|
||||
```js
|
||||
window.__HEROS_GAME__
|
||||
window.__HEROS_DEBUG__
|
||||
```
|
||||
|
||||
Useful commands:
|
||||
|
||||
```js
|
||||
__HEROS_DEBUG__.activeScenes()
|
||||
__HEROS_DEBUG__.battle()
|
||||
__HEROS_DEBUG__.goToBattle()
|
||||
__HEROS_DEBUG__.toggleBattleOverlay()
|
||||
```
|
||||
|
||||
## Battle Hotkeys
|
||||
|
||||
- `F9`: Toggle battle debug overlay.
|
||||
- `F10`: Log battle state to the browser console.
|
||||
|
||||
The battle debug state includes turn, phase, selected unit, pending move, acted units, unit coordinates, attack intents, and bond progress.
|
||||
Reference in New Issue
Block a user