Loading...
Loading...
Expert Guide to Indie Game Development with Go (Golang) and its game engines (such as Ebitengine or Raylib-go). Covers core areas including memory management, concurrency-safe game loops, asset embedding (go:embed), and cross-platform cross-compilation. Suitable for scenarios where high-performance 2D/3D games are built using the Go ecosystem.
npx skill4agent add halflifezyf2680/mpm-vibe-coding go-game-devslice = slice[:0]sync.PoolUpdate()Draw()DrawImageNewImageGame.Draw()Channelsync.RWMutexebiten.Image.Dispose()fmt.Sprintfmake([]int)&Vector{}Updatego func()invalid memory addressmapUpdateNever stuff all code into. Follow the Go standard project layout.main.go
cmd/game/main.gointernal/game/internal/assets/embed.FSinternal/ecs/go mod init <module>internal/game/game.goGameebiten.RunGame(&game.Game{})cmd/game/main.goA game is not a single big loop, but a series of scene switches (Logo -> Menu -> Play -> Over).
SceneUpdate() errorDraw(screen *ebiten.Image)currentScene SceneGameSceneManagerSwitchTo(Scene)Game.Update()return g.currentScene.Update()TitleSceneAs the number of entities increases, OOP inheritance trees become performance bottlenecks.
GameObject*Sprite*PositiondonburiarcheComponentSystemMovementSystemVelocityDon't directly writein logic code.ebiten.IsKeyPressed(ebiten.KeySpace)
InputSystemActionJumpActionShootinput.IsActionJustPressed(ActionJump)AssetLoadersync.MapmapWorking locally doesn't mean it can be distributed to players.
.air.tomlMakefilescripts/build.pyGOOS=windows GOARCH=amd64 go build -ldflags="-H windowsgui -s -w"GOOS=js GOARCH=wasm go build -o game.wasmreferences/ebitengine_patterns.mdreferences/vfx_guide.mdreferences/publishing.mdreferences/genre_cardgame.mdreferences/genre_simulation.mdscripts/build_all.py