Hacker News new | ask | show | jobs
by nottorp 3058 days ago
Ouch. Not so interesting after all then.

Does Go even have some "standard" SDL bindings? I was googling the other day (with the aim of learning Go through doing something fun) and I found like 6 results only on the first page. Didn't go and try any of them because to be honest that's depressing... i bet that if there are 6 different bindings none is feature complete.

Is Go useful just for server side stuff then?

5 comments

Go has an excellent set of SDL2 bindings: https://github.com/veandco/go-sdl2

They do a very good job of making the API relatively idiomatic to Go without adding overhead, and I haven't run into any bugs yet.

I have been using them as part of a twitch series that teaches programming via small game projects. I go through how to get SDL2 up and running in episode 6:

https://www.twitch.tv/jackmott42/videos/all

There are aspects of Go that should make it better for game related programming. The low latency GC is a very good thing, compiling to native binaries means quicker start up time, and better responsiveness than a JIT, and easier distribution. Fast compile times are also very nice for many game programming workflows.

Awesome. Thanks for the link to those videos, I plan to watch them all.
There's nothing about Go that makes GUI programming hard, it just hasn't taken off. Probably because maintaining bindings isn't fun, and bindings are rarely pleasant to use (impedance between C and the host language). And writing a decent GUI toolkit from scratch is a huge amount of work. Besides, competition from web apps and things like electron is eating GUI apps' lunch, regardless of programming language.

Go is a general purpose programming language, so it's suitable for basically anything in the Java/Python/.Net world modulo availability of libraries.

https://github.com/go-gl has opengl and glfw bindings which would serve many of the same purposes.
See? That's the problem. Two different bindings recommended already. Better than 6 tbh, i might look at those 2.

And to the twitch guy I'm sorry, I'm old enough to prefer written documentation :)

opengl and SDL are different things.

glfw and SDL are similar things, in that one may use one or the other to do basic operating system tasks like "get a window" which you can then draw to with opengl (or vulkan or whatever)

Even if you were programming in C++ you would have the choice between glfw or SDL for that kind of thing (or directly talking to your operating system's API!), so Go is not adding any confusion here that doesn't exist already.

I talk a bit about this in the EP 6 stream that you are too old for =) (I prefer written docs too! EDIT here: https://www.khronos.org/opengl/wiki/Related_toolkits_and_API... )

I know, except SDL also has OpenGL support ;) Plus enough stuff to handle the rest of your game.

My main confusion is I know some SDL and OpenGL, but no Go. Thus, I don't know how to choose a SDL binding. Fighting with the binding is not a good thing when you want to learn a new language by doing a space invaders clone :)

https://github.com/veandco/go-sdl2 is the SDL binding most people are using. It is solid.
Replying to myself because I can't reply to my reply - guess too many reply levels.

Thank you mr/mrs/whatever gameswithgo! That's what I wanted to hear!

>See? That's the problem. Two different bindings recommended already.

You were recommended one binding for SDL and one for GL. Obviously they're different.

Ah sorry, my bad. I thought that since i asked about SDL bindings i got recommendations for SDL bindings ;)
Flappy Gopher[1] uses SDL and comes with an instructional video for the beginners.

[1] https://github.com/campoy/flappy-gopher