3

I'm designing a game, but this question is applicable to any situation that requires bidirectional communication between nodes in a cluster and a main server. I am pretty new to clusters, but I actively program in Go and occasionally in D.

I really want to use a modern language (not C/C++), so I've chosen these two languages because:

  • Array slices
  • Good concurrency support
  • Cross platform & compiles natively (with multiple compiler implementations)
  • GC (both working on a precise GC)

I've read https://stackoverflow.com/questions/3554956/d-versus-go-comparison and The D Programming Language for Game Development.

At a high level, my game will do most of the processing server side, with the client just rendering the game state from their perspective. The game is designed to scale, so it will need to act in a cluster. Components are mostly CPU bound, and update to a main server asynchronously, which shares game state with clients. Most computation depends on user input, so these events need to be sent down to individual components (hence bi-directional RPC).

Reasons I like D:

  • Manual memory management
  • Templates/CTFE
  • Code safety (@safe, contracts, in/out)

Reasons I like Go:

  • Standard library (pprof, RPC)
  • Go routines
  • go tool (esp. go get -u to install/update remote dependencies)

The client will likely be written in D, but that shouldn't have an impact on the server.

I am leaning towards D because manual memory management is baked into the language. While it doesn't have the nice libraries for RPC, I could theoretically implement that, but I cannot as elegantly implement manual memory management in Go.

Which would you use for this problem given the choice between the two languages?

Community
  • 1
  • 1
beatgammit
  • 19,817
  • 19
  • 86
  • 129
  • 1
    It really doesn't matter. Pick the one you like more and start coding! – Brendan Long Sep 14 '12 at 20:36
  • 1
    @BrendanLong - that's part of the problem, I like them both! I'm just looking for some guidance to nudge me one way or another, preferably from someone with experience in cluster/game design. – beatgammit Sep 14 '12 at 20:53
  • 1
    Even though the question is not really constructive (by this site's definition), it's well formulated, and one can see that the author put considerable effort to studying the field, so it's pleasing to read. Kudos for that. – kostix Sep 17 '12 at 15:19

2 Answers2

5

I expect that either will work and that a lot of it depends on which you prefer, though if you're doing the client in D, I'd advise doing the server in D simply because then there are fewer languages involved. If you use two languages, then anyone working on your project generally has to know them both, and both Go and D are small enough in terms of their user base at this point that few people will know both - though if it's just you working on it, you obviously know both of them already.

However, I would point out that if the problem with using D is the lack of an RPC library, then that isn't a problem, because D is supported by Apache Thrift. So, D does have a solid RPC library, even if it's not in its standard library (in fact, it was one of the fruits of D's first round of participation in Google's Summer of Code).

Jonathan M Davis
  • 37,181
  • 17
  • 72
  • 102
  • Yeah, I saw Thrift, but I didn't know if it worked across networks (it looked like glue between languages at the top level). I think this may answer my question. – beatgammit Sep 14 '12 at 21:48
0

I do not know anything about your game, If good concurrency for your server is important then I vote for Go.

I developed communication server in Go that implements communication with PUSH technology. Go is great in for such tasks. Compact clean code that is easy to understand.

Automated memory is important in concurrent apps.

Client apps are not so concurrent like server apps. Client apps should keep constantly high frame rate.

So manual memory management without global GC locks are better for client apps.

Max
  • 6,286
  • 5
  • 44
  • 86