Live data from Hacker News

Ask HN: If C++ is so bad, what should game developers use?

news.ycombinator.com

91–100 of 127 posts

Re: Ask HN: If C++ is so bad, what should game developers use?

#91
post #45

Earlier quoted context omitted.

Type-inference is needed in C++ (and is already part of the next standard, you can enable the auto keyword with gnu gcc already). But it's needed for entirely different purposes than what scripting languages use it for: it's a feature for writing better templates. It's confusing because there are two types of type-inference (run-time and compile-time). You do lose performance with run-time type-inference, which is wh…

Err, by "runtime type inference", you actually mean runtime type checking , right? The pipe dream you are talking about has a tiny hope of coming true here: http://www.bitc-lang.org/ EDIT: replying to thras, below. According to the very Wikipedia article you cited, there is no such thing as "runtime type inference". What you described as such is a way of implementing dynamic type checking: checking at runtime that th…

According to the very Wikipedia article you cited, there is no such thing as "runtime type inference"

I can't seem to find that statement anywhere in the article. And it hasn't been edited since September. Also, why not google for "runtime type inference": http://www.google.com/search?hl=en&client=firefox-a&...

Re: Ask HN: If C++ is so bad, what should game developers use?

#92

Earlier quoted context omitted.

I suppose if you like over-engineering

Over-engineering? You're confusing me with one of those guys that has to do a UML diagram before he can start coding.

I was mostly referring to the language. The standard library that comes with Java is over-engineered to the point of absurdity

Re: Ask HN: If C++ is so bad, what should game developers use?

#93

I am under the impression that Lua is widely used for video games.

Lua is often used as an embedded scripting language within level editors, for example to keep track of the progress made on a quest or to trigger an event when the character reaches a certain point. Lua isn't used to code the game engine itself (in the vast majority of cases, there may be some obscure examples of game engines written in Lua)

You need some LÖVE!

http://libregamewiki.org/LOVE

"LÖVE is a cross-platform, 2D game engine. The latest version of the engine is 0.5.0 released on September 9th, 2008.[1] It uses the SDL library, OpenGL hardware acceleration and the Lua programming language to program games.[2] It is licensed under the Zlib license. "

Re: Ask HN: If C++ is so bad, what should game developers use?

#94
post #85

Earlier quoted context omitted.

Lua is often used as an embedded scripting language within level editors, for example to keep track of the progress made on a quest or to trigger an event when the character reaches a certain point. Lua isn't used to code the game engine itself (in the vast majority of cases, there may be some obscure examples of game engines written in Lua)

Much of World of Warcraft's user interface is written in Lua, and I'm not sure I'd classify WoW as an obscure example.

But the game engine is not. It doesn't use LUA to push polygons.

Re: Ask HN: If C++ is so bad, what should game developers use?

#95
Personally, I would like to see a commercial game developer use FORTH.

from: http://www.economicexpert.com/a/Forth:programming:language.h... "Forth became very popular in the 1980s because it was well suited to the small microcomputers of that time: very efficient in its use of memory and easily implemented on a new machine. At least one home computer, the British Jupiter ACE, had Forth in its ROM-resident OS. The language is still used in many small computerized devices (called embedded systems) today for three main reasons: efficient memory use, shortened development time, and fast execution speed.

Forth is also infamous as being one of the first and simplest extensible languages. That is, programmers can easily extend the language with new commands appropriate to the primary programming problem in the particular application area. Unfortunately, extensibility also helps poor programmers to write incomprehensible code. The language never achieved wide commercial use, perhaps because it acquired a reputation as a "write-only" language after several companies had product failures caused when a crucial programmer left. In addition, the ease of implementing Forth on a given processor meant that the barrier to self-development of a Forth system was quite low, so that commercial suppliers were, in effect, competing head-to-head with hobbyists, many of whom supported the idea that software should be free."

Re: Ask HN: If C++ is so bad, what should game developers use?

#96

I've been contemplating this, too. C++ was my main language for a long time (~1999-2007) and about 30% of my consulting work is still in C++ (game development). I've found that while C++ code can be very clean and concise, it usually requires a lot of behind the scenes scaffolding, and it's very easy to get wrong even if you know the damn thing inside out. Programming in more expressive languages has certainly improv…

A Scheme compiling down to C for game development? That sounds incredibly fun! Gambit even looks mature. (I did some Common Lisp but have no experience with Scheme... wtf, no Scheme books on my mysafari?!)

Damn you, pusher! I don't have time for hobbies! Uhm, I mean -- thanks for a really informative post. :-)

Re: Ask HN: If C++ is so bad, what should game developers use?

#97
post #66

Earlier quoted context omitted.

Last time I heard, assembly wasn't considered out of bounds for high performance game programming by any means.

Last you heard must have been a while ago. Even the engines aren't being written in assembly. Writing in x86 yields slower and less optimized code than letting gcc -o3 etc compile your C code in x86. It simply gets too complex to manage in assembly.

offtopic: gcc -Os is probably even faster than -O3.

Re: Ask HN: If C++ is so bad, what should game developers use?

#98
post #9

I'm with you. Whatever you use, don't choose C++. Sure, everyone on your programming team knows C++ already. Yeah, your libraries are all written in it. And successful games have used it again and again. But if it's not one of the "cool" languages, you shouldn't be using it. Modern game developers should code in Ruby/Lisp. By the time you've finished coding all of your graphics libraries from scratch, Moore's law wil…

:D

Very fine sarcasm, sir.

Re: Ask HN: If C++ is so bad, what should game developers use?

#99
post #12
post #9

I'm with you. Whatever you use, don't choose C++. Sure, everyone on your programming team knows C++ already. Yeah, your libraries are all written in it. And successful games have used it again and again. But if it's not one of the "cool" languages, you shouldn't be using it. Modern game developers should code in Ruby/Lisp. By the time you've finished coding all of your graphics libraries from scratch, Moore's law wil…

Wait, so why can't you use the C++ libraries from Ruby/Lisp?

Because the calling overhead is too fucking slow. Never mind what happens if the library allocates memory and you're expected to free it in another module. This is bad practice, but it happens.

If the library uses weird pointer tricks like "since every data item is 4-byte aligned, we can use the low two bits of the pointer for flags", you'l break the garbage collector. Again, not great practice, but it happens.

I love dynamic languages. Every so often I try to write a game in Lisp, but productivity is about Language + Runtime. You can only justify fixing broken GL wrappers for so long, before you realize you've wasted time that you didn't have to waste.

My current fav mix is C++ without aggressively using all the bells and whistles, so it's easy to wrap for dyn languages, and Python.

Re: Ask HN: If C++ is so bad, what should game developers use?

#100

I've been contemplating this, too. C++ was my main language for a long time (~1999-2007) and about 30% of my consulting work is still in C++ (game development). I've found that while C++ code can be very clean and concise, it usually requires a lot of behind the scenes scaffolding, and it's very easy to get wrong even if you know the damn thing inside out. Programming in more expressive languages has certainly improv…

Same here, except that after using C and C++ for over a decade I find switching to another language quite trying. The habit of constantly thinking what machine code is generated from the higher language constructs is really hard to ignore.

Moreover, I actually like C. But it is inconvenient. On the other hand C++ is convenient, but I don't like it. So I started playing with developing a dialect of C that adds support for parametrized code, closures, this pointer and type inference. All the stuff that I use or would like to use in C++, but in a syntactically cleaner way and without all the blubber that C++ accumulated through a design by committee. A hobby project, nothing too fancy :-)

Post reply on HN