Live data from Hacker News

Making games in Go for absolute beginners

threedots.tech

51–60 of 78 posts

Re: Making games in Go for absolute beginners

#51
I’m going to react just to the first part of the article since the rest isn’t really of interest to me.

If you’re experiencing the kind of burnout that the author described, I’d suggest an alternative to doubling down and “reclaiming” your hobby: make your interests evolve. It could very well be your body (specifically your brain) telling you that you’re stagnating. It doesn’t have to be different getting programming, but perhaps you’ve reached a point that it is time to go deeper, possibly into CS theory.

Re: Making games in Go for absolute beginners

#52
post #9
post #8

I always wondered if Go would be a good language to make a game in due to its concept of goroutines. Maybe one of these days I’ll give it a shot.

Unfortunately, garbage-collected languages have historically not been great for real-time action games. Throughput and performance can be excellent, but without control over the garbage collector pauses can wreck the experience. For any game that doesn't require smooth frames for the experience, the best language is the one you're most comfortable with (modulo some base level of game dev community) Edit: on the other…

Much work has gone into making Go GC pauses as quick as possible, so it might be in a better position relative to other GC'd languages.

Also, you might be able to toggle the GC off, and invoke manually with runtime.GC() at opportune moments.

Re: Making games in Go for absolute beginners

#53
post #32

I am a fan of Go due to the focus on simplicity in the language... but why Go for game dev? The purpose of the language was to tackle backend services previously written in C++ focusing on junior developers, not game dev. It's not really a popular tool for the job: Python, which is a simpler language, has a much larger community of gamedev noobs. Or maybe better yet: start with Godot and GDScript

Using the origin-story* of a language to argue against what the language can be used for now is never a good argument.

Go is a powerful, accessible language. It yields highly optimized, tight binary output targeting a wide variety of platforms and systems. Why not Go?

Python is basically a non-starter in this space. Your other example is a scripting language inside an engine. These seem orthogonal.

* - Which is oft heavily editorialized and fictitious, such as in this case

Re: Making games in Go for absolute beginners

#54
Not a Go dev, but a long time viewer of one YouTuber/Twitch streamer that makes his games in Go for a long while now. He's creating a small MMO in Go which you can test out here: https://mythfall.com

UnitOfTime is his YT & Twitch handle https://www.youtube.com/@UnitOfTimeYT Uses his own binding to OpenGL and WASM to WebGL2 for Web version.

Used to use Go myself, but fell out with it. But I can understand why people would enjoy making games with it. Just like SolarLune himself uses Golang for his gamedev. A lot of people seem to ask the same question tho: "Why make it in Go? Doesn't it have GC?" From my understanding Go's GC is quite robust as well.

In a nutshell, nice to see Go having more usage outside the norm that devs expect it to only be used in.

Re: Making games in Go for absolute beginners

#55

I tend to write fireworks or simple particle simulations in a new language / graphics api to test for performance as my first step (aka learning how to place a pixel on the screen, double buffer or whatever, do some simple logic / math, and learn the compilation pipeline). It's always a fun task and an easy benchmark: how many pixels can I move per frame? I did this in 2021 in GO and Ebitengine and I was blown away b…

I always do a web project because it typically shows you language features that you wont see in "Hello World". It also shows me what the database drivers look like, if its painful to setup, and all that fun stuff.

I do the same, but different kinds of projects exercise different stacks.

A web project does not prepare you for a bad UI history, for example...

Re: Making games in Go for absolute beginners

#56
post #50
post #32

I am a fan of Go due to the focus on simplicity in the language... but why Go for game dev? The purpose of the language was to tackle backend services previously written in C++ focusing on junior developers, not game dev. It's not really a popular tool for the job: Python, which is a simpler language, has a much larger community of gamedev noobs. Or maybe better yet: start with Godot and GDScript

> Python, which is a simpler language This seems crazy to me. How so?

[deleted]

Re: Making games in Go for absolute beginners

#57
post #34

Earlier quoted context omitted.

> ... but why Go for game dev? The purpose of the language was to tackle backend services previously written in C++ focusing on junior developers, not game dev. I'd say using any language for game development should be embraced, not discouraged. Imagine if William Crowther had thought, "Why Fortran for game development? The purpose of the language is to tackle scientific computing." Thankfully, he did not think like…

[flagged]

[deleted]

Re: Making games in Go for absolute beginners

#58
post #9

Earlier quoted context omitted.

Unfortunately, garbage-collected languages have historically not been great for real-time action games. Throughput and performance can be excellent, but without control over the garbage collector pauses can wreck the experience. For any game that doesn't require smooth frames for the experience, the best language is the one you're most comfortable with (modulo some base level of game dev community) Edit: on the other…

I'm making a game in Go, and it runs perfectly smooth on my 240hz monitor (and should run perfectly smooth on 1000hz monitors once we get there). The garbage collector has not been an issue, because I use memory the same way as if I were doing it in the C language: Allocate all memory used by the game at program launch. I find this scheme easier to work with in Go than in C, because Go's slice type is a natural fit f…

Side note: Go's GC will still run without allocations, typically every 10 minutes. But, in your case, it might never find memory to collect. If you truly want to disable the GC, use SetGCPercent or GOGC.

Re: Making games in Go for absolute beginners

#59
Nice to see such a topic come up.

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

When I started two years ago, I basically had to choose a language and a package/framework, so I'd like to share my experience about it.

First, about the package, there are two major ones for 2D games, which are Ebiten(gine) and Pixel.

I initially chose Pixel, because it seemed more documented at the time and had a bigger community. Overall, it was good as long as the game was simple, but unfortunately I regretted this choice later.

Don't get me wrong, I am not here to discredit the author, because there is a phenomenal amount of open source work that was done, and I am thankful for it. But as my game grew more complex, the engine started to cause big architectural challenges, memory leaks (it does not correctly garbage collect OpenGL's objects for example), and it's multi-threading model is flawed. I also discovered that it was in fact not maintained. Overall it lacks too much maturity for a serious game.

In the end, I decided to ditch it, because it was easier, and my proposals for help on GitHub never got any answer. It took some effort, but having my own engine based on OpenGL was the best choice in this case.

When it comes to Ebiten, I have only used the sound library called Oto, but overall my opinion of the whole package now is that it is well maintained and architected.

Now when it comes to choosing a language, I hesitated between:

- Go, which I had a lot of experience with and seemed good enough, even if the typing system is a bit too weak

- Rust, which I was (and still is) interested in, but had no experience, and unsure if it was worth it in terms of productivity (because of the additional time spent on worrying code, and the compilation time itself). Also, it didn't have game engines which seemed as mature as in Go at this time (I wish I had known that I would end-up with my own engine).

- C++, which is the industry standard, but on which I have very limited experience. Also, I just didn't want to bother with the header files and the compilation stack.

I chose Go, and too be honest it is a choice that I now regret, but also I have to live with it because I cannot afford a rewrite at this point.

Go certainly had a lot of productivity benefits, but also major flaws when it comes to game development:

- The lack of packages related to data structures. In games, we need a lot of specific sets, trees, queues, tries and maps, but those are almost non existent in Go. The best one is "gods", which still does not support generics. Overall it is always difficult to find quality and experienced packages, even for broadly used and fundamental algorithms.

- The fact that dependency cycles are handled on a package basis, and not per-class or per-file. This is a major source of headaches for video games, because contrarily to web servers, there are not a limited number of predefined layers: everything needs to depend on almost everything else, and Go makes it even worse in this case.

- The lack of data structures is made even worse by the native map, because it forcefully randomizes the iteration order, which causes a lot of bugs and makes it unusable 90% of the time. The authors wanted to prevent people from using it as if the key order was guaranteed, but their fix also broke the natural consistency of iteration order. This means for example that the drawing order of objects is different every frame, even when the data didn't change at all.

- When it comes to modding, there are not much options, because Go does not have a very easy or natural compatibility with FFI (cgo is awkward to use, and not really usable with dynamic linking), the native plugin package is experimental (and not even working in windows), and the support for WebAssembly is still quite poor (but getting better).

Re: Making games in Go for absolute beginners

#60
post #50
post #32

I am a fan of Go due to the focus on simplicity in the language... but why Go for game dev? The purpose of the language was to tackle backend services previously written in C++ focusing on junior developers, not game dev. It's not really a popular tool for the job: Python, which is a simpler language, has a much larger community of gamedev noobs. Or maybe better yet: start with Godot and GDScript

> Python, which is a simpler language This seems crazy to me. How so?

If you never use anyone elses packages and only stick to vanilla python available on your system it's a great learning language. Many universities still use it to teach programming today. But this is mostly inertia...

...because python has changed in the last decade so that anything ever so slightly complex requires learning all it's dependency manager manager setups (conda, pyenv, etc) to set up an entire custom python implementation with it's own dependency manager (pip, whatever, etc) just to be able to run a single python application or use a python lib. Trying to do it with the actual python your system runs will always end in tragedy.

So yeah... Python is a simple language. But using python these days is so complex I actually chose C++ over it to avoid complexity. And that's really saying something. That said, there's no such thing as system 'go' at all so it brings in plenty of complexity too despite being 'simple' in it's own way.

Post reply on HN