Documentation
¶
Overview ¶
Package engine is the root of the Weakpixel Engine module: a small 2D game engine built on the ecs module and Ebiten. It holds no code; the Engine Runtime is the packages below it.
Only the packages named below import Ebiten; the ecs packages never do. The pieces, in dependency order:
- gfx: plain-data components and value types. No Ebiten import; imports only the asset module (for handle types).
- asset/library: the asset library layout over the asset module (github.com/weakpixel/asset: stores, background loading, scopes).
- render: Ebiten renderer working on a queue of draw items, and the Ebiten asset types and loaders (textures, atlases, fonts, shaders) for asset. No ecs import.
- extract: systems that turn components into queue items during Update.
- input: actions, bindings files, players, rebinding. Stdlib only; input/ebiteninput reads Ebiten, input/inputsys is the ECS glue.
- game: the Engine, which wires all of the above.
See doc/guide/engine/rendering.md ("The frame contract") for the Update/Draw contract.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package anim plays sprite animations from Aseprite exports.
|
Package anim plays sprite animations from Aseprite exports. |
|
animbody
Package animbody keeps animated colliders in step with their animation: an entity whose collision.Collider has the shape collision.ShapeAnimBody takes its Offset and Size from the Body of the clip its gfx.Animator plays.
|
Package animbody keeps animated colliders in step with their animation: an entity whose collision.Collider has the shape collision.ShapeAnimBody takes its Offset and Size from the Body of the clip its gfx.Animator plays. |
|
animfile
Package animfile reads and checks the file formats package anim loads, without Ebiten, the ECS or any GPU work: the Aseprite sprite sheet export (DecodeSheet) and the *.anim.json animation definition (Decode, Encode, Resolve).
|
Package animfile reads and checks the file formats package anim loads, without Ebiten, the ECS or any GPU work: the Aseprite sprite sheet export (DecodeSheet) and the *.anim.json animation definition (Decode, Encode, Resolve). |
|
asset
|
|
|
library
Package library is the opt-in standard asset library: every top folder of the asset root is a package (a collection of assets that loads, mounts and packs together), loaded into an asset.Scope the caller owns, with a catalog for file systems that cannot list directories and zip packs that are mounted while a scope that loaded them holds them.
|
Package library is the opt-in standard asset library: every top folder of the asset root is a package (a collection of assets that loads, mounts and packs together), loaded into an asset.Scope the caller owns, with a catalog for file systems that cannot list directories and zip packs that are mounted while a scope that loaded them holds them. |
|
Package assetkind is the registry of asset kinds: the names a component field carries in its +game:asset:kind=...
|
Package assetkind is the registry of asset kinds: the names a component field carries in its +game:asset:kind=... |
|
Package camera is a quick-start follow camera: mark an entity with a Target, pick a FollowMode in a Rig and run the System in the camera stage; it moves the render.Camera after the target every tick.
|
Package camera is a quick-start follow camera: mark an entity with a Target, pick a FollowMode in a Rig and run the System in the camera stage; it moves the render.Camera after the target every tick. |
|
+game:group:name=collision
|
+game:group:name=collision |
|
Package editor is the core of the Weakpixel level editor: a game.Tool that edits one GOD level of a running game.
|
Package editor is the core of the Weakpixel level editor: a game.Tool that edits one GOD level of a running game. |
|
animedit
Package animedit is the "anim" tool of wpix-editor: an editor for *.anim.json animation definitions (doc/guide/engine/animation.md).
|
Package animedit is the "anim" tool of wpix-editor: an editor for *.anim.json animation definitions (doc/guide/engine/animation.md). |
|
bridge
Package bridge connects an editor.Session to a host over JSON messages: the VSCode extension (through the webview, see transport_js.go) or, in tests, a fake.
|
Package bridge connects an editor.Session to a host over JSON messages: the VSCode extension (through the webview, see transport_js.go) or, in tests, a fake. |
|
camzoom
Package camzoom is the wheel zoom of the editors' cameras: each wheel unit scales the zoom by a fixed factor (so a trackpad's small deltas zoom slowly and a mouse notch a little), and the camera eases toward the target zoom around the cursor instead of jumping.
|
Package camzoom is the wheel zoom of the editors' cameras: each wheel unit scales the zoom by a fixed factor (so a trackpad's small deltas zoom slowly and a mouse notch a little), and the camera eases toward the target zoom around the cursor instead of jumping. |
|
filekind
Package filekind is the one list of the file kinds wpix-editor opens: the name suffixes of each kind, whether it is edited or previewed and whether it has sound.
|
Package filekind is the one list of the file kinds wpix-editor opens: the name suffixes of each kind, whether it is edited or previewed and whether it has sound. |
|
fxedit
Package fxedit is the "fx" tool of wpix-editor: it makes a particle effect, an *.fx.json file (package particles), without knowing which components are involved.
|
Package fxedit is the "fx" tool of wpix-editor: it makes a particle effect, an *.fx.json file (package particles), without knowing which components are involved. |
|
host
Package host is the entry point of a game's editor build.
|
Package host is the entry point of a game's editor build. |
|
hostlink
Package hostlink is what a game or tool that runs under an editor host shares with that host, whichever protocol it speaks: the protocol version, the transport interface, the connection to the host page of a browser build, and the settings the host passes (stage, first file, whether it is untitled, asset root, file index).
|
Package hostlink is what a game or tool that runs under an editor host shares with that host, whichever protocol it speaks: the protocol version, the transport interface, the connection to the host page of a browser build, and the settings the host passes (stage, first file, whether it is untitled, asset root, file index). |
|
sheetedit
Package sheetedit is the "sheet" tool of wpix-editor: an editor for *.sheet.json grid sheets (doc/guide/engine/asset-kinds.md#grid-sheet).
|
Package sheetedit is the "sheet" tool of wpix-editor: an editor for *.sheet.json grid sheets (doc/guide/engine/asset-kinds.md#grid-sheet). |
|
shotproto
Package shotproto is the screenshot message pair both editor protocols share, the level editor's bridge and the tool shell: a host asks for a capture with a "screenshot" request, the game answers with a "screenshot" message that carries the PNG.
|
Package shotproto is the screenshot message pair both editor protocols share, the level editor's bridge and the tool shell: a host asks for a capture with a "screenshot" request, the game answers with a "screenshot" message that carries the PNG. |
|
toolshell
Package toolshell is the shell the wpix-editor tools run on: a game.Tool on an engine with no game systems, so assets load through the engine's asset server and the content is drawn by the engine's renderer.
|
Package toolshell is the shell the wpix-editor tools run on: a game.Tool on an engine with no game systems, so assets load through the engine's asset server and the content is drawn by the engine's renderer. |
|
toolshell/debugpanel
Package debugpanel draws a toolshell.Panel with debugui, in the native window of wpix-editor.
|
Package debugpanel draws a toolshell.Panel with debugui, in the native window of wpix-editor. |
|
viewer
Package viewer is the "view" tool of wpix-editor: it previews every file kind of package filekind that is not edited, with the engine's own loaders.
|
Package viewer is the "view" tool of wpix-editor: it previews every file kind of package filekind that is not edited, with the engine's own loaders. |
|
viewkit
Package viewkit holds what the wpix-editor tools that show a texture share: the texture sprite kept on screen (Texture), the frames over it with hover, selection, labels and a list to pick from (Frames), and the overlay text in window pixels (Labels).
|
Package viewkit holds what the wpix-editor tools that show a texture share: the texture sprite kept on screen (Texture), the frames over it with hover, selection, labels and a list to pick from (Frames), and the overlay text in window pixels (Labels). |
|
voiceview
Package voiceview is the voice and dialogue previewer of wpix-editor, routed by package viewer: a read-only preview with sound of the files of package speech.
|
Package voiceview is the voice and dialogue previewer of wpix-editor, routed by package viewer: a read-only preview with sound of the files of package speech. |
|
Package extract connects the ecs World to the renderer.
|
Package extract connects the ecs World to the renderer. |
|
Package game is the high-level entry point of the engine: an Engine implements ebiten.Game and owns the plumbing that every game otherwise wires by hand (World, asset server and loaders, renderer, camera, the extract schedule, audio, GOD resolver, level loading).
|
Package game is the high-level entry point of the engine: an Engine implements ebiten.Game and owns the plumbing that every game otherwise wires by hand (World, asset server and loaders, renderer, camera, the extract schedule, audio, GOD resolver, level loading). |
|
gametest
Package gametest runs a game headless and steps it tick by tick, for tests that must give the same result on every machine.
|
Package gametest runs a game headless and steps it tick by tick, for tests that must give the same result on every machine. |
|
+game:group:name=gfx
|
+game:group:name=gfx |
|
Package goscript is the core of goscript, the scripting language of the Weakpixel engine: a small, dynamically typed language with Go syntax, compiled to bytecode and run on a register VM.
|
Package goscript is the core of goscript, the scripting language of the Weakpixel engine: a small, dynamically typed language with Go syntax, compiled to bytecode and run on a register VM. |
|
+game:group:name=hierarchy
|
+game:group:name=hierarchy |
|
Package input turns keyboard, mouse, gamepad and touch input into named actions.
|
Package input turns keyboard, mouse, gamepad and touch input into named actions. |
|
ebiteninput
Package ebiteninput is the Ebiten input.Source: it reads keyboard, mouse, gamepads and touches through ebiten and inpututil into an input.Frame once per tick.
|
Package ebiteninput is the Ebiten input.Source: it reads keyboard, mouse, gamepads and touches through ebiten and inpututil into an input.Frame once per tick. |
|
inputsys
Package inputsys connects an input.Router to an ecs World: InputSystem updates the router once per tick and publishes it as a resource, and TouchControlsExtract draws the virtual touch controls.
|
Package inputsys connects an input.Router to an ecs World: InputSystem updates the router once per tick and publishes it as a resource, and TouchControlsExtract draws the virtual touch controls. |
|
internal
|
|
|
marker
Package marker parses controller-tools style markers, `+name` comments on Go declarations, into user-defined structs.
|
Package marker parses controller-tools style markers, `+name` comments on Go declarations, into user-defined structs. |
|
marker/enum
Package enum lists the constants of a Go enum type: the exported package-level constants of exactly one named integer type.
|
Package enum lists the constants of a Go enum type: the exported package-level constants of exactly one named integer type. |
|
shaderparam
Package shaderparam reads the `+shader:param` markers of a Kage shader: the labelled controls (a slider, a toggle, an angle, a color) that tell an editor what each slot of a sprite's Params array means.
|
Package shaderparam reads the `+shader:param` markers of a Kage shader: the labelled controls (a slider, a toggle, an angle, a color) that tell an editor what each slot of a sprite's Params array means. |
|
Package jsonedit makes minimal text edits to a JSON document: it finds the value at a path and replaces, inserts or deletes it while every other byte of the document stays as it was, including indentation, key order and line ends.
|
Package jsonedit makes minimal text edits to a JSON document: it finds the value at a path and replaces, inserts or deletes it while every other byte of the document stays as it was, including indentation, key order and line ends. |
|
Package particles loads particle effects (*.fx.json files), simulates them and draws them.
|
Package particles loads particle effects (*.fx.json files), simulates them and draws them. |
|
fxfile
Package fxfile reads, checks and writes the *.fx.json particle effect file, without Ebiten, the ECS runtime or any GPU work: the authored emitters (Emitter, Spec), Decode and Encode.
|
Package fxfile reads, checks and writes the *.fx.json particle effect file, without Ebiten, the ECS runtime or any GPU work: the authored emitters (Emitter, Spec), Decode and Encode. |
|
+game:group:name=physics
|
+game:group:name=physics |
|
Package prefab makes prefabs (pre-defined Game Objects, `*.prefab.json`) assets of the engine.
|
Package prefab makes prefabs (pre-defined Game Objects, `*.prefab.json`) assets of the engine. |
|
Package project loads .weakpixel.json, the project settings file that gives the tools (`wpix gen`, `wpix doc`, `wpix mcp`, `wpix-editor`) and editor hosts their defaults.
|
Package project loads .weakpixel.json, the project settings file that gives the tools (`wpix gen`, `wpix doc`, `wpix mcp`, `wpix-editor`) and editor hosts their defaults. |
|
Package render draws a queue of plain draw items with Ebiten.
|
Package render draws a queue of plain draw items with Ebiten. |
|
Package resolver connects Game Object data to the asset system.
|
Package resolver connects Game Object data to the asset system. |
|
+game:group:name=room
|
+game:group:name=room |
|
+game:group:name=script
|
+game:group:name=script |
|
Package sheetfile is the grid sheet format, *.sheet.json: fixed-size cells over one image (doc/guide/engine/asset-kinds.md#grid-sheet).
|
Package sheetfile is the grid sheet format, *.sheet.json: fixed-size cells over one image (doc/guide/engine/asset-kinds.md#grid-sheet). |
|
Package sound plays sound effects and music.
|
Package sound plays sound effects and music. |
|
+game:group:name=speech
|
+game:group:name=speech |
|
Package tiled reads the Tiled JSON formats (https://doc.mapeditor.org/en/stable/reference/json-map-format/): maps (*.tmj, DecodeMap), external tilesets (*.tsj, DecodeTileset) and worlds (*.world, DecodeWorld).
|
Package tiled reads the Tiled JSON formats (https://doc.mapeditor.org/en/stable/reference/json-map-format/): maps (*.tmj, DecodeMap), external tilesets (*.tsj, DecodeTileset) and worlds (*.world, DecodeWorld). |
|
Package tilemap loads Tiled maps as assets and draws their tile and image layers through the render queue.
|
Package tilemap loads Tiled maps as assets and draws their tile and image layers through the render queue. |
|
tools
|
|
|
internal/anim
Package anim implements `wpix anim`.
|
Package anim implements `wpix anim`. |
|
internal/assets
Package assets implements `wpix assets`.
|
Package assets implements `wpix assets`. |
|
internal/cli
Package cli is what the Cobra command trees of the wpix binaries share: the exit codes (0 ok, 1 failure, 2 usage), the error type that means a usage error, and the version command.
|
Package cli is what the Cobra command trees of the wpix binaries share: the exit codes (0 ok, 1 failure, 2 usage), the error type that means a usage error, and the version command. |
|
internal/devserver
Package devserver implements `wpix serve`: a static file server for a browser game's development build that pushes asset changes to the open page.
|
Package devserver implements `wpix serve`: a static file server for a browser game's development build that pushes asset changes to the open page. |
|
internal/framelog
Package framelog implements `wpix framelog`.
|
Package framelog implements `wpix framelog`. |
|
internal/gen
Package gen implements `wpix gen`.
|
Package gen implements `wpix gen`. |
|
internal/goddoc
Package goddoc implements `wpix doc`.
|
Package goddoc implements `wpix doc`. |
|
internal/mcp
Package mcp is a small Model Context Protocol server over stdio: JSON-RPC 2.0 framing (one message per line), the lifecycle of the protocol revisions 2026-07-28 (stateless, server/discover) and 2025-11-25 (initialize handshake), and a registry of tools.
|
Package mcp is a small Model Context Protocol server over stdio: JSON-RPC 2.0 framing (one message per line), the lifecycle of the protocol revisions 2026-07-28 (stateless, server/discover) and 2025-11-25 (initialize handshake), and a registry of tools. |
|
internal/mcpserver
Package mcpserver implements `wpix mcp`: an MCP server over stdio that lets an AI agent read and edit a weakpixel game project (components, object types, assets, levels and prefabs).
|
Package mcpserver implements `wpix mcp`: an MCP server over stdio that lets an AI agent read and edit a weakpixel game project (components, object types, assets, levels and prefabs). |
|
internal/newgame
Package newgame implements "wpix new": it creates a game module that runs, tests, regenerates, builds for the browser and opens in the VSCode level editor (doc/guide/tools.md#new).
|
Package newgame implements "wpix new": it creates a game module that runs, tests, regenerates, builds for the browser and opens in the VSCode level editor (doc/guide/tools.md#new). |
|
internal/schema
Package schema implements `wpix schema`.
|
Package schema implements `wpix schema`. |
|
internal/tileset
Package tileset implements `wpix tileset`: tools that turn images into Tiled tilesets the engine loads (doc/guide/engine/tilemaps.md).
|
Package tileset implements `wpix tileset`: tools that turn images into Tiled tilesets the engine loads (doc/guide/engine/tilemaps.md). |
|
wpix
command
Command wpix is the single command-line entry point of the engine's tools.
|
Command wpix is the single command-line entry point of the engine's tools. |
|
wpix-editor
command
Command wpix-editor runs the visual editors of the engine on a shared shell:
|
Command wpix-editor runs the visual editors of the engine on a shared shell: |
|
wpix-editor/cmd
Package cmd is the command line of wpix-editor: one command that opens a file in the tool of its kind (editorapp.Kinds).
|
Package cmd is the command line of wpix-editor: one command that opens a file in the tool of its kind (editorapp.Kinds). |
|
wpix-editor/internal/editorapp
Package editorapp is what the native and the js/wasm wpix-editor share: the kind table and the resolution of a file to its asset root and key.
|
Package editorapp is what the native and the js/wasm wpix-editor share: the kind table and the resolution of a file to its asset root and key. |
|
wpix-editor/internal/native
Package native is the wpix-editor window: the tool's panel drawn by debugui in an Ebiten window.
|
Package native is the wpix-editor window: the tool's panel drawn by debugui in an Ebiten window. |
|
wpix/cmd
Package cmd is the command line of wpix: one subcommand per tool in tools/internal.
|
Package cmd is the command line of wpix: one subcommand per tool in tools/internal. |
|
Package tween animates component fields over time: "move this enemy to (120, 40) with OutBack in 0.4 seconds", "pulse this coin forever", "ease the HP bar to the new value".
|
Package tween animates component fields over time: "move this enemy to (120, 40) with OutBack in 0.4 seconds", "pulse this coin forever", "ease the HP bar to the new value". |
|
Package xmath is the float32 math a 2D game needs: Vec2 and Rect, scalar helpers (clamp, lerp, remap, wrap, snap), angles, frame-rate independent smoothing and springs, and the Penner easing curves.
|
Package xmath is the float32 math a 2D game needs: Vec2 and Rect, scalar helpers (clamp, lerp, remap, wrap, snap), angles, frame-rate independent smoothing and springs, and the Penner easing curves. |