Files
aego/docs/web-capabilities.md

50 lines
2.7 KiB
Markdown

# Web capabilities
What the browser build (`GOOS=js GOARCH=wasm`, `platform/web` + `gpu/webgl2`) supports compared with the native build. Decisions: D289, D290.
## Platform
| Feature | Web | Notes |
|---|---|---|
| Window | works | one canvas; size from CSS, pixels from `devicePixelRatio` |
| Resize, DPI change | works | ResizeObserver, `resize`, DPR check every frame |
| Keyboard | works | `code` → scancode; browser shortcuts (Ctrl/Cmd, F5, F11, F12) stay with the browser |
| Text input | degraded | single characters only, no IME composition |
| Mouse | works | pointer capture while a button is held |
| Wheel | works | 100 px = one line; trackpads are precise |
| Pointer lock | degraded | granted on the next click or key press after the request |
| Touch | degraded | primary pointer as the left button; multi-touch in Stage 18 |
| Gamepads | works | standard mapping; Chrome reports a pad only after a button press |
| Focus loss | works | held keys and buttons are released |
| Hidden tab | works | the real clock stops, `requestAnimationFrame` stops |
| Frame pacing | degraded | always VSync; no frame limiter |
| Fullscreen | degraded | entered on the next click or key press |
| Display modes, monitors | missing | the display module has nothing to apply |
| Clipboard write | works | `navigator.clipboard.writeText` (secure contexts) |
| Clipboard read | degraded | only what was pasted into the page or copied by the game |
| Cursors | works | CSS cursor names |
| Drag and drop of files | missing | |
| Player profile, saves | works | `localStorage`, limited to a few MB; a full store reports a write error |
| Files outside the bundle | missing | no OS file system |
## GPU
| Feature | Web | Notes |
|---|---|---|
| Buffers, instancing | works | |
| Textures RGBA8, SRGB8_ALPHA8, R8 | works | |
| RGBA16F | degraded | renderable only with `EXT_color_buffer_float` |
| Depth24/stencil8 targets | works | |
| sRGB output | works | offscreen backbuffer plus an encoding pass |
| Samplers, mipmaps | works | |
| Scissor, viewport, blend, cull | works | |
| ReadPixels | works | targets only; the canvas is not read back |
| GPU timer | degraded | needs `EXT_disjoint_timer_query_webgl2`, empty otherwise |
| Debug output, object labels | missing | `Options.Debug` checks `getError` after creation calls |
| Context loss | works | objects are recreated from CPU copies; textures cost twice the memory |
| Shaders | works | GLSL ES 3.00 copies generated by `make shaders` |
## Exported games
`aego export --target web` (D295) runs the same runtime as the desktop export on this platform and GPU backend. Differences from desktop: data is loaded into memory before the game starts, there are no log files or crash bundles, saves and settings share the site's `localStorage` quota.