Initial Commit
This commit is contained in:
65
openspec/changes/enterprise-gaming-r3f-minimap/proposal.md
Normal file
65
openspec/changes/enterprise-gaming-r3f-minimap/proposal.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# OpenSpec Change: enterprise-gaming-r3f-minimap
|
||||
|
||||
- **Change ID**: enterprise-gaming-r3f-minimap
|
||||
- **Package**: `@suaveplan/r3f-minimap`
|
||||
- **Category**: gaming/gameplay
|
||||
- **Target path**: `gaming/gameplay/r3f-minimap`
|
||||
- **Status**: PROPOSED
|
||||
- **Date**: 2026-04-24
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
Deliver `@suaveplan/r3f-minimap` on the genesis branch from scratch at enterprise quality. The package renders a real-time minimap inside React Three Fiber using an offscreen orthographic camera rendering to a `WebGLRenderTarget`: `MinimapCamera` drives the render target, `MinimapRenderer` composites the texture onto a `<Html>` or `<Plane>` overlay, `EntityMarkers` places icons/dots for tracked entities, `FogOfWarLayer` masks unexplored areas with a canvas-painted alpha texture, and `useMinimapRegion` exposes world-to-map coordinate conversion. Genesis adds 100% coverage and Storybook stories.
|
||||
|
||||
---
|
||||
|
||||
## Available workspace deps
|
||||
|
||||
`@suaveplan/error`, `@suaveplan/types`, `@suaveplan/events`, react, `@react-three/fiber`, `@react-three/drei`, three.
|
||||
|
||||
---
|
||||
|
||||
## Public API surface
|
||||
|
||||
```ts
|
||||
interface MinimapOptions {
|
||||
worldSize: number // world units covered
|
||||
resolution: number // render target px
|
||||
rotation?: number // map rotation offset
|
||||
zoom?: number
|
||||
}
|
||||
|
||||
function MinimapProvider(props: MinimapProviderProps): JSX.Element
|
||||
function MinimapRenderer(props: MinimapRendererProps): JSX.Element
|
||||
// size (CSS px), border, shape: 'circle' | 'square'
|
||||
|
||||
function EntityMarkers(props: EntityMarkersProps): JSX.Element
|
||||
// entities: TrackedEntity[], iconMap
|
||||
|
||||
function FogOfWarLayer(props: FogOfWarLayerProps): JSX.Element
|
||||
// revealRadius, color, opacity
|
||||
|
||||
function useMinimapRegion(): MinimapRegionContext
|
||||
// worldToMap(v3): Vector2, mapToWorld(v2): Vector3, revealAt(v3, radius)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## File layout
|
||||
|
||||
```text
|
||||
gaming/gameplay/r3f-minimap/
|
||||
package.json / tsconfig.json / vitest.config.ts
|
||||
src/
|
||||
index.ts / error-codes.ts
|
||||
types/common.ts + md
|
||||
context/minimap-provider.tsx + md + test
|
||||
hooks/use-minimap-region.ts + md + test
|
||||
components/
|
||||
MinimapRenderer/ (tsx + md + test + stories + index)
|
||||
EntityMarkers/ (tsx + md + test + stories + index)
|
||||
FogOfWarLayer/ (tsx + md + test + stories + index)
|
||||
tests/integration.test.ts
|
||||
```
|
||||
39
openspec/changes/enterprise-gaming-r3f-minimap/tasks.md
Normal file
39
openspec/changes/enterprise-gaming-r3f-minimap/tasks.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Tasks: enterprise-gaming-r3f-minimap
|
||||
|
||||
## 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-minimap/` (`@suaveplan/r3f-minimap`, `0.1.0`, `sideEffects: false`)
|
||||
|
||||
## Phase 2 — Types + error codes
|
||||
|
||||
- [ ] `src/types/common.ts` + `common.md`
|
||||
- [ ] `src/error-codes.ts`
|
||||
|
||||
## Phase 3 — Context + hook
|
||||
|
||||
- [ ] `MinimapProvider` — offscreen orthographic camera + WebGLRenderTarget
|
||||
- [ ] `useMinimapRegion` — worldToMap, mapToWorld, revealAt
|
||||
- [ ] Tests + docs
|
||||
|
||||
## Phase 4 — Components
|
||||
|
||||
- [ ] `MinimapRenderer` — composites render target onto Html/Plane overlay
|
||||
- [ ] `EntityMarkers` — icon/dot rendering for tracked entities
|
||||
- [ ] `FogOfWarLayer` — canvas-painted alpha mask for unexplored areas
|
||||
- [ ] Tests + Storybook stories for each
|
||||
|
||||
## Phase 5 — Integration tests
|
||||
|
||||
- [ ] `tests/integration.test.ts` — coordinate conversion, fog reveal
|
||||
|
||||
## Phase 6 — Pre-publish gate
|
||||
|
||||
- [ ] `bunx turbo lint typecheck test --filter=@suaveplan/r3f-minimap` green
|
||||
- [ ] 100% coverage
|
||||
- [ ] Publish: `bun scripts/publish.ts --package @suaveplan/r3f-minimap`
|
||||
Reference in New Issue
Block a user