3 ms·
I'm using it to build a world server for a multiplayer game. A lot of people suggest Scala/Java, Erlang, or Node.js for this, but I'm using Go. Go has a good,
by unoti 15y ago
I'm using it to build a world server for a multiplayer game. A lot of people suggest Scala/Java, Erlang, or Node.js for this, but I'm using Go. Go has a good, efficient memory model that lets me simulate a heck of a lot more of my world per megabyte of RAM. In today's world of hosting, that translates into a huge impact on how many dollars per user/hour we need to pay to run our game. That can have a direct translation into what kinds of business models can, and cannot, work for a game design. I've actually written rudimentary versions of my world server in all of the languages I mentioned above, and Go is by far the best in terms of what I can do with memory.
Go makes it very easy to communicate between nodes, almost as easy as what you can do in Erlang. Doozer is a library in Go for coordination of the activities of many machines, a lot like Zookeeper. Between Doozer and Netchan, Go is a really solid choice for making a system like a world simulator that needs to be distributed among many computers.
Go is also better than Node.js for things that require manipulating binary data. For example, I have some communications back and forth where the server is in Go, the client is in Python, and they talk using Protocol Buffers. Javascript doesn't do binary (at all? not very well?) like Go or Java can. There is an experimental protocol buffer library in Javascript, but in general Javascript needs to kind of bend over backwards to work with binary data. It's possible to do it, but it's not natural or efficient.
In general, if you care about memory usage, working with binary data, tons of simultaneous threads/actors, building distributed systems, then Go is a great choice, especially if you want to do more than one of the above.
- hungrycoder 15y agoWould love to hear more in the form of a blog post; perhaps when the world server has shipped. +1 on memory usage. OOM is a killer for long running apps (pun intended)