Live data from Hacker News

Making games in Go for absolute beginners

threedots.tech

61–70 of 78 posts

Re: Making games in Go for absolute beginners

#61
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.

It's extremely good. Goroutines and channels make it very straightforward to set up an ECS engine hence you can actually run a lot of the engine in parallel and not have to stick to the "game loop" structure. Build your systems similar to the actor model with a mailbox, have an event/messaging bus, and you basically have a very performant engine. I've yet to run into issues with the GC. The only bit of tuning I had t…

Speaking of, I created an ECS framework for use with Ebitengine:

https://code.rocket9labs.com/tslocum/gohan

Re: Making games in Go for absolute beginners

#62
post #14

Is size still an issue with Go if you wanted to compile to WASM and target the browser?

Boxcars[0], a web-based client for playing backgammon powered by Ebitengine, compiles to a 20MB WASM binary[1], and as long as the server and browser are gzip-enabled, this actual transfer size is reduced to a little under a third of this.

0. https://code.rocketnine.space/tslocum/boxcars

1. https://play.bgammon.org

Re: Making games in Go for absolute beginners

#63
I love Go and have been thinking of using it for a game project, but I can't help but feel like the web itself is a far better stack.

The web browser gives you a rich collection of things you need out of the box and fairly "cross platform" by nature. You get things like graphics, audio, networking, debugging utilities, access to webgl / webgpu, etc.

As much as I hate to admit it.. it seems the web is far more suited for it than Go. I'm sure the game dev purists out there are pointing and laughing at the idea though :)

Re: Making games in Go for absolute beginners

#64

I love Go and have been thinking of using it for a game project, but I can't help but feel like the web itself is a far better stack. The web browser gives you a rich collection of things you need out of the box and fairly "cross platform" by nature. You get things like graphics, audio, networking, debugging utilities, access to webgl / webgpu, etc. As much as I hate to admit it.. it seems the web is far more suited…

[deleted]

Re: Making games in Go for absolute beginners

#65
post #28

While writing games in any programming language is a very rewarding experience, I have found HTML5 Canvas and JavaScript to be very effective for writing games as absolute beginners too. If sound is needed, there is Web Audio too, all available right within the web browser. It is quite possible to write simple games without using any external JS libraries by sticking to first principles only, e.g., drawing simple sha…

[deleted]

Re: Making games in Go for absolute beginners

#66
post #28

While writing games in any programming language is a very rewarding experience, I have found HTML5 Canvas and JavaScript to be very effective for writing games as absolute beginners too. If sound is needed, there is Web Audio too, all available right within the web browser. It is quite possible to write simple games without using any external JS libraries by sticking to first principles only, e.g., drawing simple sha…

The web is becoming a really good OS.

We just need make web assembly better for higher level languages, because neither javascript not rust are an end-all great language for small games.

Re: Making games in Go for absolute beginners

#68
post #48

Earlier quoted context omitted.

I would recommend against anyone using PixiJS. From a code perspective it feels dated and inconsistent. It can be very difficult finding correct information for the latest version, and you will very easily hit performance problems if you want to create a full screen game. You will need to apply the bitmap caching feature to yield best performance, and to me it seemed riddled with rendering and interaction bugs, or at…

And the alternative 2D game engine designed for the Web with GPU acceleration is?

It’s not ideal, but I’d go with something non-JavaScript. Heaps or Kha in the Haxe ecosystem would be a far more worthwhile choice IMO.

Re: Making games in Go for absolute beginners

#69
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.

The way you have to do math with vectors without operator overloading available in Go is quite cumbersome. I am a huge Go fan and I figured this out working on the raytracer in a weekend project using Go.

You built a raytracer in a weekend? That's kind of impressive :P

Re: Making games in Go for absolute beginners

#70
post #69

Earlier quoted context omitted.

The way you have to do math with vectors without operator overloading available in Go is quite cumbersome. I am a huge Go fan and I figured this out working on the raytracer in a weekend project using Go.

You built a raytracer in a weekend? That's kind of impressive :P

https://raytracing.github.io/
Post reply on HN