Commit Graph

24 Commits

Author SHA1 Message Date
6f0d8a866f add F3 debug view (Issue #6)
F3 toggles a debug overlay with:
- FPS
- Mouse world/tile coordinates
- Tile type under cursor
- Resources, buildings, crops on hovered tile
- Nisse count broken down by AI state (idle/walking/working/sleeping)
- Active jobs by type (chop/mine/farm)
- Pathfinding visualization: cyan lines + destination highlight
  drawn in world space via DebugSystem

Added DebugSystem to GameScene. VillagerSystem exposes
getActivePaths() for the path visualization. JSDoc added to all
previously undocumented methods in VillagerSystem, WorldSystem,
GameScene, and UIScene.
2026-03-21 12:11:54 +00:00
3fdf621966 implement zoom-to-mouse in CameraSystem
Replaces plain cam.setZoom() with zoom-to-mouse: after each zoom step
the scroll is corrected by (mouseOffset from center) * (1/zBefore - 1/zAfter),
keeping the world point under the cursor fixed. Also fixes getCenterWorld()
which previously divided by zoom incorrectly. Added JSDoc to all methods.
2026-03-21 11:53:00 +00:00
7f0ef0554e add ZoomMouseScene with zoom-to-mouse correction
Implements scroll correction after cam.setZoom() so the world point
under the mouse stays fixed. Formula accounts for Phaser's
center-based zoom: scrollX += (mouseX - cw/2) * (1/zBefore - 1/zAfter).
Tab switches between the two test scenes in both directions.
Also fixes centerWorld formula in ZoomTestScene overlay and logs.
2026-03-21 11:49:39 +00:00
d83b97a447 ♻️ increase test world to 500×500 tiles, adjust marker intervals 2026-03-21 11:40:11 +00:00
a93e8a2c5d 🐛 fix HUD overlay zoom + add red center crosshair
Text overlay now uses a dedicated HUD camera (zoom=1, fixed scroll)
so it's never scaled by the world zoom. World objects and HUD objects
are separated via camera ignore lists. Added red screen-center
crosshair to HUD layer as a precise alignment reference.
2026-03-21 11:34:04 +00:00
7c130763b5 add file logging via Vite middleware to ZoomTestScene
Vite dev server gets a /api/log middleware (POST appends to
game-test.log, DELETE clears it). ZoomTestScene writes a zoom event
with before/after state on every scroll, plus a full snapshot every
2 seconds. Log entries are newline-delimited JSON.
2026-03-21 11:19:54 +00:00
007d5b3fee add ZoomTestScene with Phaser default zoom for analysis
Separate test environment at /test.html (own Vite entry, own Phaser
instance). ZoomTestScene renders a 50×50 tile grid with crosshair
markers and a live HUD overlay showing zoom, scroll, viewport in px
and tiles, mouse world/screen/tile coords, and renderer info.
Zoom uses plain cam.setZoom() — no mouse tracking — to observe
Phaser's default center-anchor behavior.
2026-03-21 11:16:39 +00:00
34220818b0 ♻️ revert zoom to center-only, keep middle-click pan 2026-03-20 21:09:13 +00:00
0011bc9877 🐛 fix debug cross: clear+redraw each frame at world-space center, no transforms 2026-03-20 21:06:14 +00:00
6fa3ae4465 🐛 fix debug cross: world-space position + counter-scale, tracks viewport center correctly 2026-03-20 20:57:46 +00:00
6de4c1cbb9 🐛 zoom-to-mouse: track world coords on pointermove, avoid ptr.worldX getter 2026-03-20 20:45:18 +00:00
d354a26a80 🐛 fix zoom-to-mouse: capture worldX/Y before setZoom 2026-03-20 20:39:53 +00:00
fb4abb7256 🐛 zoom-to-mouse: ptr.worldX/Y formula, debug log still active 2026-03-20 20:37:11 +00:00
0e4c7c96ee 🐛 debug: log mouse+center on zoom, draw red cross at viewport center 2026-03-20 20:34:32 +00:00
cccfd9ba73 ♻️ revert zoom to simple center zoom, remove mouse targeting 2026-03-20 20:21:49 +00:00
216c70dbd9 🐛 zoom-to-mouse: use ptr.worldX/Y + set scroll after setZoom 2026-03-20 20:15:13 +00:00
b5130169bd 🐛 fix zoom: center world point under mouse, then zoom to center 2026-03-20 19:39:15 +00:00
f0065a0cda 🐛 fix zoom-to-mouse using getWorldPoint diff instead of manual formula 2026-03-20 19:29:53 +00:00
715278ae78 zoom to mouse pointer + middle-click pan
- Scroll wheel now zooms toward the mouse cursor instead of screen center
- Middle mouse button held: pan camera by dragging
- Both actions respect current zoom level
2026-03-20 19:19:44 +00:00
c9c8e45b0c 🐛 clear FOREST/ROCK tile after harvest so Nisse can access deeper resources 2026-03-20 17:39:25 +00:00
787ada7cb4 🐛 fix Nisse stuck idle after stockpile deposit; rename Villager → Nisse in UI 2026-03-20 17:07:34 +00:00
8ed67313a8 🐛 fix UI repositioning and mouse coords after window resize 2026-03-20 12:19:57 +00:00
1c450abf2a add right-click context menu with Build and Folks actions 2026-03-20 11:57:09 +00:00
fe389a9856 🎉 initial commit 2026-03-20 08:11:31 +00:00