Making Games in Go for Absolute Beginners

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • aaaaxy

    A nonlinear 2D puzzle platformer taking place in impossible spaces.

  • > Your game looks great, congrats on your progress! I especially enjoyed how the zoom works when you're leaving/arrive planets, and the unique propulsion system (also, the anchor made me giggle!).

    Thank you. Feedbacks are very much appreciated. There is still a long was until an eventual release, but it's very fun to work on it.

    > I tend to not need many, so I'd be curious if you can recall any structure in particular which you couldn't find? No biggie if not.

    I had trouble finding basic structures like sets or linked lists, as much as more specific ones like R-tree, M-tree, KD-tree quad-tree or specific kinds of tries.

    When quickly searching on Google, there are pretty much always some results, but when looking at the details it's not that great. Most of the packages have some kind of flaw that was a deal-breaker for me. Most common ones are:

    - The package is something developed by one guy 4 years ago, and has pretty much no stars and is abandoned

    - The structure is somehow backed by the native `map`, meaning that it has the same randomized iteration order

    - There is some kind of logic to try to handle multi-threading, mixed-up with the data structure's logic. Often with mutexes/locks, thus killing the performance. My game is pretty much only mono-thread, and I just need something simple and that does not care about synchronization.

    - The structure is not generic, but only uses `interface{}`

    - The structure lacks tests or have unreadable code made of 1-letter variables

    > I'm not a game dev, but I've seen some larger games such as https://github.com/divVerent/aaaaxy/tree/main/internal (if you haven't played it before—do it!) which seems to be able to place everything into separate packages without issue, so perhaps there's something to gleam from their architecture?

    Thanks for the reference. After looking at it, is seems to me that they are creating really tiny packages made of one or two files. I don't want my codebase to end-up with thousands of 1-file packages, it does not seem very maintainable. I want to keep having packages with clearly defined purposes and domains.

    > Hash map iteration shouldn't be sorted in _any_ language (here's Rust, for example https://play.rust-lang.org/?version=stable&mode=debug&editio... (Python makes it _appear_ as if dicts are sorted hash maps, but that's only because it doesn't only use a hash table, but a vector as well (same as you'd have to do in Go))), otherwise it would cause both portability and security (https://github.com/golang/go/issues/2630) issues. You should probably be using a b-tree if you aren't willing to sort it yourself.

    I think that you didn't understand my message (or I didn't explain clearly enough). I do not need the items to be sorted, I need the iteration order to be consistent.

    Let's say that I insert A, B and C in a map, then want to iterate on it. I will get an unspecified order, maybe ABC, maybe CBA, maybe BAC, which does not matter to me. However, in any language, this order will be consistent across all future iterations unless the data is changed. This is a natural property of any data structure. So if I got CBA in the first loop, I will also get CBA in the second and third loops.

    In golang this is not the case because they actively inserted a random order. It means that even if the data does not change, I may get CBA in the first iteration, but BAC in the second, then ABC... Which created a ton of issues for me.

    > If you don't care about unloading https://github.com/pkujhd/goloader

  • rust-playground

    The Rust Playground

  • > Your game looks great, congrats on your progress! I especially enjoyed how the zoom works when you're leaving/arrive planets, and the unique propulsion system (also, the anchor made me giggle!).

    Thank you. Feedbacks are very much appreciated. There is still a long was until an eventual release, but it's very fun to work on it.

    > I tend to not need many, so I'd be curious if you can recall any structure in particular which you couldn't find? No biggie if not.

    I had trouble finding basic structures like sets or linked lists, as much as more specific ones like R-tree, M-tree, KD-tree quad-tree or specific kinds of tries.

    When quickly searching on Google, there are pretty much always some results, but when looking at the details it's not that great. Most of the packages have some kind of flaw that was a deal-breaker for me. Most common ones are:

    - The package is something developed by one guy 4 years ago, and has pretty much no stars and is abandoned

    - The structure is somehow backed by the native `map`, meaning that it has the same randomized iteration order

    - There is some kind of logic to try to handle multi-threading, mixed-up with the data structure's logic. Often with mutexes/locks, thus killing the performance. My game is pretty much only mono-thread, and I just need something simple and that does not care about synchronization.

    - The structure is not generic, but only uses `interface{}`

    - The structure lacks tests or have unreadable code made of 1-letter variables

    > I'm not a game dev, but I've seen some larger games such as https://github.com/divVerent/aaaaxy/tree/main/internal (if you haven't played it before—do it!) which seems to be able to place everything into separate packages without issue, so perhaps there's something to gleam from their architecture?

    Thanks for the reference. After looking at it, is seems to me that they are creating really tiny packages made of one or two files. I don't want my codebase to end-up with thousands of 1-file packages, it does not seem very maintainable. I want to keep having packages with clearly defined purposes and domains.

    > Hash map iteration shouldn't be sorted in _any_ language (here's Rust, for example https://play.rust-lang.org/?version=stable&mode=debug&editio... (Python makes it _appear_ as if dicts are sorted hash maps, but that's only because it doesn't only use a hash table, but a vector as well (same as you'd have to do in Go))), otherwise it would cause both portability and security (https://github.com/golang/go/issues/2630) issues. You should probably be using a b-tree if you aren't willing to sort it yourself.

    I think that you didn't understand my message (or I didn't explain clearly enough). I do not need the items to be sorted, I need the iteration order to be consistent.

    Let's say that I insert A, B and C in a map, then want to iterate on it. I will get an unspecified order, maybe ABC, maybe CBA, maybe BAC, which does not matter to me. However, in any language, this order will be consistent across all future iterations unless the data is changed. This is a natural property of any data structure. So if I got CBA in the first loop, I will also get CBA in the second and third loops.

    In golang this is not the case because they actively inserted a random order. It means that even if the data does not change, I may get CBA in the first iteration, but BAC in the second, then ABC... Which created a ton of issues for me.

    > If you don't care about unloading https://github.com/pkujhd/goloader

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • go

    The Go programming language

  • > Your game looks great, congrats on your progress! I especially enjoyed how the zoom works when you're leaving/arrive planets, and the unique propulsion system (also, the anchor made me giggle!).

    Thank you. Feedbacks are very much appreciated. There is still a long was until an eventual release, but it's very fun to work on it.

    > I tend to not need many, so I'd be curious if you can recall any structure in particular which you couldn't find? No biggie if not.

    I had trouble finding basic structures like sets or linked lists, as much as more specific ones like R-tree, M-tree, KD-tree quad-tree or specific kinds of tries.

    When quickly searching on Google, there are pretty much always some results, but when looking at the details it's not that great. Most of the packages have some kind of flaw that was a deal-breaker for me. Most common ones are:

    - The package is something developed by one guy 4 years ago, and has pretty much no stars and is abandoned

    - The structure is somehow backed by the native `map`, meaning that it has the same randomized iteration order

    - There is some kind of logic to try to handle multi-threading, mixed-up with the data structure's logic. Often with mutexes/locks, thus killing the performance. My game is pretty much only mono-thread, and I just need something simple and that does not care about synchronization.

    - The structure is not generic, but only uses `interface{}`

    - The structure lacks tests or have unreadable code made of 1-letter variables

    > I'm not a game dev, but I've seen some larger games such as https://github.com/divVerent/aaaaxy/tree/main/internal (if you haven't played it before—do it!) which seems to be able to place everything into separate packages without issue, so perhaps there's something to gleam from their architecture?

    Thanks for the reference. After looking at it, is seems to me that they are creating really tiny packages made of one or two files. I don't want my codebase to end-up with thousands of 1-file packages, it does not seem very maintainable. I want to keep having packages with clearly defined purposes and domains.

    > Hash map iteration shouldn't be sorted in _any_ language (here's Rust, for example https://play.rust-lang.org/?version=stable&mode=debug&editio... (Python makes it _appear_ as if dicts are sorted hash maps, but that's only because it doesn't only use a hash table, but a vector as well (same as you'd have to do in Go))), otherwise it would cause both portability and security (https://github.com/golang/go/issues/2630) issues. You should probably be using a b-tree if you aren't willing to sort it yourself.

    I think that you didn't understand my message (or I didn't explain clearly enough). I do not need the items to be sorted, I need the iteration order to be consistent.

    Let's say that I insert A, B and C in a map, then want to iterate on it. I will get an unspecified order, maybe ABC, maybe CBA, maybe BAC, which does not matter to me. However, in any language, this order will be consistent across all future iterations unless the data is changed. This is a natural property of any data structure. So if I got CBA in the first loop, I will also get CBA in the second and third loops.

    In golang this is not the case because they actively inserted a random order. It means that even if the data does not change, I may get CBA in the first iteration, but BAC in the second, then ABC... Which created a ton of issues for me.

    > If you don't care about unloading https://github.com/pkujhd/goloader

  • goloader

    load and run golang code at runtime. (by pkujhd)

  • > Your game looks great, congrats on your progress! I especially enjoyed how the zoom works when you're leaving/arrive planets, and the unique propulsion system (also, the anchor made me giggle!).

    Thank you. Feedbacks are very much appreciated. There is still a long was until an eventual release, but it's very fun to work on it.

    > I tend to not need many, so I'd be curious if you can recall any structure in particular which you couldn't find? No biggie if not.

    I had trouble finding basic structures like sets or linked lists, as much as more specific ones like R-tree, M-tree, KD-tree quad-tree or specific kinds of tries.

    When quickly searching on Google, there are pretty much always some results, but when looking at the details it's not that great. Most of the packages have some kind of flaw that was a deal-breaker for me. Most common ones are:

    - The package is something developed by one guy 4 years ago, and has pretty much no stars and is abandoned

    - The structure is somehow backed by the native `map`, meaning that it has the same randomized iteration order

    - There is some kind of logic to try to handle multi-threading, mixed-up with the data structure's logic. Often with mutexes/locks, thus killing the performance. My game is pretty much only mono-thread, and I just need something simple and that does not care about synchronization.

    - The structure is not generic, but only uses `interface{}`

    - The structure lacks tests or have unreadable code made of 1-letter variables

    > I'm not a game dev, but I've seen some larger games such as https://github.com/divVerent/aaaaxy/tree/main/internal (if you haven't played it before—do it!) which seems to be able to place everything into separate packages without issue, so perhaps there's something to gleam from their architecture?

    Thanks for the reference. After looking at it, is seems to me that they are creating really tiny packages made of one or two files. I don't want my codebase to end-up with thousands of 1-file packages, it does not seem very maintainable. I want to keep having packages with clearly defined purposes and domains.

    > Hash map iteration shouldn't be sorted in _any_ language (here's Rust, for example https://play.rust-lang.org/?version=stable&mode=debug&editio... (Python makes it _appear_ as if dicts are sorted hash maps, but that's only because it doesn't only use a hash table, but a vector as well (same as you'd have to do in Go))), otherwise it would cause both portability and security (https://github.com/golang/go/issues/2630) issues. You should probably be using a b-tree if you aren't willing to sort it yourself.

    I think that you didn't understand my message (or I didn't explain clearly enough). I do not need the items to be sorted, I need the iteration order to be consistent.

    Let's say that I insert A, B and C in a map, then want to iterate on it. I will get an unspecified order, maybe ABC, maybe CBA, maybe BAC, which does not matter to me. However, in any language, this order will be consistent across all future iterations unless the data is changed. This is a natural property of any data structure. So if I got CBA in the first loop, I will also get CBA in the second and third loops.

    In golang this is not the case because they actively inserted a random order. It means that even if the data does not change, I may get CBA in the first iteration, but BAC in the second, then ABC... Which created a ton of issues for me.

    > If you don't care about unloading https://github.com/pkujhd/goloader

  • wazero

    wazero: the zero dependency WebAssembly runtime for Go developers

  • > I am the developer of Astral Divide, which is entirely written in Go: https://store.steampowered.com/app/2597060/Astral_Divide/

    Your game looks great, congrats on your progress! I especially enjoyed how the zoom works when you're leaving/arrive planets, and the unique propulsion system (also, the anchor made me giggle!).

    > lack of data structure packages

    I tend to not need many, so I'd be curious if you can recall any structure in particular which you couldn't find? No biggie if not.

    > package structure not suited for games

    I'm not a game dev, but I've seen some larger games such as https://github.com/divVerent/aaaaxy/tree/main/internal (if you haven't played it before—do it!) which seem to be able to place everything into separate packages without issue, so perhaps there's something to gleam from their design?

    > maps are random when iterated

    Hash map iteration shouldn't be sorted in _any_ language (here's Rust, for example https://play.rust-lang.org/?version=stable&mode=debug&editio... (Python makes it _appear_ as if dicts are sorted hash maps, but that's only because it doesn't only use a hash table, but a vector as well (same as you'd have to do in Go))), otherwise it would cause both portability and security (https://github.com/golang/go/issues/2630) issues. You can use a b-tree (which was probably the data structure you wanted there) if you aren't willing to sort it yourself.

    > modding options

    If you don't care about unloading https://github.com/pkujhd/goloader

    Go actually has one of the best WASM runtimes https://github.com/tetratelabs/wazero

    It also has a bunch of libraries for embedding scripting languages https://awesome-go.com/embeddable-scripting-languages, with Tengo _probably_ being quickest https://github.com/d5/tengo

    I'd _highly_ recommend Ebitengine in the future, as not only have there been multiple brilliant games using it, but it also has Switch/Android/iOS support, and you can find help with any issue whatsoever in their Discord. People have built 3D games with it, and Hajime is an absolute beast of a developer.

  • tengo

    A fast script language for Go

  • > I am the developer of Astral Divide, which is entirely written in Go: https://store.steampowered.com/app/2597060/Astral_Divide/

    Your game looks great, congrats on your progress! I especially enjoyed how the zoom works when you're leaving/arrive planets, and the unique propulsion system (also, the anchor made me giggle!).

    > lack of data structure packages

    I tend to not need many, so I'd be curious if you can recall any structure in particular which you couldn't find? No biggie if not.

    > package structure not suited for games

    I'm not a game dev, but I've seen some larger games such as https://github.com/divVerent/aaaaxy/tree/main/internal (if you haven't played it before—do it!) which seem to be able to place everything into separate packages without issue, so perhaps there's something to gleam from their design?

    > maps are random when iterated

    Hash map iteration shouldn't be sorted in _any_ language (here's Rust, for example https://play.rust-lang.org/?version=stable&mode=debug&editio... (Python makes it _appear_ as if dicts are sorted hash maps, but that's only because it doesn't only use a hash table, but a vector as well (same as you'd have to do in Go))), otherwise it would cause both portability and security (https://github.com/golang/go/issues/2630) issues. You can use a b-tree (which was probably the data structure you wanted there) if you aren't willing to sort it yourself.

    > modding options

    If you don't care about unloading https://github.com/pkujhd/goloader

    Go actually has one of the best WASM runtimes https://github.com/tetratelabs/wazero

    It also has a bunch of libraries for embedding scripting languages https://awesome-go.com/embeddable-scripting-languages, with Tengo _probably_ being quickest https://github.com/d5/tengo

    I'd _highly_ recommend Ebitengine in the future, as not only have there been multiple brilliant games using it, but it also has Switch/Android/iOS support, and you can find help with any issue whatsoever in their Discord. People have built 3D games with it, and Hajime is an absolute beast of a developer.

  • g3n

    Go 3D Game Engine (http://g3n.rocks) (by g3n)

  • I've been working on a game over the past year in Go using https://github.com/g3n/engine. I picked Go because I like the language and wanted to learn it. I picked g3n-engine because I wanted to work in 3d after making a few 2d games in the past.

    Making games is so much more challenging and rewarding than almost all of the work I've done for pay. There's always so much more to learn that doesn't feel like just relearning how to do the same thing except with a different framework of the week.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • gx

    A Go->C++transpiler meant for data-oriented gameplay and application programming especially for WebAssembly. Using this mostly in the context of specific personal projects and heavily focusing the feature set on those. Used in my Raylib gamejam project: https://github.com/nikki93/raylib-5k -- also being used to develop a private longer term game project and a note-taking app. (by nikki93)

  • Nice! Ebiten is a super nice API for Go. Lots there to be inspired by in API design. Another API I like a lot is Love for Lua (which also actually can be used from C++).

    Re: the comments on here about the GC etc. -- I've posted about this a couple times before but I've been using a custom Go -> C++ compiler for hobby gamedev, which helps with perf, gives access to C/C++ APIs (I've been using Raylib and physics engines etc.) and also especially has good perf in WebAssembly. Another nice thing is you can add in some reflection / metaprogramming stuff for eg. serializing structs or inspector UI for game entity properties. I was briefly experimenting with generating GLSL from Go code too so you can write shaders in Go and pass data to them with shared structs etc.

    The compiler: https://github.com/nikki93/gx

  • raylib-5k

  • A game made with it for raylib game jam along with the raylib bindings and other engine stuff: https://github.com/nikki93/raylib-5k

  • awesome-ebitengine

    A curated list of awesome Ebitengine frameworks, libraries and software

  • I have been a happy user of Ebitengine for several years. If you are interested in seeing the source of some games created with it, check out the awesome-ebitengine list.

    https://github.com/sedyh/awesome-ebitengine

    All of the games listed on my itch.io profile were created using Ebitengine, and they are all open source.

    https://rocketnine.itch.io

  • Ebiten

    Ebitengine - A dead simple 2D game engine for Go

  • I love Go, yet I've never thought of it as a language with usable game engines. I'm extremely happy to find I was very wrong about that!

    I'm woefully behind the curve on compiling to WASM, though, and I've yet to experiment much with tinygo so I have no idea how far I would get in creating a game people could enjoy in a browser without having to download a big bundle of assets. It's reassuring to see WASM mentioned explicitly as a compilation target [1] by Ebitengine though.

    [1] https://github.com/hajimehoshi/ebiten

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts