My language could totally beat up your language

posted in Ian's Blog Rants
Published July 04, 2006
Advertisement
For the past few months or so I've been trying to solve a problem that's been bugging me. That problem is -- how do you get things done 10x faster? By that I mean implementing features and solving bugs, not making the program itself execute 10 times faster. That might seem like an insoluble problem outside of becoming a lot smarter, but chasing it seems to be a worthwhile goal anyway. Even if you only make yourself twice as productive I'd say it's worth the effort.

Clearly you aren't going to become 10x more productive without doing something drastic. So there can't be any sacred cows.

The most obvious first step is to look at what tools you're using. I think in terms of tools, your choice of programming language is the most important tool choice you'll make. For whatever reason, game development is pretty homogenous in that regard -- almost everyone is using C++; which is actually rather unfortunate since C++ is really a pretty awful language when it comes down to it. It's a standard, of course, which is advantageous, but it's also error prone and buggy, and practically nobody fully understands it. (If you think you fully understand C++, here's are a fun excersize: See if you know what happens when you call an overrided virtual method in a base class's constructor. C++ is full of all sorts of fun surprises like that.)

In fact, really, unless you're making AAA titles for a large company, I think using C++ is a huge mistake. It'd be like an indy film studio trying to compete by making a gaudy summer action flick that relies on special effects rather than story. It'd be a bad move -- there's no way an indy film studio with no money can beat hollywood in the gaudy-special-effects department. If they want to win, they have to do compete in areas where they have an advantage -- perhaps in character development and story writing. Or maybe just by taking risks that the hollywood types wouldn't be willing to take. It's the same with games -- just because all the big developers are using C++, that doesn't mean it's neccesarily a good idea for you to use it.

On the other hand, it doesn't seem like there's a lot of competition with C when it comes to making fast native code. There's D, but its not very mainstream. Lisp can also compete (depending on the implementation), but then, I doubt I'm going to be able to convince many people to use Lisp :).

I'm starting to think though, that speed really isn't as big of an issue as we like to think it is. Consider the things that actually require a lot of speed in a game:
- Rendering. It doesn't matter what language you do this from -- it's going to run the same regardless since all the work is done by the graphics card/driver
- Physics: Practically everyone uses a library for this anyway.
- AI: How much speed this actually needs is rather dependent on the game. But then, a lot of games do AI in scripting languages anyway.

So if we take speed out of the equation, there's a lot more choices for languages. Java and C# seem like popular alternatives at the moment. Both are decent choices, but I don't think either of them are going to make you 10 times as productive. Not to mention that, Java in particular isn't neccessarily a huge improvement -- it lacks good abstractions outside of classes and it's ridiculously verbose at times (public static void main... ugh.)

So, if we start looking at the fringes maybe we can find something interesting. What kind of langauges tend to give you large productivity boosts over more mainstream compiled languages?

I'll leave the as an excersize for the reader for now since I'm sick of typing.
Previous Entry I need sleep
0 likes 7 comments

Comments

Daerax
Lisp or Scheme can levarage you 10x productivity but it will take years to get to that kind of level. A much better easier to get into language, and utilizing a functional paradigm to boot is OCaml. OCaml is just as fast as C++ despite the fact that it has a lot, a lot of high level constructs - GC, type inference, pattern matching, real polymorphism, recursive types etc. This is because among other reasons, it is statically and strictly typed, the compiler can make certain assumptions that a dynamically typed language like lisp can't. It also makes a sensibly use of imperative and functional paradigms making it quite flexible - totally disallowing side effects seems silly and close minded to me.
July 04, 2006 04:37 PM
Ravuya
Since you've already said you're using Python I'm going to guess... Visual Basic.

Me, I've got a balls-out engine of polygon destruction bolted to a prim and proper Python gamecore for my next-gen design. It's like a Victorian dandy driving a Sherman tank with nitrous-oxide infused afterburners catapulting off a cliff.

My only concern is deploying on Windows, which is a bit rustic.
July 04, 2006 04:43 PM
OrangyTang
I think the only 'viable' languages other than C++ are probably Java, C#, Python (and one you missed:) Blitz Basic.

By 'viable' I mean practical - when you start getting really obscure with stuff like Schema you'll be completely on your own as far as third party tools and APIs go - which pretty much leaves you trying to do a GL/DX binding, full 3d engine + supporting work from scratch. I tend to put D in this catergory too from what I've seen. The only actual finished games I've seen are Kenta Cho's, and he's obviously got a whole load of his own custom base code he's reusing each time.

I've seen Blitz gaining more momentum recently, although personally the look and feel of the language (plus what looks like a really crappy IDE that you're forced to use) puts me off. Python IMHO falls down in the same area, I haven't found a good solid debugger and the whole language feels 'fragile' somehow. Perhaps I just like my typesafety too much.

So I guess that pretty much leaves Java and C# (trust me, the speed issue isn't an issue especially since most of the time you'll be waiting for the graphics card anyway). I havn't had much time to tinker with C# yet, and I've got a large volume of Java code already, so for me thats a no-brainer. And one often forgotten advantage of Java is the sheer quality of IDEs for it. Even visual studio can't compare to Eclipse for productivity and features.

I've not mentioned Visual Basic, because from what I can tell Visual Basic.Net is basically C# with a different syntax designed to be friendlier towards old-style VB coders, and so providing no real advantage over C#.
July 04, 2006 05:04 PM
Mike Bossy
The reason I go with c++ are two fold:

1). It's what I'm most comfortable with. Been using it for over a decade and I like it. But I do code in c# as well so that's not the biggest reason.

2). It's as stand alone as you can get. You still aren'y guaranteed to have the .NET run time on windows machines now a days, let alone macs. Same goes for the Java VM. Once we get to that point I will seriously think about it.
July 04, 2006 06:25 PM
Telastyn
I've moved to C# for pretty much everything I used C++ for in the past. UI stuff improved (wysiwyg designer, event system) a bit, and non-UI did a relatively little (large std-library, less ambiguity in constructs, Unicode by default, Garbage Collection).

It's better, but not large productivity gains. I'd look at my IDE or personnel processes for gains, since they're arguably more malleable in the first place.
July 05, 2006 12:52 AM
Facehat
Quote: Original post by Ravuya
Since you've already said you're using Python I'm going to guess... Visual Basic.

Me, I've got a balls-out engine of polygon destruction bolted to a prim and proper Python gamecore for my next-gen design. It's like a Victorian dandy driving a Sherman tank with nitrous-oxide infused afterburners catapulting off a cliff.

My only concern is deploying on Windows, which is a bit rustic.


Deploying Python programs in Windows is actually pretty easy, with the exception of a few libraries that tend to be a pain (PyOpenGL). You probably already know about it, but Py2Exe pretty much handles it all for you.
July 06, 2006 12:24 AM
Facehat
Quote: Original post by Daerax
Lisp or Scheme can levarage you 10x productivity but it will take years to get to that kind of level. A much better easier to get into language, and utilizing a functional paradigm to boot is OCaml. OCaml is just as fast as C++ despite the fact that it has a lot, a lot of high level constructs - GC, type inference, pattern matching, real polymorphism, recursive types etc. This is because among other reasons, it is statically and strictly typed, the compiler can make certain assumptions that a dynamically typed language like lisp can't. It also makes a sensibly use of imperative and functional paradigms making it quite flexible - totally disallowing side effects seems silly and close minded to me.


I looked at OCaml before and it seemed pretty interesting, although the syntax scared me away at the time (it's not quite Haskell level of scary, but it's close). I'm planning on learning it more in depth at some point though.
July 06, 2006 12:25 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement