Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: I made a 2D shoot 'em up game with Go, using Entity Component System (github.com/m110)
108 points by m110 on Dec 1, 2022 | hide | past | favorite | 26 comments



Beautiful game, thanks for sharing. Koblas's comment caught my eye and I will definitely be poking around the github actions code to learn how to compile Golang to WASM.


Thank you!

Go makes it ridiculously easy:

  GOOS=js GOARCH=wasm go build -o web/game.wasm


This is true but the rendering engine has done the heavy lifting to map calls to the gpu correctly.

More build info here: https://ebitengine.org/en/documents/webassembly.html


Great work here, while I suck at games, it's great to see how Go can be used to build browser based applications.


For the curious, here's the ECS package this is built with: https://github.com/yohamta/donburi


Very cool stuff! I had a lot of fun getting all the powerups and becoming massively overpowered. :)

How was using Go targeting wasm (I presume)? I'm personally concerned about compilation times being super long, but I guess I've never tried...


Glad to hear that! :D

As mentioned in the other comment, the heavy lifting is done by Ebitengine: https://ebitengine.org/en/documents/webassembly.html

Go supports compiling to wasm, and it's as simple as:

  GOOS=js GOARCH=wasm go build -o web/game.wasm
It takes just a few seconds for this project. :)


Constructive feedback - coming from experience with games like "Time Pilot" or "Strikers 1945" - the firing recharge/repeat rate of this game seems too slow.

Otherwise it was neat!


Thanks! The game is not really balanced at this point, it definitely could use some play testing and improvements. :)


Fire rate becomes faster as you collect powerups.


It's too slow to start. It's too hard to destroy all the enemies in time if you miss.

But code looks great! Really nice to see ECS in Go.


great to see Go doing more than just web backends and networking.


For me the third level does not load on the web version.

The ship just gets stuck on the end of lvl 2.


There are only two levels at the moment, it's still a prototype. :) And missing a "well done!" screen, obviously.


Entity Component Systems are definitely the key for making all kinds of interesting gameplay elements very quickly, and in ways you might not even think of initially.


Firefox Ubuntu: black screen and "panic: atlas: the image being put on an atlas is too big: width: 480, height: 2400" in the console.


Nice work! Must have been fun to make :)


It really was! There's something about moving sprites on screen that's super satisfying compared to using a big game engine. I definitely recommend trying out Ebitengine. :)


This is great! Super fun to play. Congrats on releasing it!


Looks quite nice, time travel back to my Speccy days.


IMO you chose wrong tech for the job. It is very simple 2D game yet it starts 5s on my desktop and 20s on my phone. If I would to make a simple game and even simplest program starts 20s I would stop right there and choose different technology.

You probably did it to try Go, wasm and ECS and I understand that, but if you to make a game seriously, you should have stopped much earlier. In the early stage of the game development you should made 5-10 prototypes using different tech/frameworks and use the best one. I seriously don't see Go+wasm+ESC being the best one for this kind of game.

How can you not go insane if you have to wait 20s for every page refresh.


It's not a "serious" project. I chose Go specifically because I like the language (and Ebitengine is super fun to work with) and I like the idea behind ECS. I made games with Unity before, which you could consider a "serious" engine, but the fun of development is nowhere near what I experienced here.

Thinking about what would be the most efficient engine for the game would kill all the fun for me and the project wouldn't exist. :)


I do also really like Go for various reasons, and have been working on a Go -> C++ transpiler and associated ECS libs to make a personal game project with. I used it to make a game for Raylib game jam earlier this year too: https://github.com/nikki93/raylib-5k You can see what the development workflow looks like in this video (the ECS stuff also has a built-in editor like a much more minimal version of Unity's): https://www.youtube.com/watch?v=8He97Sl9iy0

I'm trying to decide how much time I should devote to making this easier to set up / use by other people in the medium term, since it's just a side project for me. Might make a codespaces template so it's quick to get started.


The most efficient game engine is the one you'll actually use!


Oh, come on. This obviously isn't pretending to be a highly polished game experience - it's something someone made for a game jam, and they've taken the time to publish it and write it up to a reasonable degree so that other people can take a look at, if they wish.

They chose exactly the right tech for the job they intended - a fun experiment in a particular language and framework, and a write up based on that. They perhaps chose the wrong tech for your expectations?


You refresh rarely.

A lot of native games take longer than that to load.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: