cocos2d and golang

do you have any plans for bind golang in cocos?

I would bet the answer is no, but that shouldn’t stop you from trying to create the bindings yourself. Are you looking for something similar to the OpenGL bindings? Or writing golang for the game logic on top of the core engine?

It may be interesting? I played around with golang for a few months around GopherCon and there’s definitely bindings for SDL and OpenGL that I found which I’m sure have only improved since then. It is an excellent choice for writing the backend server of a networked game. I’m curious if it would improve anything on the front-end by interfacing with the current Cocos2d-x engine framework. I’m not sure it would provide a whole lot of benefit other than someone who prefers golang over c++?

Go is a simple programming language. COCOS API is very good but I’m not a C++ programmer
Mobile support will be completed in go 1.5.


I think is very good plan to bind golang in cocos

Cool, I didn’t realize mobile support was near ready. That said I believe Go binds well with C, but not necessarily C++? Have you seen projects binding Go with other C++ code frameworks?

Edit: I guess people have started creating bindings for Qt and OpenCV among others mostly using SWIG.


http://www.swig.org/Doc2.0/Go.html

There has been some discussion if Swift-lang ever goes open source that it’d be an interesting choice as well for bindings. As long as the bindings are easily maintained through auto-generation (similar to how Lua/JSB are currently setup) then I don’t foresee any issue supporting more bindings. That said those bindings wouldn’t be built with Go’s architecture and programming patterns in mind.

You should learn c++ by creating Golang bindings for cocos2d-x :smiley:

1 Like

Go internal Support bind C,C++ with cgo, No need SWIG or any other binding tools
https://golang.org/cmd/cgo/

1 Like

Anyone can help to bind cocos in golang?

Does GO is interpreted or it using some sort of JVM ?
what are the benefits of GO over js or lua ?

GO is compiler language like C++.
Some Important benefits:
1- Performance
2- Use C/C++ in Go Without pain.

1 Like

It’s main benefits are writing concurrent programs with simpler syntax and code patterns (and performance since the core language and runtime were built to provide this). There are some interesting ideas based on the CSP model (https://golang.org/doc/faq) and also being an interface-oriented instead of object-oriented language. I’m not sure at this time that there’s a lot of benefit other than allowing one to write in Go syntax and patterns for parts or all of the game logic?

@vahid4134 - are you looking to write your entire game logic in Go (everything you’d write above the Sprite/Node and Rendering layer of cocos2d-x)? The performance loss of Lua is usually insignificant except for a few instances where you might gain performance by converting some code back into c++, so I’m not sure Go would give you much in the way of performance on the game logic side. However, if you can utilize coroutines (Lua), workers (JS), or Goroutines (Go), that may help more than moving something back down into c++.

A Go-specific fork of the engine (say cocos2d-Go) would be a pretty large task if you want the engine and game logic to be written using Go patterns.

If you just want simple matching bindings I would say you’ll probably have to take up the torch and work on them yourself for now. If you setup a repo I’d be interested in testing and maybe helping out, but it’ll have to get off the ground first.

@stevetranby Thanks.
I not start game Development in GO . I decide to learn and develop in C++ but very Interest to develop in GO.
If any repo to bind GO I can help.

if GO is easy as js or lua and it is compiled as C++ to machine code without any thing in the middle so its Big advantage in preference .

@Meir_yanovich I’m not sure GO is easy as js or lua But it is easy as C++.

Yes I think it is big advantage in preference.

ok reading and diving into GO , i must say its very very interesting its has cross compilation option
that is compile in linux / mac for windows . …
the syntax remind me Apple Swift with light c++ .
so what is the benefits of making GO binding ? in cocos2d-x engine ?

@Meir_yanovich in top @stevetranby talk about benefits use go ;

Go 1.5 released with mobile support.
dos any plan for bind golang?

I’m always interested in using different languages, but I’m still not convinced Go would be that useful for most client-only static games. As a server in a multiplayer game system it makes a lot of sense. It also would make sense in a highly parallel game where goroutines can be utilized to their fullest.

However, I would think Swift would be the better fit in mapping cocos2d-x design and architecture.

I wouldn’t hold your breath on getting bindings anytime soon, especially when Go Mobile is still experimental, but if you go and create an example game maybe that would help nudge things in the right direction.

Reference:


https://godoc.org/golang.org/x/mobile

I’ve only tested trying to work with a simple ObjC/Swift binding layer. Partly because I use those two in non-game mobile development. Maybe TypeScript is enough structure to get most of the benefits of Swift without having to wait on bindings?

In the short-term I would say if you love Go use it for all your automation scripting and tools. Write all your server code in it.

2c