added pixlJS official skills and the prototype document
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
# Task: PixiJS v8 performance prototype for a virtual tabletop (VTT)
|
||||
|
||||
## Goal
|
||||
Build a throwaway browser prototype that answers one question:
|
||||
**Can PixiJS v8 render a VTT-sized scene smoothly on modest hardware?**
|
||||
This is a measurement tool, not the product. Optimise for clear numbers, not polish.
|
||||
|
||||
## Before you start
|
||||
- Use the PixiJS skills (`pixijs-*`) available to you. Load `pixijs-performance`,
|
||||
`pixijs-scene-graphics`, `pixijs-scene-sprite`, `pixijs-scene-text` and
|
||||
`pixijs-events` before writing code.
|
||||
- PixiJS **v8 only**. If you are unsure whether an API is v7 or v8, check the
|
||||
skills or docs. Do not rely on memory.
|
||||
- If you want a pan/zoom library (e.g. pixi-viewport), first confirm it supports
|
||||
PixiJS v8. If it does not, write minimal pan/zoom yourself.
|
||||
|
||||
## Stack
|
||||
Vite + TypeScript + PixiJS v8. No UI framework: plain HTML controls on top of the canvas.
|
||||
No backend, no multiplayer, no persistence.
|
||||
The machine runs NixOS: do not install anything globally. Use devbox for the
|
||||
toolchain: run `devbox init` in the project directory if there is no `devbox.json`,
|
||||
`devbox add nodejs`, and run every npm command through `devbox run` or inside
|
||||
`devbox shell`. Commit `devbox.json` and `devbox.lock`.
|
||||
|
||||
## Scene to build
|
||||
1. **Map layer**: one large background map.
|
||||
- Default: a procedurally generated map (no external assets needed).
|
||||
- Also a file input to load a real local image.
|
||||
- Selectable sizes: 2048, 4096, 8192, 16384 px square.
|
||||
- Read the GPU's max texture size from the renderer. If the map is bigger,
|
||||
split it into tiles. Show which path is used.
|
||||
2. **Grid layer**: square grid overlay, cell size adjustable, toggle on/off.
|
||||
3. **Token layer**: N circular tokens with a short text label (name + HP).
|
||||
- N adjustable: 50 / 200 / 500 / 1000 / 2000.
|
||||
- Tokens are draggable with the mouse and touch.
|
||||
- A "chaos" toggle that moves all tokens every frame (worst case).
|
||||
- An "HP churn" toggle that changes every label's text every frame.
|
||||
4. **Drawing layer**: freehand pen tool.
|
||||
- While drawing, the stroke must update live.
|
||||
- When the stroke ends, make it cheap to keep around (follow the skills'
|
||||
guidance: e.g. bake to texture, do not keep re-tessellating).
|
||||
- A button to auto-generate 200 random finished strokes for stress testing.
|
||||
5. **Pan and zoom**: mouse wheel + drag, pinch on touch.
|
||||
|
||||
## Measurements (always visible overlay)
|
||||
- FPS and frame time (avg, and worst over the last 2 s).
|
||||
- Renderer in use (WebGL or WebGPU). Add a URL param to force either one.
|
||||
- Current settings (map size, N tokens, strokes count, toggles).
|
||||
- A "Run benchmark" button that runs a fixed scripted scenario
|
||||
(each combination of map size × token count, 5 s each, chaos on)
|
||||
and outputs a results table you can copy (markdown).
|
||||
|
||||
## Acceptance criteria
|
||||
- `npm install && npm run dev` works. `npm run dev -- --host` makes it reachable
|
||||
from a tablet/phone on the LAN.
|
||||
- Every feature above works and can be toggled from the controls.
|
||||
- Benchmark produces a markdown table.
|
||||
- Drawing a long freehand stroke stays responsive, and 200 finished strokes do
|
||||
not noticeably lower FPS compared with 0 strokes. If not, report why.
|
||||
|
||||
## Deliverables
|
||||
- The prototype source in a new directory.
|
||||
- `README.md` with: how to run, how to test on mobile, your benchmark table from
|
||||
your own machine, and a short **Findings** section: what was smooth, what was
|
||||
slow, which PixiJS technique fixed each slow case, and anything that would
|
||||
worry you for a real VTT.
|
||||
|
||||
## Out of scope (do not build)
|
||||
Multiplayer, server, fog of war, lighting, saving/loading scenes, UI framework,
|
||||
character sheets, dice, tests beyond the benchmark.
|
||||
Reference in New Issue
Block a user