Go / Ebitengine

Willow

A display-tree 2D rendering framework for Ebitengine

Willow sits between your game logic and Ebitengine's GPU backend, giving you a scene graph, sprite batching, cameras, input handling, text rendering, particles, and more. Inspired by PixiJS, Starling, and Flash display lists; adapted for Go's strengths.

Rope Mesh Effect
Rope Mesh Effect
Nested Transforms
Nested Transforms
Water Mesh Effect
Water Mesh Effect

Quick Start

Terminal
main.go

For full control, implement ebiten.Game yourself and call scene.Update() and scene.Draw(screen) directly.

Read the full guide →

Already using Go and Ebitengine?

If you're tired of wiring up your own scene graph every project, Willow handles that for you. It wraps Ebitengine, never fights it.

Coming from another framework?

Coming from PixiJS or Starling? Willow's display tree will feel familiar. Same mental model, Go performance.

Blend Mode "Lighting"
Blend Mode "Lighting"
Shader Filters
Shader Filters
Physics Integration
Physics Integration

What is a Display Tree?

Instead of issuing draw commands every frame, you build a tree of nodes that describes your scene. Willow walks the tree and renders it for you.

Scene Root
Backgroundz:0
Worldz:1
HUDz:2
Player
Enemy
Paint Order (back to front)
Background1st
Player2nd
Enemy3rd
HUD4th
Screen (front)

Containers

Group nodes into layers. A container's transform (position, rotation, scale) applies to all its children. Move the parent, everything inside moves with it.

Painter's Algorithm

Nodes draw back-to-front by Z-index. Background first, then world objects, then HUD on top. No manual draw ordering needed.

Describe, Don't Draw

Add nodes to the tree and set their properties. Willow traverses the tree each frame and produces the draw commands for you. You describe what exists; Willow handles how it renders.

Where Willow Fits

Your Gamegameplay, content, logic
Willowscene graph, rendering, interaction
You are here
EbitengineGPU backend, window, audio, platform

Features

Scene Graph

  • Parent/child transforms with alpha propagation
  • Z-index reordering and display list management

Rendering

  • Sprite batching with TexturePacker atlas support
  • Mesh rendering: distortion grids, rope meshes, and polygons

Text

  • FontFamily with multi-style SDF rendering (regular, bold, italic)
  • PixelFont for crisp bitmap text

Camera

  • Multiple viewports with frustum culling
  • Follow targets and scroll-to animation

Input

  • Hierarchical hit testing with rect, circle, and polygon shapes
  • Event callbacks for pointer, touch, and keyboard

Tile Maps

  • Efficient large-world tile map rendering
  • Animated tile UV swaps

Particles

  • CPU-simulated particle emitters
  • Configurable lifetime, gravity, and interpolation

Shaders & Filters

  • Composable Kage shader filter chains
  • Blur, outline, palette swap, color matrix, and custom filters

Animation

  • Tweening with 45+ easing functions
  • Position, scale, rotation, alpha, and color

Lighting

  • 2D lighting layer
  • Erase-blend render targets

Physics

  • Optional 2D rigid-body physics via Chipmunk
  • Per-subtree spaces with auto tick and write-back
  • Strip the cp dependency with -tags nophysics

Performance

  • Subtree caching for up to 125x speedup
  • FXAA post-processing
  • Automatic render batching

Dev Tools

  • Debug stats overlay with per-frame timing
  • FPS/TPS widget
  • Screenshot capture
Offscreen Rendering Buffer
Offscreen Rendering Buffer
Polygon Shapes
Polygon Shapes
Particle System
Particle System

Performance

Zero heap allocations per frame on the hot path.

10K sprites, cached + camera scrolling~39 µs
~125x faster
10K sprites, 100 animated tile UV swaps~1.97 ms
~2.5x faster
10K sprites, 1% children moving (auto)~4.0 ms
~1.2x faster
10K sprites, no cache (baseline)~4.9 ms

Benchmarks: 10,000 sprites, go test -bench . -benchmem

2.5D Raycaster Experiment
2.5D Raycaster Experiment
Tweens & Lighting
Tweens & Lighting
Clipping & Masks
Clipping & Masks

Why Willow?

01

Eliminate the Boilerplate

Stop rebuilding scene graphs, batching, hit testing, cameras, and text layout from scratch in every project. Willow handles the rendering infrastructure so you can focus on your game.

02

Performance-First Design

Zero heap allocations per frame on the hot path. 10,000 sprites at 120+ FPS on desktop, 60+ FPS on mobile and WebAssembly. Static content caching delivers up to 125x speedups.

03

Wraps Ebitengine, Not Replaces It

Willow uses Ebitengine's lifecycle, image types, and threading model directly. It's a higher-level framework that sits on top of what you already know.

04

Ship Everywhere

Windows, macOS, Linux, iOS, Android, and WebAssembly. One codebase, every platform Ebitengine supports.

Use Cases

01

2D games requiring structured layering and scene composition

02

Large tile map worlds with cameras and scrolling

03

Game tooling, level editors, and debug overlays

04

Rapid prototyping with minimal setup

05

Creative coding, generative art, and audio visualizers

06

Cross-platform desktop utilities with rich 2D graphics

What Willow is Not

×Not a full game engine. No built-in physics, networking, or asset pipelines.
×Not a UI layout framework. Willow UI is a separate companion library for that.
×Not a replacement for Ebitengine. It builds on top of it.

Willow focuses on structured rendering and scene composition. You bring the gameplay and domain logic.

Common Questions

What is Willow?

Willow is a 2D rendering framework for Go that sits on top of Ebitengine. It gives you a scene graph (display tree), sprite batching, cameras, text rendering, particles, shaders, input handling, and more. Think PixiJS or Starling, but for Go.

Is Willow a game engine?

No. Willow is a rendering framework. It handles the visual layer: scene composition, draw ordering, batching, cameras, and input. It does not include physics, networking, asset pipelines, or audio. Those are either handled by Ebitengine directly or by other libraries. Willow focuses on doing one thing well. Read more about this design decision at Why Willow?

Does Willow replace Ebitengine?

No. Willow wraps Ebitengine, it does not replace it. It uses Ebitengine's image types, game loop, and platform backend directly. You can mix Willow scene graph rendering with raw Ebitengine draw calls in the same project. If you already know Ebitengine, Willow adds structure on top of what you already have.

How does it compare to using Ebitengine directly?

Ebitengine gives you a game loop and a draw surface. You handle everything else: transform hierarchies, draw ordering, batching, cameras, hit testing, text layout. Willow handles all of that for you through a scene graph. You add sprites and containers to a tree, set positions and properties, and Willow renders everything in the right order with automatic batching. Less boilerplate, same performance. See the full side-by-side comparison at Willow vs Ebitengine.

See all questions →

Ready to build with Willow?

Get up and running in minutes. Check out the docs, explore examples, or jump straight into the code.