---
name: NPC encounter system
description: NPC interaction endpoints, wandering merchant alms, towns in InitHero, bigger town radii — added 2026-03-27
type: project
---

NPC encounter system added with handler/npc.go (NPCHandler) serving 5 new endpoints under /api/v1/hero/npc-*.

**Why:** Frontend needs to render towns with NPCs on the map, allow hero interaction with quest_giver/merchant/healer NPCs, and support random wandering merchant encounters on the road.

**How to apply:** NPC handler is separate from GameHandler; quest_store gained GetNPCByID, ListAllNPCs, ListQuestsByNPCForHeroLevel. InitHero response now includes "towns" field with nested NPCs. RequestEncounter has 10% NPC event roll. Migration 000012 increases town radii.
