Google-apps
Hoofdmenu

Post a Comment On: C0DE517E

"2011 Current and Future programming languages for Videogames"

44 Comments -

1 – 44 of 44
Blogger triton said...

Great overview.

The biggest problem about using higher level languages is binding existing C++ code to them.

We still don't have a solution that works seamlessly, so you either have to drop back to C or use tools to generate C wrappers automatically (SWIG comes to mind).

I've recently been refactoring all my core C++ code to C, and binding it becomes so much easier, so my current approach is: C interfaces, C++ implementation, and C# to glue it all via Mono.

It's the least painful way I've found to integrate it all.

April 3, 2011 at 3:16 AM

Anonymous Anonymous said...

What about objective c? Well supported by gcc no?

April 3, 2011 at 8:35 AM

Anonymous nova77 said...

A lot of C++ blind spots have been fixed or amended in C++11, especially when it comes to noobs mistakes.

April 3, 2011 at 9:22 AM

Anonymous Lxcid said...

I'm definitely not as good as you but I would like to suggest considering objective c. Many ppl din realize that this language is being developed for longer than java and c#. It's like c++, but with very powerful metaprogramming. You almost feel like you are writing in a scripting language. It doesn't compile to byte code if I am not wrong. It's all c calls and a runtime. True that it's the combination of the apple API (core and cocoa) that make this language so powerful. my favorite concept is their autorelease and notification center. In Mac OS x it spot a garbage collector too. This language is a joy to write for me. you are free to write c codes or c++ codes in objective c. it's like writing asm in c or c++. I highly recommend.

April 3, 2011 at 10:41 AM

Blogger DEADC0DE said...

Nova77: yes sure, adding hundreds of pages to an already bloated standard and not deprecating or dropping compatibility towards a single thing surely helps a lot with that...

April 3, 2011 at 11:56 AM

Blogger DEADC0DE said...

Lxcid: I should look more into that, I don't know enough about ObjectiveC to write about it right now. I'll maybe add it later.

April 3, 2011 at 12:28 PM

Blogger DEADC0DE said...

triton: the real hard problem with binding is that our codebases most of the times are not modular enough. If there were well defined modules with minimal interfaces, then binding would be a very small problem. :/

April 3, 2011 at 12:30 PM

Blogger Nick said...

V8 also targets ARM6 and ARM7, but can't run on iOS due to not being able to set a page to executable.

I think it would be worthwhile for your summary to also mention memory usage characteristics. For example, last time I checked, many operations in Erlang causes a new alloc without a corresponding free; this pretty much rules it out as an embedded game language.

http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=erlang+memory+usage

April 3, 2011 at 2:59 PM

Blogger Nick said...

PS, overall I found your article a good read, thought I should mention that ;)

April 3, 2011 at 3:01 PM

Blogger Unknown said...

CubeScript initially was designed to just be stupidly simplistic while still being powerful: all code & data are strings, but that embodies very powerful closures, macros, dynamic scope and such (it is so expressive, it will make Scheme cry ;). All that in a fraction of the code of Lua, and easy to extend with new builtins.

It is SLOW however (see strings, above). The most recent version in the sauerbraten SVN has gained a bytecode interpreter, speeding it up an order of magnitude, at the cost of that whole simplicity thing.

April 3, 2011 at 8:56 PM

Blogger Unknown said...

In summary, I would NOT recommend anyone to use it, unless what you do can be described as "very expressive configuration" :)

April 3, 2011 at 9:09 PM

Blogger DEADC0DE said...

Wouter: cool, yes I understand when you are manipulating strings, it's easier to be "powerful", I wrote a string-rewriting based language for a build tools years ago and it was stupid, slow but fairly expressive.

Thanks for sharing here!

I also love your time tracking app, I've tried a commercial one a while ago, the idea is neat, super useful! I'll try the treesheets one tomorrow at work!

April 3, 2011 at 10:26 PM

Blogger NeARAZ said...

Just a note: at Unity we use CLI (Mono) as a game scripting language. All the underlying engine / runtime part is C/C++. Some editor tools are C#, some C++. So at least in some cases, CLI/C#/Mono could be moved up to the "scripting languages" category.

April 4, 2011 at 12:59 AM

Blogger triton said...

Nick: I think in the new iOS you can enable the execute bit for pages, and thus execute JITed code. They also use a JIT now in the WebKit JavaScript engine.

NeARAZ: I'm curious, how do you bind the code at Unity? Do you use p/Invoke or register internal Mono functions? And do you auto-generate the wrappers with SWIG / custom tool?

April 4, 2011 at 2:28 AM

Anonymous nova77 said...

@DEADC0DE: I am not sure to understand the sarcasm. There's many good reasons to keep compatibility and a lot of the introduced features (auto, foreach, lambda, etc..) will make the code cleaner and easier to understand for noobs.

Regarding 'adding new features', one of the big issues of C++ is the flurry of implementations to do basic things that were not covered by the standard. How many threads libraries do you know? I am all for putting such things under the same umbrella.

April 4, 2011 at 3:10 AM

Anonymous Alex S. said...

This is a great overview! Thanks for sharing your insight and for useful links.

I'm working with Objective-C mostly and to me it's "C++ done right". Now that you mentioned D, I'm going to take a closer look at it too.

I think we would all agree that the next big systems programming language has to have integrated support for parallelism and concurrency of some kind. The trend is growing really fast now.

April 4, 2011 at 7:11 AM

Anonymous Alex S. said...

It is interesting to note that although we're moving fast to the future of high performance hardware, a good programming language is still largely defined by its implementation, not only its programming model. In other words, it's not likely that one will choose a language over Lua which is even better than Lua, but slower than Ruby.

April 4, 2011 at 7:27 AM

Anonymous Anonymous said...

Writing a game-engine by writing your very own programming language first, is almost always the Wrong Thing. imho

April 4, 2011 at 7:40 AM

Anonymous Anonymous said...

Great article. C++ I think is a horrible language that will eventually collapse on itself. Since C++ is trying to be both a system level language and a higher level language at the same time it often fails. I think it is interesting because as C++ programs get older we will realize the cost of maintaining C++ is very high. Targeting C as the system level language is the correct move because of easy integration with existing code.

April 4, 2011 at 9:37 AM

Blogger DEADC0DE said...

NeARAZ: yes, I guess it was not clear the way I wrote it in the article. I guess you can call it game scripting, to me it's a bit borderline. If we roughly say that the scripting is what is usually left in the hands of a designer (I know, that's not right as we use scripting in rendering or loading and other things) and the coding is what is done by a game engineer, I'd say the use of C# in Unity falls more towards the second.

April 4, 2011 at 10:34 AM

Blogger DEADC0DE said...

nova77: This can evolve in a huge discussion if we delve in the details, but let's say that for me the three capital sins of C++ can be grouped in:

1) Too complex.
No one really understands all of C++. I've worked with many people that were very skilled at it, and still they didn't claim to fully understand it. The average programmer gets it mostly wrong.
Even computers don't get it (very hard to write tools)

2) Too wrong.
Bad defaults, wrong keywords (typical example: having to declare constructors explicit), bad decisions that make tricky to write complex code and require books on coding guidelines, static checkers and so on.

3) Underpowered.
No/stupid (RC) object lifetime management, no SIMD, no threads, no closures/continuations/coroutines,no sane macro system, no real generics, no reflection etc etc etc.

Now the new standard addresses only point 3 a tiny tiny little bit. That's it. It totally ignores 1 and 2 that are the hard ones (no actually, it makes them _worse_). The only thing that could have helped a bit for complexity was removed (contracts). It adds to the standard what? Threads, yeah thanks, a standard would have been helpful 10 years ago, now everyone has their own stuff anyways. Lambdas and auto are a nice syntactic sugar, I admit, but it's really cosmetic there...

April 4, 2011 at 10:45 AM

Blogger DEADC0DE said...

Anon: "Writing a game-engine by writing your very own programming language first, is almost always the Wrong Thing. imho" -

We do already! Writing a game engine is already, right now, the art of removing crap from C++ and adding features back. We all have our own object model that is not the C++ one. Most of the times is not a great one (we should spend more energy) and it's only informally enforced (code reviews, everyone has to write the code a given way).

I'm just saying that if we want to keep doing that, it's possible, but at least let's be honest and use tools to statically check that people are using the company-wide C++ dialect and not their own personal version.

April 4, 2011 at 10:49 AM

Blogger Matt D. Kerr said...

C# is also used for server development. Bungie.net runs completely on C#, from game servers to web site (and all web services in-between). I believe Blizzard's Titan project also is being designed from the ground up to use C# for the server side.

On the client side, while you mention that C# can be used with XNA I believe that Mono (open-source CLR for Linux/Mac) is being ported to PS3 as well by Sony.

April 4, 2011 at 11:19 AM

Blogger DEADC0DE said...

Kerr: I won't say anything about Sony... About the servers, I didn't include them in the survey, otherwise as I wrote in the introduction, we should really consider any langauge out there.

April 4, 2011 at 11:55 AM

Anonymous nova77 said...

@DEADC0DE: I respectfully disagree but I don't want this to become an endless thread. If you happen to be in London we can have a chat over a beer. :)

April 4, 2011 at 3:33 PM

Blogger DEADC0DE said...

nova77: same if U come to Vancouver

April 4, 2011 at 4:04 PM

Anonymous Anonymous said...

Another systems level language worth looking into is Clay - http://tachyon.in/clay/

April 5, 2011 at 6:03 AM

Anonymous Anonymous said...

I actually think Haskell is quite a bit "easier" than the ML languages, especially OCaml. I also do not really see why it should be considered research oriented anymore, Haskell as it is today is not what it was when it was first envisioned as a standardized lazy functional language.

The syntax is much lighter weight and more consistent, and the typeclasses make things like "*." from OCaml unnecessary and in general make it so that the type system gets in the way a bit less. It still might be an adaption having to do all those explicit casts.

One note is OCaml's implicit functionality that does the equivalent of Haskell's "deriving Eq".

Syntax wise though, Haskell could almosst be thought of a prettier, simpler OCaml.

Learning is another problem. Haskell has excellent tutorials online much like Python does, when I tried learning OCaml and Scheme I did not find those same sorts resources to be available.

Really, Haskell is just less surprising, cleaner looking, and easier to learn than OCaml is.

In the context of videogames though, I suppose haskell performance might be harder to reason about because the way the code is evaluated is so strange and has perhaps more in common with languages like Prolog in some cases than it does with OCaml. I do not really care about those semantics though, but I understand that OCaml might be easier if you do.

April 7, 2011 at 2:54 PM

Blogger DEADC0DE said...

Anonym: You may be right about the availability of teaching material, Haskell is indeed fairly strong. And I'm not so experienced with the language, I personally prefer the ML family so I might be biased...

But I would be really surprised if any game programmer found it easier or more natural than OcaML.

And it's not a matter of syntax (syntax rarely matters), it's a matter of semantics.

Do you think that a C programmer will find it easy to implement any but the simplest list data structure in Haskell? Will you volounteer to explain monads to every guy on a team?

Not to mention that being purely functional is handy if you are doing language research but imho it does not add anything to a language that has to be used in production.

April 7, 2011 at 3:09 PM

Anonymous Anonymous said...

It might be worth noting that D comes in two versions. D 1.0 was indeed simpler than C++, but it's currently dead. D 2.0 comes with its own set of insanity which in many areas looks more involved than C++ (the const system, for instance, which isn't even used by the standard library, because they don't know how to use it).

April 8, 2011 at 11:52 AM

Blogger Barend Venter said...

Thanks for your reply.

I had written that comment in reply to c0de517e's blog post, where he seemed to imply that Haskell was mostly of research interest and more difficult to learn than OCaml. As you would have realized from my comment, I do not believe either of these perceptions to be correct. Haskell does, of course, attract the attention of researchers working on novel or improved compilers or interesting language extensions but this is true even of things like Python, JavaScript, and C. Being a good language for researchers to play with is just a good thing if you want your language to improve with time, as Haskell did. OCaml isn't "much easier" than Haskell and really is perhaps "slightly harder" instead. However, now I want to reply to your post.

First, I will say that (barring big mistakes with semantics-related choices) syntax is probably the most important thing for a language to get right. Syntax is pervasive and undesirable to have to escape from as those exceptions make things inconsistent and require more complexity to be memorized by the programmer.

On data structures, the way Haskell notates them is the same way they are done in OCaml. Thus, if a C programmer can do it in OCaml they should have no trouble with the equivalent Haskell data structure.

On monads, this is what it means to be a monad:

[[1,3],[3,5]] -> [1,3,3,5]

See how the nested list was collapsed? That collapsibility makes it a monad.

The motivation is a bit harder to explain, but you do not need to know about Monads to program Haskell any more than you need to know about operator overloading to program C++. And really, the thing that you'd have to explain would be typeclasses rather than Monads specifically, which are a cool language feature, but like operator overloading you can hold off teaching about it for quite some time and students will still be able to write substantial programs.

Typeclasses like Monad also make learning a bit easier by obviating the need for things like "*.", which I mentioned earlier. You do not have to know how they work to benefit from them.

I do not think it is either fair nor accurate to say that "purely functional" is mainly of research interest, or object-oriented programming (a different concept that has the same motivations and benefits of pure functional programming) would never have become the mainstream ideology it is today. Just like good object oriented design, pure functional programming makes code easier to test and maintain later down the line, and makes it easier to think about the individual components acting independently. OCaml pushes both those approaches.

Haskell does do one thing differently to OCaml with regards to this, it actually allows you to express purity at the type level by having you use a special data structure for IO operations. This does lead to some extra learning curve as to understanding why "IO String" is different from "String". I like to explain it in terms of "IO String" being like "PWD" or "WHOAMI" on a DOS prompt, and that >>= is analogous to the DOS pipe character ('|'). PWD and WHOAMI are programs, not strings, they only output strings when you run them.

I had to cut this down drastically to get it accepted as a comment, but I hope it addresses everything you mentioned. Cheers, Barend.

April 9, 2011 at 11:37 PM

Blogger DEADC0DE said...

Barend: I don't think our views of the language are too far apart, but as it often happen online we're arguing on the context.

"Simpler" for example depends really on the audience. Scheme is way "simpler" than C but it would probably be "harder" in a game development scenario than lua or tcl.

Also when I said that the syntax does not matter much, I didn't mean that it does not matter for a language, but programmers can usually adjust to a different syntax way faster than they do to a different programming paradigm.

With that in mind, I think that most game devs will feel more at ease with a ML derivative than with Haskell.

If we were to talk about languages to teach to undergrads, then I probably would have made a different list...

I do still think though that being purely functional is a pain :) Many data structures are harder to implement/to reason about in a purely functional fashion, and I'd yet to see any practical advantage of a purely functional language over an impure one.

April 10, 2011 at 8:41 PM

Anonymous Anonymous said...

I don't agree that functional programming doesn't help with concurrency. Your example is fine-grained parallelism, not concurrency.

April 13, 2011 at 5:18 PM

Blogger DEADC0DE said...

Anon: I didn't say "functional" I said "pure functional" does not help. And you're free to not agree, if you want to discuss though you should argument a bit more than that.

April 13, 2011 at 6:01 PM

Blogger Scaevolus said...

You discussed a lot of Lua VMs, but you missed the fastest one: LuaJIT, which gets speed comparable to Java in many benchmarks.

April 13, 2011 at 7:36 PM

Blogger DEADC0DE said...

Scaevolus: "There is a very cool JIT for it, but it runs on very few platforms." And there is a link to it...

April 13, 2011 at 8:32 PM

Anonymous Anonymous said...

Tim Sweeney from Epic Games talked about this in this set of slides:

http://www.scribd.com/doc/5687/The-Next-Mainstream-Programming-Language-A-Game-Developers-Perspective-by-Tim-Sweeney

Haskell seems to tick most of his boxes...

April 13, 2011 at 10:29 PM

Blogger DEADC0DE said...

Mark: he made examples in haskell, but i don't think he would advocate it for games.

April 13, 2011 at 10:40 PM

Blogger Wladimir said...

Nice overview!

Wouter: I was thinking, an extremely minimal scripting language suited for games wouldn't need heavy string manipulation (if at all). String manipulation is slow and less predictable as it deals with dynamic data structures.

Instead of strings, it'd be efficient to use symbols which can be regarded as numeric IDs in production, where possible.

You generally want to internationalize any strings the user sees, so these can be stored in some database instead of directly in your script.

I'm not sure if such a language exists.

April 13, 2011 at 11:33 PM

Blogger KirinDave said...

I'm not sure Io will ever seriously be in the running as a game scripting language.

Io's a neat idea, but the way Steve has chosen to implement it and define its semantics leaves it almost completely insoluble to modern optimization techniques. One of the reasons Lua is so popular is that it strikes an excellent compromise between what's pleasant to use and what is amenable to aggressive optimization in a bytecode-compiling interpreter.

Which is too bad, because there is a certain beauty to the way Io's syntax is spun into its runtime state. It's far more likely that another inheritor of Self will have to emerge before we see that language family in the gaming domain.

April 14, 2011 at 9:27 AM

Anonymous Anonymous said...

@deadcode: I believe he did just that. Granted, he noted a few things that he'd change, like going from lazy to lenient evaluation, and being more explicit about types rather than aiming to infer them, but the whole point of the slides was that Haskell is far more appropriate for future game dev than C++.

April 14, 2011 at 3:22 PM

Blogger DEADC0DE said...

Mark: Next time I see him I'll ask... Meanwhile, I'll add Haskell to the list in the article, as many people are mentioning it

April 16, 2011 at 1:58 PM

Anonymous Anonymous said...

I remember Sweeney discussing about it on LtU. He said that the next "gaming programming language" is not going to be Haskell but it certainly will be closer to Haskell than to C++.

Anyway, somebody should look that discussion on LtU. I can't find it.

June 25, 2011 at 9:54 AM

Comment deleted

This comment has been removed by a blog administrator.

February 17, 2013 at 2:45 AM

You can use some HTML tags, such as <b>, <i>, <a>

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.
Please prove you're not a robot