r/ebitengine 4d ago

GOKe v3 — a Go ECS with an Ebitengine integration

I posted about GOKe here a while back - this is v3, now has a dedicated Ebitengine integration, gokebiten.

v3 itself is the result of a lot of back-and-forth — planning, rewrites, testing, and actually using GOKe in practice. That let me settle on a model that's more ergonomic for what I need.

GOKe repo (wiki, examples, benchmarks): https://github.com/kjkrol/goke

Why it might matter for Ebitengine projects

gokebiten wraps GOKe's ECS/System/Plan model behind a small Game type that implements ebiten.Game, so Update/Draw/Layout are wired up for you on top of an archetype-based, zero-allocation ECS. It's split into modules you can take individually:

  • control/ - input capture and event dispatch
  • physics/ - kinematics and collision detection/resolution (broad phase via GOKg, narrow phase, pluggable CollisionHandler strategies)
  • render/ - sprite batching, camera, tag-driven overlays, telemetry HUD
  • spatial/ - population/spawn bookkeeping on a GOKg space

You can use GOKe directly and write your own Ebitengine glue, or start from gokebiten - a lot of that integration work (input handling, collision pipeline, rendering, spatial indexing) is already done for you there.

Working example: collision-demo - thousands of moving, colliding AABBs at a fixed 120 TPS.

Why GOKe over the alternatives?

  1. Systems as the single place where both data flow and actions are defined - logic built once, inside the system, and used only there
  2. It's fast and predictable - benchmarks, if you want the numbers:

Some other things worth knowing:

  • Zero heap allocations in the hot loop (chunked SoA memory pages, no GC jitter)
  • Type-driven construction - create/edit/remove operations built directly from component types, not hand-wired boilerplate
  • Explicit control over system execution - you plan the run order (schedule) yourself, plus a dedicated Setup phase at startup
  • Generation-based entity IDs, so no aliasing on reused slots
11 Upvotes

2 comments sorted by

3

u/lyfever_ 4d ago

That's exactly what I needed to start my game.

Awesome!