Ebitengineer logo

Ebitengineer

Community
danicat
ebitengineer

Engineering architecture and best practices for building 2D games in Go using Ebitengine (v2). Covers modular game architecture, scene state machines, virtual resolution scaling, delta-time physics, zero-allocation draw loops, Kage shaders, and WebAssembly audio synchronization. Activate when designing, building, optimizing, or debugging 2D games in Go, implementing game systems with Ebitengine, or compiling games to WebAssembly.

Overview

Publisherdanicat
Repositoryskills
Skill nameebitengineer
Stars
24
Forks
4
Bundled files
11
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 11 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by danicat on GitHub. Read the source before you install it.

Installation

Install the Ebitengineer AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/danicat/skills/tree/main/game-dev/ebitengineer
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/danicat/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/game-dev/ebitengineer .claude/skills/ebitengineer
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Ebitengineer in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Ebitengineer on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Ebitengineer is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Ebitengine 2D Game Development Guide (ebitengineer)

Comprehensive, genre-agnostic engineering guidelines for building modular, high-performance, cross-platform 2D games (top-down, tactics, shmup, puzzle, isometric, and platformer) in Go using Ebitengine v2.


Trigger Conditions

Activate this skill whenever:

  • Designing or implementing 2D game architecture, scene flow, camera systems, or rendering pipelines in Go.
  • Working with Ebitengine interfaces (ebiten.Game), state machines, input management, audio, Kage shaders, or ebiten/v2/text/v2 typography.
  • Optimizing cycle timing, WASM audio synchronization, build-tagged save persistence, Cloud Run hosting, or writing unit tests for Go game components.

Core Architecture & Fail-Fast Engineering Rules

1. Modular Architecture (internal/)

Organize the codebase into modular subsystems under internal/. Never build monolithic single-file games.

2. Fail-Fast Asset Embedding & Validation (No Silent Fallbacks)

  • Zero-Dependency Embedding: Embed all game assets (sprites, TTF/OTF fonts, audio streams, Kage shaders) directly into the compiled Go binary using embed.FS (internal/assets).
  • No Silent Fallbacks: Never ignore errors (_ = err), never substitute dummy 1×1 fallback textures when an asset fails to decode, and never silently clamp out-of-bounds tile or frame IDs. Always fail fast and return rich fmt.Errorf diagnostics during Boot initialization.
  • Mandatory Binary Format Validation: Always validate asset files using file identification tools (file, mimetype, or http.DetectContentType in Go) during asset ingestion. Misnamed or corrupt asset files cause decoding failures or black screens on WebAssembly.

3. Premultiplied Alpha Invariant (color.RGBA vs. color.NRGBA)

  • In Go's image/color and Ebitengine, color.RGBA is alpha-premultiplied: every channel must satisfy $R \le A$, $G \le A$, $B \le A$.
  • Never construct non-premultiplied literals like color.RGBA{255, 0, 0, 100} (where $R > A$). Use valid premultiplied color.RGBA{100, 0, 0, 100} or straight-alpha color.NRGBA{255, 0, 0, 100}.

4. Aspect Ratio & Virtual Pixel Canvas

  • 16:9 Widescreen Priority: Unless explicitly specified otherwise, target a 16:9 virtual resolution (320x180, 640x360, 1280x720, 1920x1080).
  • Virtual Pixel Canvas: All entity physics, collision math, camera coordinates, Kage shader pixel units, and UI layouts operate strictly in virtual canvas coordinates.
  • Automatic Multi-Resolution Scaling: Layout(outsideWidth, outsideHeight int) returns constant virtual dimensions (virtualWidth, virtualHeight).

5. Cycle Timing & Frame Synchronization

  • Target Frame Rate: Standard target is 60 TPS (ebiten.SetTPS(60)).
  • Delta-Time Integration: Integrate movement, camera exponential decay, and timers using delta time ($dt = 1.0 / 60.0$ or measured frame delta) for consistent behavior across refresh rates.
  • Windowing & Fullscreen Toggle: Support fullscreen toggling via F11 or Alt+Enter:
go
if inpututil.IsKeyJustPressed(ebiten.KeyF11) || (ebiten.IsKeyPressed(ebiten.KeyAlt) && inpututil.IsKeyJustPressed(ebiten.KeyEnter)) {
    ebiten.SetFullscreen(!ebiten.IsFullscreen())
}

Engine Reference Modules

Consult these deep technical reference guides for complete, zero-allocation, fail-fast Go implementations:

ModuleReference FileKey Topics Covered
Project Structurereferences/project_structure.mdPackage tree and internal/ subsystem responsibilities.
Camera & Game Feel ("Juice")references/camera_and_juice.md2D ebiten.GeoM camera, frame-rate independent exponential lerp, trauma screen shake, hitstop freeze frames, and spring squash-and-stretch.
Kage Shaders & text/v2references/shaders_and_text_v2.mdKage //kage:unit pixels shaders (2D lighting, CRT, hit-flash) and ebiten/v2/text/v2 font loading and aligned layout.
WASM Audio & Save Storagereferences/wasm_audio_and_persistence.md4-byte aligned PCM Seek() math for browser autoplay unlock and build-tagged desktop vs. WASM fail-fast save storage.
UI & HUD Systemreferences/ui_and_hud.mdPremultiplied alpha invariant (R <= A), pre-sliced 9-slice panels, anchoring math, zero-alloc progress bars, and text/v2 buttons.
Physics & Collisionreferences/physics_and_collision.mdGenre-agnostic Circle & AABB overlap, axis-separated sweep resolution, spatial hash grids, and slope math.
Tilemaps & Levelsreferences/tilemaps_and_levels.mdPre-sliced tileset validation, camera frustum culling, isometric projection, and 16-pipe bitmask autotiling.
Input Action Mappingreferences/input_action_mapping.mdRebindable action maps, radial analog deadzones, and zero-alloc gamepad polling.
Entity Managementreferences/entity_management.mdPre-allocated slice pools, deferred deletion buffers, and Structure-of-Arrays (SoA) Light ECS.
Pathfinding & AIreferences/pathfinding_and_ai.mdFail-fast A* grid pathfinding, steering behaviors (seek/arrive), and enemy decision FSM.
Server & Cloud Runreferences/server_architecture.mdWebAssembly build, multi-stage Dockerfile, and Cloud Run leaderboard REST API.

Game State Machine & Scene Flow

Finite State Machine (FSM) Lifecycle

Model all scenes using a State interface with strict lifecycle hooks (Enter() error, Update(dt float64) error, Draw(screen *ebiten.Image), Exit() error).

Standard Scene Progression

text
Boot (Logo & Asset Preload) -> Intro -> Title Screen -> Game Play -> Game Win / Game Over -> Title Screen

Transition Cleanliness (No Leaks)

Upon Exit(), every state must:

  • Stop or fade out BGM/SFX channels belonging to that scene.
  • Flush active particle emitters, animations, hitstop timers, and camera trauma.
  • Reset transient input buffers so button presses do not bleed into the next state.

Attract / Demo Mode (Arcade Style)

  1. Idle Timeout: On Title Screen, if no input is received after a timeout (e.g. 10s), transition to Demo Mode (autonomous AI/CPU plays the game).
  2. Instant Interrupt: Any user input in Demo Mode interrupts execution immediately back to Title Screen.
  3. Alternating Flow: Consecutive Title Screen idle timeouts alternate between launching Demo Mode and re-playing Intro.

WebAssembly (WASM), Shaders & Typography Rules

  • Audio Late-Sync (4-Byte PCM Alignment): Browser WebAudio contexts remain locked until the first user gesture. Track elapsed time during silent load and Seek() to a 4-byte aligned stereo PCM byte offset ((samples * 4) % loopLengthBytes) on first interaction. See references/wasm_audio_and_persistence.md.
  • Custom Typography (ebiten/v2/text/v2 Only): Never use ebitenutil.DebugPrint for game UI and never use deprecated ebiten/v2/text v1. Always load TTF/OTF fonts via text.NewGoTextFaceSource, text.GoTextFace, and text.Draw from github.com/hajimehoshi/ebiten/v2/text/v2. See references/shaders_and_text_v2.md.
  • Kage Shaders (//kage:unit pixels): Always include //kage:unit pixels in Kage shaders and pre-allocate ebiten.DrawRectShaderOptions and uniform maps at load time. See references/shaders_and_text_v2.md.
  • Build-Tagged Save Persistence: Implement separate //go:build !js (atomic file write in os.UserConfigDir()) and //go:build js && wasm (window.localStorage) storage backends behind a common fail-fast interface. See references/wasm_audio_and_persistence.md.

Unit Testing & Performance Rules

  1. Zero Allocations in Draw(): Never call ebiten.NewImage(), SubImage(), ebiten.NewShader(), or allocate slices/maps inside Draw(). Pre-allocate all ebiten.DrawImageOptions, text.DrawOptions, and SubImage frame slices during initialization.
  2. Decouple Logic & Render: Keep all state mutation strictly inside Update(). Draw() must be a read-only projection of current game state.
  3. Unit Test Coverage: Write deterministic unit tests for state transitions, collision/spatial hash math, camera lerp/trauma decay, 4-byte PCM alignment, A* pathfinding, and save serialization.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Ebitengineer AI skill do?

Engineering architecture and best practices for building 2D games in Go using Ebitengine (v2). Covers modular game architecture, scene state machines, virtual resolution scaling, delta-time physics, zero-allocation draw loops, Kage shaders, and WebAssembly audio synchronization. Activate when designing, building, optimizing, or debugging 2D games in Go, implementing game systems with Ebitengine, or compiling games to WebAssembly.

Why use Ebitengineer on TypingMind?

Because you install it once and use it with any model. Ebitengineer is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Ebitengineer in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/danicat/skills/tree/main/game-dev/ebitengineer. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Ebitengineer?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Ebitengineer?

As many as you like. As long as a model supports skills, you can use Ebitengineer with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Ebitengineer AI skill free?

Yes. It is published on GitHub by danicat under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇