Golang Game Programming Question

Started by
2 comments, last by kd7tck 11 years, 3 months ago

Recently I have considered using golang as the basis for a game runtime. I was tinkering with the idea of wrapping SFML into a Go library and linking in game modules written in GO. I was wondering if anyone had any experience with golang and had any advice for me.

For example, is it a good idea to place the game loop on the C/C++ side, or keep it on the Go side?

I use <extern void go_func_name() __asm__ ("package_name.function_name");> as the basis for calling over into go. Are there more efficient ways of doing this? What if I do not know the name of the package/function at compile time?

Advertisement

Even if C++ will be a bit faster for runtime generated code, because compilers are more mature, and it has more features that are often the optimal way of doing them when you absolutely have to use them. (it was a conclusion of google when benchmarking different languages)

I would not use performance as a criterion to separate code into both languages.

if you want to make a game in Go, just do everything in GO, why not ? at least you have the advantage of having a very fast compilation, a clean grammar that allows inteli-sense-like tools to work as excpected (and not broken like with C++). this could reveal important for project dev speed.

Initially, I was using Lua (LuaJIT, and nginx/LuaJIT) for everything server-side, but was hitting way too many compatibility issues where 3rd party libraries weren't working with each other.

I switched to Go for the server-side, even including the webserver, and it is working like a charm. The performance is extremely good (fairly close to C levels) but the big thing is productivity is high as it has all the newer language features and in general is well thought out. Like any language, it has its nuances, and I'm still not really used to its different OO'ish mechanisms, but in general things "just work" including the easiest multitasking I've seen.

While it doesn't have nearly the same depth of library as common languages like Java, Perl etc, I find that the few it has tend to be exactly the ones I need and are well thought out. Some of the most common ones (web serving, sockets, Templates) are built right into the main language library and are easy to use.

Even if C++ will be a bit faster for runtime generated code, because compilers are more mature, and it has more features that are often the optimal way of doing them when you absolutely have to use them. (it was a conclusion of google when benchmarking different languages)

I would not use performance as a criterion to separate code into both languages.

if you want to make a game in Go, just do everything in GO, why not ? at least you have the advantage of having a very fast compilation, a clean grammar that allows inteli-sense-like tools to work as excpected (and not broken like with C++). this could reveal important for project dev speed.

I want the game logic done with Go packages linked in after the fact, and the runtime will be partly C and Go. I am not certain how to do all of it in Go. It seems some things are easier with C libs linked in.

This topic is closed to new replies.

Advertisement