News for hackers. Stuff that matters.
Re:Create a simple cross-platform desktop game with Go by Sir_Cmpwn on Saturday August 18, 2018 @09:18AM (#17788314)
I've been tinkering with writing a simple game in Golang as well. I don't think it's a good idea to lob in an entire web browser for a game, though. I've been using the go-gl stack:

https://github.com/go-gl

They have a wrapper for GLFW and OpenGL, I've been using GLES2 which has good compatability with everything. You have to be prepared to learn how to write shaders and use OpenGL, though, so it can be a bit intimidating. Here's the (extremely incomplete and very bad) game I have so far:

http://git.sr.ht/~sircmpwn/freefood

Re:Create a simple cross-platform desktop game with Go by gameswithgo on Saturday August 18, 2018 @11:14AM (#17788834)
If you are doing 2d you can also do quite well with just the SDL2 wrapper. That gives you enough to do cross platform sound, input, and putting textures on the screen with alpha blending and bilinear interp. So its enough to make mario/ultima/baldurs gate/ style things.
Re:Create a simple cross-platform desktop game with Go by Sir_Cmpwn on Saturday August 18, 2018 @11:23AM (#17788880)
Personally I find SDL far too limiting. As soon as you want to write even one shader you have to write all of the graphics code yourself, and at that point it's hardly better than GLFW.
Re:Create a simple cross-platform desktop game with Go by pravj on Saturday August 18, 2018 @03:32AM (#17787334)
Wasn't aware of the mentioned "webview" wrapper[1], considering to use it for a side project.

Reminds me of the time I created an improved version of the "8-puzzle"[1] game in Go to learn about "channels" and "goroutines". Especially, the use of "select" statement for listening on multiple channels for the main event loop.

[1] https://github.com/zserge/webview

[2] https://github.com/pravj/puzzl

Re:Create a simple cross-platform desktop game with Go by akavel on Saturday August 18, 2018 @09:21AM (#17788324)
See also https://github.com/oakmound/oak if you are interested in a pure-Go library (i.e. one which doesn't need cgo) with no HTML & JS dependencies. (Disclaimer: haven't used it so not sure what's the status; but reportedly it's been used by its author to write a game.)
Re:Create a simple cross-platform desktop game with Go by justinclift on Saturday August 18, 2018 @06:16PM (#17791119)
Tried out the examples bundled with it, and for what it is it seems ok. Looks 2D only (not 3D capable), but if that's the desired target then it's probably a decent choice. :)
Re:Create a simple cross-platform desktop game with Go by splitbrain on Saturday August 18, 2018 @06:11AM (#17787794)
Interesting, though what this actually does is run a local webserver so I assume it would be even simpler to just open the default web browser pointed to the local server? But then you start thinking that sound output could also be handled via the audio API and one could even play this remotely. So what you created is a webapp? Why even run it locally at all then... just some thoughts. Still a cool idea to circumvent the lack of good native UI support in go I guess.
Re:Create a simple cross-platform desktop game with Go by zserge on Saturday August 18, 2018 @09:59AM (#17788484)
Webview author here. It does not require local web server actually, it allows to inject js, css, HTML in runtime and bind go structs to is objects through the API, so the result is a self contained web app with no server. Although using a local web server may be more convenient to most web developers.
Re:Create a simple cross-platform desktop game with Go by sausheong on Saturday August 18, 2018 @11:40PM (#17792433)
I wrote the blog post, thanks Serge for the great library! I considered the self-contained app without the web server method, but I've already done the images before and I'm way more comfortable with Go web programming (I wrote that book too).
Re:Create a simple cross-platform desktop game with Go by pier25 on Saturday August 18, 2018 @11:35AM (#17788941)
Why IE and not Edge for Windows?
Re:Create a simple cross-platform desktop game with Go by zserge on Saturday August 18, 2018 @01:00PM (#17789375)
Integrating Edge is my dream. However there is no C API unlike MSHTML. I still have hopes on cppwinrt though. Any help in this direction is highly appreciated.
Re:Create a simple cross-platform desktop game with Go by messe on Saturday August 18, 2018 @06:14AM (#17787803)
> Why even run it locally at all then

Latency?

Re:Create a simple cross-platform desktop game with Go by TeddyDD on Saturday August 18, 2018 @11:50AM (#17789009)
Another good option is to use Raylib bindigs: https://github.com/gen2brain/raylib-go

No need for HTML/js and API is pretty simple

Re:Create a simple cross-platform desktop game with Go by justinclift on Saturday August 18, 2018 @06:20PM (#17791143)
Oh, this does look interesting. It mentions support for OpenGL ES 2.0, which (I think) means it'll work with the native OpenGL drivers for the Raspberry Pi family.

Could be a good combination for people. :)

Re:Create a simple cross-platform desktop game with Go by justinclift on Saturday August 18, 2018 @06:43PM (#17791247)
It turns out there are even Raspberry Pi specific examples in their docs:

https://github.com/gen2brain/raylib-go/tree/master/examples/...

Re:Create a simple cross-platform desktop game with Go by holografix on Saturday August 18, 2018 @01:01PM (#17789378)
Re:Create a simple cross-platform desktop game with Go by gameswithgo on Saturday August 18, 2018 @09:52AM (#17788459)
You may also enjoy: https://gameswithgo.org/

A video series where I teach programming via game projects. We do some software rendering, some SDL2, simplex noise, 2d rpgs, and some 3d opengl.

Re:Create a simple cross-platform desktop game with Go by geoka9 on Saturday August 18, 2018 @01:24PM (#17789507)
Not sure about game programming, but I really liked this for a portable browser-based GUI for my Go apps:

https://github.com/icza/gowut/wiki

Re:Create a simple cross-platform desktop game with Go by justinclift on Saturday August 18, 2018 @07:10AM (#17787958)
For cross platform game / 3D development in Go, there are a few frameworks and libraries already in place:

https://github.com/avelino/awesome-go#game-development

g3n seems like the most promising recent candidate:

http://g3n.rocks

https://github.com/g3n/engine

Azul3D used to be a promising candidate, but looks to be very dead now. :(

Re:Create a simple cross-platform desktop game with Go by gameswithgo on Saturday August 18, 2018 @09:51AM (#17788453)
SDL2 + OpenGL as well
Re:Create a simple cross-platform desktop game with Go by alienspaces on Saturday August 18, 2018 @05:20AM (#17787635)
This is cool, thanks for sharing!