Assets
All visual assets in Pixel Agents are fully open-source and included in the repository under webview-ui/public/assets/. The asset system covers four categories:
- Characters — Agent avatars with walk, typing, and reading animations
- Furniture — Desks, chairs, electronics, decor, and more
- Walls — Auto-tiling wall pieces with bitmask-based variant selection
- Floors — Grayscale pattern tiles with HSL colorization
Asset Loading Pipeline
Assets are loaded by the extension host from disk, decoded into SpriteData (2D arrays of hex color strings), and sent to the webview via messages. The load order is:
- Character sprites (
characterSpritesLoaded) - Floor tiles (
floorTilesLoaded) - Wall tiles (
wallTilesLoaded) - Furniture assets (
furnitureAssetsLoaded) - Layout data (
layoutLoaded)
Each asset type has its own decoder in shared/assets/pngDecoder.ts that converts raw PNG buffers into the common SpriteData format:
type SpriteData = string[][] // [row][col] of hex color strings
// '' = transparent
// '#RRGGBB' = opaque
// '#RRGGBBAA' = semi-transparent
Sprite Rendering
All sprites are rendered to cached HTMLCanvasElement instances per zoom level, with imageSmoothingEnabled = false for pixel-perfect scaling. A depth-sorting system (zY coordinate) ensures correct overlap between furniture, walls, and characters.
Colorization
Both walls and floors support HSL colorization via a Photoshop-style colorize mode:
interface FloorColor {
h: number // Hue: 0–360
s: number // Saturation: 0–100
b: number // Brightness: -100 to +100
c: number // Contrast: -100 to +100
colorize?: boolean
}
Colorized sprites are cached by a composite key to avoid redundant computation.
External Asset Directories
You can load additional assets from external directories without modifying the built-in ones:
- Open Settings in the Pixel Agents panel
- Click Add Asset Directory
- Select the folder containing your custom assets
This supports third-party furniture packs and custom asset collections.