Files
suaveplan/openspec/changes/enterprise-gaming-r3f-npc/proposal.md
2026-05-27 23:29:53 +01:00

61 lines
2.1 KiB
Markdown

# OpenSpec Change: enterprise-gaming-r3f-npc
- **Change ID**: enterprise-gaming-r3f-npc
- **Package**: `@suaveplan/r3f-npc`
- **Category**: gaming/gameplay
- **Target path**: `gaming/gameplay/r3f-npc`
- **Status**: PROPOSED
- **Date**: 2026-04-24
---
## Summary
Deliver `@suaveplan/r3f-npc` on the genesis branch from scratch at enterprise quality. The package is the R3F rendering layer for `@suaveplan/npc`: `NpcMesh` composing `@suaveplan/r3f-character` locomotion with NPC state from the NpcRegistry, `BehaviorTreeDebug` overlay visualizing node states (running/success/failure) in a floating tree panel, `NpcNameplate` billboarded nameplate with health bar and status icon, `DialogueTrigger` component showing proximity-based interaction prompt and wiring into `@suaveplan/dialogue`, and `NpcMarker` minimap dot. Genesis adds 100% coverage and Storybook stories.
---
## Available workspace deps
`@suaveplan/npc`, `@suaveplan/behavior-tree`, `@suaveplan/dialogue`, `@suaveplan/r3f-character`, `@suaveplan/r3f-ui`, `@suaveplan/error`, `@suaveplan/types`, react, `@react-three/fiber`, `@react-three/drei`, three.
---
## Public API surface
```ts
function NpcMesh(props: NpcMeshProps): JSX.Element
// npcId, model, showNameplate, showDebug
function BehaviorTreeDebug(props: BehaviorTreeDebugProps): JSX.Element
// treeRef, visible, position
function NpcNameplate(props: NpcNameplateProps): JSX.Element
// name, health, maxHealth, statusIcon
function DialogueTrigger(props: DialogueTriggerProps): JSX.Element
// npcId, triggerRadius, prompt
function NpcMarker(props: NpcMarkerProps): JSX.Element
// npcId, icon, color
```
---
## File layout
```text
gaming/gameplay/r3f-npc/
package.json / tsconfig.json / vitest.config.ts
src/
index.ts / error-codes.ts
types/common.ts + md
components/
NpcMesh/ (tsx + md + test + stories + index)
BehaviorTreeDebug/ (tsx + md + test + stories + index)
NpcNameplate/ (tsx + md + test + stories + index)
DialogueTrigger/ (tsx + md + test + stories + index)
NpcMarker/ (tsx + md + test + stories + index)
tests/integration.test.ts
```