• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
SteveDeFact0

Go for video game programming?

19 posts in this topic

I was watching a presentation on Go and I started wondering if it would be more efficient than C++ for my game engine? I mean obviously multithreading can be done in C++ but it would appear that Go would streamline the process. So really my question is does Go have any down side? Like for example even though a language like C# or Visual Basic is easier to use, grabage collection amoung other things tends to make it run much slower than a program written in C++. So is there anything simular to that with Go?

0

Share this post


Link to post
Share on other sites

There's nothing intrinsically wrong with it, but I personally don't like Go's hardline stance against generics.  It's a painful productivity miss.
 

Of all the "C/C++ esque" languages that have cropped up in recent years, D honestly seems to have the best basis along with Go (though Rust is certainly interesting).  That's probably the only language out there where you can write code and say "...did I just accidentally do template metaprogramming?"  It's liberating.

0

Share this post


Link to post
Share on other sites

I am using Go for a pet 3D project and I also use it in production for the server side of my latest game... here's my recap:

 

PRO

 

- Build system.. it's pure awesomeness: no makefiles, super fast compile times, good package managing with Git integration out of the box

- Fast and getting faster for code written in Go at every release.. for most common task it's almost with C++ at least from my benchmarks.

- Easy to interface C libraries. C++ interface exist but I haven't tried it yet

- Very simple to learn.. it's a very small language

- Duck typing.

- Great support for massive concurrency

- Gofmt.. forces an unique style of code formatting: the Go style. All Go code on the planet is formatted the same way.. this hugely improves readability.

- Good IDE support. I use LiteIDE ( https://code.google.com/p/liteide/ ) It's designed exclusively for Go and it's awesome. There are Go "modes" for Emacs, Vi, Eclipse, Sublime Text and a lot more.. and, because of go "no makefiles" "no project files" approach, it's one of the few languages you can really use without and IDE. Although I really suggest LiteIDE.

 

CONS

- No operator overloading. 3D math code looks ugly

- No function overloading.. need to use suffixes a-la OpenGL

- Calling C is somehow expensive.. there are ways to go around the problem but it is something to keep in mind when doing 3D work... every API call comes with an attached cost. Due to the language current architecture this cost doesn't seem to be likely to go away.

- Only supports "desktop" environments (Win, Linux, Mac) no Android yet (but there are somethings moving there and the presence of Google might do good things) or other mobile, no consoles support.

 

I don't take sides on the great "Go generics" war on the internet.. I find I can happily live without, but I wouldn't mind them either IF they can be implemented without bloating the language.

All in all, it's a joy to use Go although its minimalist approach often translates in a LOT of code repetition.. but it's beautiful code nevertheless. It's also a language that "trusts" the programmer.. it's a different philosophy of design.. where other languages seem to push programmers into writing in a way as to defend themselves from an horde of maniacs by having constructors, lots of level of encapsulation and so on.. Go's is much more permissive and it relies more on common sense and code documentation.

It's a programmers' for programmers language.. more practical and pragmatic than theoretically fit.

 

I agree with people suggesting Rust as another possible future language for game development.. it offers several advantages compared to Go but it comes with a much steeper learning curve (closer to C++ and D) with a less clear syntax compared to Go... plus while Rust is still highly volatile and constantly changing, Go has been ready and used for production for a couple of years.

Edited by kunos
1

Share this post


Link to post
Share on other sites


My core problem with D in this respect is that it *is* just a C++ clone with some (but far from all) rough edges rounded off.

 

Hah!  In fact, that's what I love about it.  C++ with all the C warts removed is already a fantastic language.  Throw in all the range and slicing stuffs and array manipulation gets as easy as python.  Stuff like Static If actually realizes some of the benefits over generics for people who aren't experts at the C++ labyrinth.  IMO the biggest problem with D is that the GC is basically required if you want to use the standard library.

 

I need to clarify a bit, probably.  While I don't like Rust for a variety of reasons, or Go because of generics, all three are head over heels better than most current "low level languages" out there.  Libraries are a bit lacking for all of them, but if you want something different you can't go wrong with any of them.

 


- Build system.. it's pure awesomeness: no makefiles, super fast compile times, good package managing with Git integration out of the box

 

D has something like this as well (and they even made rdmd as a sort of "joke repl" because of how fast it compiles), though you need dub for good package management.  Not putting down Go or anything mind you, and Rust probably has something similar.  Going away from the C compilation model is the best thing that can happen to a language, and I'm glad to see its finally happening.

0

Share this post


Link to post
Share on other sites

 

D has something like this as well (and they even made rdmd as a sort of "joke repl" because of how fast it compiles), though you need dub for good package management.  Not putting down Go or anything mind you, and Rust probably has something similar.  Going away from the C compilation model is the best thing that can happen to a language, and I'm glad to see its finally happening.

 

 

My only experiences with D were using Visual D, so I was somehow isolated from the build process. I tried Rust some days ago and ya.. it was able to figure out what files needed to be included in the build process... but I only tried with 2 files so I am not able to confirm how it works for bigger projects.

 

From what I see D has a lot of "nice little things" here and there.. its main attraction is metaprogramming which is way over the head of most devs, people don't really care... it doesn't really have a WoW factor in there and the community looks small and not very vocal nor active, it suffers the fact that it's not saying anything new or interesting.. it looks to me almost as a native C#. Plus it has a bad name that is almost a joke and the docs are not really up there with the competition.

 

Rust (talking about bad names :P what were they thinking? ) also seems to miss the commercial Wow factor.. the slogans are mostly about safety here and there.. a lot of good promises but mostly found in other languages. We'll see what happens when they go v1.0.. but I have a feeling that as of today, if programmers have to face something too complicate they'll just stick with what they have: C++ . The nice bullet in Rust's gun is their potential killer application: Servo.. the new Mozilla browser.. if that will ever come true.

 

Go and the Go community on the other hand, are doing a much better job IMO in promoting the language.. the Go tour is fantastic and there are very interesting tutorials and how-to popping up very often..  plus, the fact that Go has so many controversial features (or lack of) it never fails to generate discussion.. it's a language with a big attitude and I think that is also helping in building a following... it's pushing the right concurrency button. The language seems to be such a perfect fit for something coming out of Google.. it's a big association in people's minds... and, most important thing: once you give it a try, it's hard not to be hooked.

0

Share this post


Link to post
Share on other sites

Rust (talking about bad names tongue.png what were they thinking? ) also seems to miss the commercial Wow factor.. the slogans are mostly about safety here and there.

But that's exactly what developers *should* want. The hard problems in software development aren't addressed by cute little syntactic tricks like C++ template metaprogramming. The hard problems are in highly-concurrent distributed systems requiring high availability and having a low tolerance for failure.

It's precisely this sort of thing that Rust's feature set targets. Unique ownership semantics and implicit/explicit region control allows you to achieve near-automatic memory management without the non-deterministic pauses caused by garbage collectors. Lightweight cooperative multitasking with task-local state is the best know model for highly concurrent systems, especially distributed systems. Tasks also provide a coarse-grained alternative to exception handling, which side-steps the issues of stack annotation and unwinding, and allows you to reboot the entire task on demand in response to failure.

Now, Rust does not actually tick all these boxes at the present moment. For example, their support for async network communication is still pretty much non-existant. But they have a vision here that can drastically improve the process of writing reliable, distributed software. With the obvious caveat that most of the world will go on using whatever technology they currently use, unless it proves a real competitive advantage for companies which embrace it...
1

Share this post


Link to post
Share on other sites

AFAIK the problem isn't one of "garbage collected language" vs "non garbage collected language". Problem is that Go's particular implementation isn't the fastest around. There isn't a single garbage collection method that all GC'd languages use, they're all different and are targeted for probably different use cases.

 

For example: http://benchmarksgame.alioth.debian.org/

 

If you compare Go's performance with other garbage collected languages (C# on Mono, F# on Mono, Java, Scala, etc) in those benchmarks, you get pretty different results. With Mono based languages its mostly 50/50, whereas with JVM based languages it compares unfavorably on most cases.

 

So even among GC'd languages you can find wildly different results, just like you can't expect to see the same results among compiled languages.

 

I'm not saying to take those numbers as the holy grail of programming language comparisons, but just to show that it isn't just a decision between GC and no GC.

0

Share this post


Link to post
Share on other sites

 

Rust (talking about bad names tongue.png what were they thinking? ) also seems to miss the commercial Wow factor.. the slogans are mostly about safety here and there.

But that's exactly what developers *should* want.

 

 

Perhaps.. but the reality is that what programmers want is a language that doesn't get in the way of what I am doing.. and Go is sublime in this... it's actually funny to see the horrified reactions of language elitists and purist when confronted with the current success of Go :P 

 

We'll see what happens with Rust.. I haven't done any serious coding with it yet and I am not planning to until it goes v1.0 and feature an IDE support offering productivity aids like good intellisense (code completion), project navigation and refactoring.

We'll have to see how the rules and limitations on object ownership and all the other mechanism to improve safety will impact day by day productivity and "flow".. at the moment, the °periodic table of pointer types" in Rust is not too promising :P

0

Share this post


Link to post
Share on other sites

 

If you compare Go's performance with other garbage collected languages (C# on Mono, F# on Mono, Java, Scala, etc) in those benchmarks, you get pretty different results. With Mono based languages its mostly 50/50, whereas with JVM based languages it compares unfavorably on most cases.

 

 

true, but the good news is that Go is relatively speaking a very young language and it's closing that gap quickly with every new release as the focus is pretty much focused on performances right now. The JVM had had decades of man power dedicated to achieve the current level of performances.

0

Share this post


Link to post
Share on other sites

I want to be able to dispatch a bunch of GPU calls, then tell the runtime "hey, you've got 3ms to do as much incremental GC as you can".

 

ya I am always amazed at how this has never made into any language as far as I know.. that's EXACTLY what performance critical application need! it really looks like the perfect trade off between convenience of CG and performances. Treat the GC exactly as any other task (hopefully doable concurrently) that an app has to accomplish.

But, hey, what do I know? I make games and not compilers, I think (and hope) that there is a solid technical reason for not doing it this way.

Edited by kunos
0

Share this post


Link to post
Share on other sites

What's lacking is control. The GC based languages are horrified that the application might want to exercise any kind of control or hinting about what to GC and when.

And it's not just about 'when' or 'how long', it's also about 'where'.

Cache coherency is a big issue, and if you can't control the layout of your memory allocations, your work is cut out for you. Try allocating a contiguous array of 4x4 matrices in Java, and you'll rapidly start tearing your hair...

1

Share this post


Link to post
Share on other sites


My core problem with D in this respect is that it *is* just a C++ clone with some (but far from all) rough edges rounded off.
 
Sure it makes template metaprogramming simpler than C++, but it doesn't really add/enable a whole lot else. No native support for high concurrency, no attempt at a new memory model, no attempt to simplify or improve the basic programming model, and so forth...

 

All variables are thread-local by default; shared and immutable variables are the building blocks for concurrency and functional programming; library support for concurrency in the form of std.concurrency and std.parallelism; ranges (support both built-in and in the library); a growing subset of the language can be executed at compile time; compile-time and runtime introspection; template constraints; pluggable, component-based algorithms... I don't know when you last looked at it, but the D I know has got a bit more to it than C++. Though, it seems C++11 and C++14 have narrowed the gap. I expect that to continue with future versions of C++.

0

Share this post


Link to post
Share on other sites

The problem with GC in games isn't really performance, particularly for the indie crowd who are using those types of languages. At least, not directly. GC is plenty fast. What's lacking is control. The GC based languages are horrified that the application might want to exercise any kind of control or hinting about what to GC and when. I don't want random allocations to block and trigger GC. I want to be able to dispatch a bunch of GPU calls, then tell the runtime "hey, you've got 3ms to do as much incremental GC as you can". I want to be able to control the balance of GC time and convergence, and force full GC when required. I'd love to be able to tag objects explicitly with lifetime hints.

 

And frankly, I need to be able to rely on a consistent implementation underneath with known characteristics. I get why the language designers don't want this, but it's a huge practical problem for games. We NEED to be able to exercise real-time guarantees.

 

This is spot on.  It also makes me wonder if there is any research into timesliced GCs.  I'm not entirely sure if the productivity cost makes GCs even worth using at that point, but it does address the major sore in GCs in general, games or otherwise -- poor performance characteristics for real-time (hard or soft) applications.

0

Share this post


Link to post
Share on other sites

This is spot on.  It also makes me wonder if there is any research into timesliced GCs.  I'm not entirely sure if the productivity cost makes GCs even worth using at that point, but it does address the major sore in GCs in general, games or otherwise -- poor performance characteristics for real-time (hard or soft) applications.

Real-time GCs are really not all that uncommon, they just aren't very widely used outside of fields requiring hard-realtime performance.

 

For example, see this article by IBM re Java.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0