Golang crossplatform game engine using mobile pkg?

1k Views Asked by At

Is it possible to create a crossplatform (mobile + destkop) game engine using the Go mobile package resources? Or it is somehow tied to gomobile and mobile architectures?

The first problem is the fact that glsprite and other rendering packages I would be using are built on top of OpenGL ES, so I would have to ignore everything that is gl and use only more generic packages like https://godoc.org/golang.org/x/mobile/exp/sprite/portable? Or I could still use glsprite near-seamlessly when targeting mobile?

Theorically audio should cross-compile fine with https://godoc.org/golang.org/x/mobile/exp/audio?

Is it doable/viable? Or too much hassle?

1

There are 1 best solutions below

0
On

Last time i tried gomobile opengl on windows, it didnt work. I was only able to compile for android. Maybe this bug is fixed now, not sure..

However; for cross platform you could simply use gomobile for mobile platforms and create an interface for generic opengl on desktop and you would seamlessly have both. Just abstract out the interface between regular opengl and gomobile opengl es.

update:

actually just tried to run the "basic" example using go run and it worked on windows. So the bug must of been fixed. So in your response, yes it is possible to use go mobile x for cross platform mobile + desktop:

https://github.com/golang/mobile/blob/master/example/basic/main.go

However; audio does NOT compile on windows due to linux specific Open AL libraries. If you look at the build flags, darwin, linux only, no windows.