Initial Commit
This commit is contained in:
66
openspec/changes/enterprise-gaming-r3f-combat/proposal.md
Normal file
66
openspec/changes/enterprise-gaming-r3f-combat/proposal.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# OpenSpec Change: enterprise-gaming-r3f-combat
|
||||
|
||||
- **Change ID**: enterprise-gaming-r3f-combat
|
||||
- **Package**: `@suaveplan/r3f-combat`
|
||||
- **Category**: gaming/gameplay
|
||||
- **Target path**: `gaming/gameplay/r3f-combat`
|
||||
- **Status**: PROPOSED
|
||||
- **Date**: 2026-04-24
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
Deliver `@suaveplan/r3f-combat` on the genesis branch from scratch at enterprise quality. The package is the R3F rendering layer for `@suaveplan/combat`: hitbox debug wireframes (per-bone capsule/sphere overlays toggled by flag), projectile trail meshes (instanced `TubeGeometry` with fade-out), muzzle flash billboard sprites, impact effect particle bursts (pooled instanced meshes), and floating damage numbers (billboarded Text via `@react-three/drei`). All effects are event-driven, subscribing to `@suaveplan/combat` and `@suaveplan/weapons` event buses. Genesis adds 100% coverage and Storybook stories.
|
||||
|
||||
---
|
||||
|
||||
## Available workspace deps
|
||||
|
||||
`@suaveplan/combat`, `@suaveplan/weapons`, `@suaveplan/hitbox`, `@suaveplan/error`, `@suaveplan/types`, react, `@react-three/fiber`, `@react-three/drei`, three.
|
||||
|
||||
---
|
||||
|
||||
## Public API surface
|
||||
|
||||
```ts
|
||||
function HitboxDebug(props: HitboxDebugProps): JSX.Element
|
||||
// entityId, color, opacity, visible
|
||||
|
||||
function ProjectileTrails(props: ProjectileTrailsProps): JSX.Element
|
||||
// maxTrails, fadeTime, color
|
||||
|
||||
function MuzzleFlash(props: MuzzleFlashProps): JSX.Element
|
||||
// weaponRef, duration, intensity
|
||||
|
||||
function ImpactEffects(props: ImpactEffectsProps): JSX.Element
|
||||
// poolSize, particleCount, gravity
|
||||
|
||||
function DamageNumbers(props: DamageNumbersProps): JSX.Element
|
||||
// floatHeight, duration, criticalColor, normalColor
|
||||
|
||||
function CombatEffectsProvider(props: PropsWithChildren): JSX.Element
|
||||
// subscribes to combat events; required ancestor
|
||||
|
||||
function useCombatEffects(): CombatEffectsCon```text
|
||||
|
||||
---
|
||||
|
||||
## File layout
|
||||
|
||||
```text
|
||||
gaming/gameplay/r3f-combat/
|
||||
package.json / tsconfig.json / vitest.config.ts
|
||||
src/
|
||||
index.ts / error-codes.ts
|
||||
types/common.ts + md
|
||||
context/combat-effects-provider.tsx + md + test
|
||||
hooks/use-combat-effects.ts + md + test
|
||||
components/
|
||||
HitboxDebug/ (tsx + md + test + stories + index)
|
||||
ProjectileTrails/ (tsx + md + test + stories + index)
|
||||
MuzzleFlash/ (tsx + md + test + stories + index)
|
||||
ImpactEffects/ (tsx + md + test + stories + index)
|
||||
DamageNumbers/ (tsx + md + test + stories + index)
|
||||
tests/integration.test.ts
|
||||
```
|
||||
41
openspec/changes/enterprise-gaming-r3f-combat/tasks.md
Normal file
41
openspec/changes/enterprise-gaming-r3f-combat/tasks.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Tasks: enterprise-gaming-r3f-combat
|
||||
|
||||
## 0. Pre-flight (non-negotiable)
|
||||
|
||||
- [ ] 0.1 Confirm clean working tree (`git status` reports nothing) and no in-flight worktrees with uncommitted work (`git worktree list` then `git status` in each)
|
||||
- [ ] 0.2 If any worktrees exist under `.claude/worktrees/`, account for each one: still-active agent, work-pending-merge, or stale-and-prune. Stale worktrees MUST be removed (`git worktree remove`) before opening a new one — code that has been lost twice on main is the failure mode this guards against.
|
||||
- [ ] 0.3 Confirm the package set in `MANIFEST.md` matches `find packages -maxdepth 3 -name package.json` count. Drift here means a prior change archived without regenerating the manifest.
|
||||
|
||||
## Phase 1 — Scaffold
|
||||
|
||||
- [ ] Create `gaming/gameplay/r3f-combat/` (`@suaveplan/r3f-combat`, `0.1.0`, `sideEffects: false`)
|
||||
|
||||
## Phase 2 — Types + error codes
|
||||
|
||||
- [ ] `src/types/common.ts` + `common.md`
|
||||
- [ ] `src/error-codes.ts`
|
||||
|
||||
## Phase 3 — Context + hook
|
||||
|
||||
- [ ] `CombatEffectsProvider` — subscribes to combat/weapons event buses
|
||||
- [ ] `useCombatEffects` hook
|
||||
- [ ] Tests + docs
|
||||
|
||||
## Phase 4 — Components
|
||||
|
||||
- [ ] `HitboxDebug` — per-bone capsule/sphere wireframe overlays
|
||||
- [ ] `ProjectileTrails` — instanced TubeGeometry with fade-out
|
||||
- [ ] `MuzzleFlash` — billboard sprite with duration/intensity
|
||||
- [ ] `ImpactEffects` — pooled instanced particle bursts
|
||||
- [ ] `DamageNumbers` — billboarded floating Text via drei
|
||||
- [ ] Tests + Storybook stories for each
|
||||
|
||||
## Phase 5 — Integration tests
|
||||
|
||||
- [ ] `tests/integration.test.ts` — event-driven effect lifecycle
|
||||
|
||||
## Phase 6 — Pre-publish gate
|
||||
|
||||
- [ ] `bunx turbo lint typecheck test --filter=@suaveplan/r3f-combat` green
|
||||
- [ ] 100% coverage
|
||||
- [ ] Publish: `bun scripts/publish.ts --package @suaveplan/r3f-combat`
|
||||
Reference in New Issue
Block a user