Difference between revisions of "Go"

From RogueBasin
Jump to navigation Jump to search
m (Updates version info)
m (Update Go version)
(4 intermediate revisions by 3 users not shown)
Line 2: Line 2:
|company = Google
|company = Google
|influences = C, Pascal, Python, Smalltalk
|influences = C, Pascal, Python, Smalltalk
|updated = 2016-09-07 (1.7.1)
|updated = 2018-12-14 (1.11.4)
|status = Stable
|status = Stable
|licensing = Open Source (BSD-style)
|licensing = Open Source (BSD-style)
Line 11: Line 11:
Go (or ''golang'') is a general-purpose, statically typed compiled language, with garbage-collection and explicit support for concurrent programming, that has been created at Google by Rob Pike, Ken Thompson, and Robert Griesemer since 2007. It was born from the developers' frustration with developing concurrent server applications with C++.
Go (or ''golang'') is a general-purpose, statically typed compiled language, with garbage-collection and explicit support for concurrent programming, that has been created at Google by Rob Pike, Ken Thompson, and Robert Griesemer since 2007. It was born from the developers' frustration with developing concurrent server applications with C++.


First announced by Google in 2009, version 1.0.0 was released in March 2012, and they currently follow a 6 month release cycle, with new versions being released on February 1 and August 1, so the language should be a stable target for future applications.
First announced at [https://www.youtube.com/watch?v=rKnDgT73v8s Google Tech Talks] (YouTube), in October 2009, version 1.0.0 was released in March 2012, and they currently follow a 6 month release cycle, with new major versions being released on February 1 and August 1, so the language should be a stable target for future applications.


== Roguelike Development ==
== Roguelike Development ==
Line 18: Line 18:


* Easy to learn - a simple language with a small number of keywords.
* Easy to learn - a simple language with a small number of keywords.
* Garbage Collection for memory safety.
* Garbage Collection.
* Fast - almost as fast as Java, considerably faster than Python.
* Fast - almost as fast as Java, considerably faster than Python.
* Super fast compile speeds - often just a few seconds, which compared to compiling C++ code, is several orders of magnitude faster.
* Super fast compile speeds - often just a few seconds, which compared to compiling C++ code, is several orders of magnitude faster.
Line 29: Line 29:
One of the more recent additions to the language that may bring great benefits to roguelike developers is the ability to cross compile for different OS. This means that a game being developed on a macOS system, can compile for Windows and Linux without the need to boot into those operating systems. In the future it will also be possible to use Go to target Android devices.
One of the more recent additions to the language that may bring great benefits to roguelike developers is the ability to cross compile for different OS. This means that a game being developed on a macOS system, can compile for Windows and Linux without the need to boot into those operating systems. In the future it will also be possible to use Go to target Android devices.


There is also good FFI support for linking to external C libraries like SDL and Curses. Calling C code from Go is reasonably straightforward.
There is also good FFI support for linking to external C libraries like SDL and Curses. Calling C code from Go is reasonably straightforward.  


For Go developers who wish to use Curses, there is the [https://github.com/rthornton128/goncurses goncurses] library, however a good alternative is the excellent [https://github.com/nsf/termbox-go Termbox-Go], which provides a cross platform lightweight ncurses-like API written in pure Go.
For Go developers who wish to use Curses, there is the [https://github.com/rthornton128/goncurses goncurses] library, however a good alternative is the excellent [https://github.com/nsf/termbox-go Termbox-Go], which provides a cross platform lightweight ncurses-like API written in pure Go.
[http://foo.wyrd.name/en:bearlibterminal/ BearLibTerminal] is compact, display-centered API for roguelike developers. It supports Go bindings officially.
If you don't want to rely on a binding or stay in the terminal you can try out [[ramen]]. It's a simple console emulator written go and inspired by libtcod.
==References==
{{Reflist}}


== Related Links ==
== Related Links ==

Revision as of 18:42, 16 January 2019

Go
Programming Language
Company Google
Influences C, Pascal, Python, Smalltalk
Updated 2018-12-14 (1.11.4)
Status Stable
Licensing Open Source (BSD-style)
Platforms Linux, OS X, Windows, FreeBSD, Plan 9, Solaris
Official site of Go



Go (or golang) is a general-purpose, statically typed compiled language, with garbage-collection and explicit support for concurrent programming, that has been created at Google by Rob Pike, Ken Thompson, and Robert Griesemer since 2007. It was born from the developers' frustration with developing concurrent server applications with C++.

First announced at Google Tech Talks (YouTube), in October 2009, version 1.0.0 was released in March 2012, and they currently follow a 6 month release cycle, with new major versions being released on February 1 and August 1, so the language should be a stable target for future applications.

Roguelike Development

Go has a number of features that can be desirable to the roguelike developer:

  • Easy to learn - a simple language with a small number of keywords.
  • Garbage Collection.
  • Fast - almost as fast as Java, considerably faster than Python.
  • Super fast compile speeds - often just a few seconds, which compared to compiling C++ code, is several orders of magnitude faster.
  • Compiles to a native OS binary, allowing you to keep you source code private.

The language has a reasonably simple duck-typing-based interface system, which can lead to very clean reusable code. However, Go does not currently have any form of parametric polymorphism so programmers who are reliant on generics in their data model may have some trouble.

The concurrent features such as channels and goroutines are powerful, but often are not much needed in main roguelike logic, which is generally very sequential. That said, several areas could gain some benefits, such as game initialisation, dungeon generation, user interface, and other features that can run asynchronously with the game logic.

One of the more recent additions to the language that may bring great benefits to roguelike developers is the ability to cross compile for different OS. This means that a game being developed on a macOS system, can compile for Windows and Linux without the need to boot into those operating systems. In the future it will also be possible to use Go to target Android devices.

There is also good FFI support for linking to external C libraries like SDL and Curses. Calling C code from Go is reasonably straightforward.

For Go developers who wish to use Curses, there is the goncurses library, however a good alternative is the excellent Termbox-Go, which provides a cross platform lightweight ncurses-like API written in pure Go.

BearLibTerminal is compact, display-centered API for roguelike developers. It supports Go bindings officially.

If you don't want to rely on a binding or stay in the terminal you can try out ramen. It's a simple console emulator written go and inspired by libtcod.

References

Template:Reflist

Related Links