C++ sucks for games

N

Nathan Mates

I'm not sure this is relevant, but there's a system called Abigail
that does naive physics in Lisp. It works under CLIM --- the "movie"
part even works under McCLIM if you fix a few things in Abigail. It
has stick figure animations, calculated in real time, of people
walking around playing with a ball, bouncing a ball and a couple
others.

Yeah, well, that's easy, elementary physics. When you're
calculating lots of interpenetrating objects, with complicated
collision geometry, correctly *AND* quickly, then say something.
Commercial middleware like Havok have got the hard cases solved well
enough, something that takes all the development time. Things like
basic physics or a scene graph are "solved problems" -- they're
published in books and/or given out as homework problems. Good physics
that's also fast enough for consoles is nowhere near a solved problem,
and your choice of language won't help you one iota in *coming up* with
algorithms to cover all the weirdball edge cases. [Note: I didn't
say *implementing* the algorithms. The problem isn't there, so leave
any language fanaticism outside.]

Nathan Mates
 
C

Christer Ericson

Disagree with any of these and you're nuts :eek:) :

(1) Physics engines are a lot of work to get right
(2) Physics engines are required for some modern AAA games
(3) Physics engines for AAA games exist only currently for C++

Therefore:

(4) Writing AAA games which require physics is going to be much easier
in C++ (where it's a commodity) than any other language where you have
to roll your own.

Sorry, that is just a fact. There's no 'milage' or interpretation involved.

That seems like a flawed conclusion. It is probably a rather
simple task to wrap any "C++-only" physics engine to allow
it to be called from whatever language you'd want to be
calling it from, including Lisp.

Christer Ericson
Sony Computer Entertainment, Santa Monica
 
P

Peter Ashford

Christer said:
That seems like a flawed conclusion. It is probably a rather
simple task to wrap any "C++-only" physics engine to allow
it to be called from whatever language you'd want to be
calling it from, including Lisp.

Christer Ericson
Sony Computer Entertainment, Santa Monica

Have you seen Havoc? It doesn't have a thin interface, it's designed to
slot right into your code. I've done a few things in Java and OpenGL
which have convinced me that the thin wrapper approach is very powerful
for non C languages, but something like Havoc simply doesn't *have* a
thin interface - you'd have to write a considerable ammount of C++ to
make a thin interface to map it to your local language.
 
P

Peter Ashford

Fred said:
I'm not sure this is relevant, but there's a system called Abigail
that does naive physics in Lisp. It works under CLIM --- the "movie"
part even works under McCLIM if you fix a few things in Abigail. It
has stick figure animations, calculated in real time, of people
walking around playing with a ball, bouncing a ball and a couple
others.

Physics simulations and physics simulations that you can use in AAA
games are quite different things.
 
P

Peter Ashford

Nathan said:
Fred Gilham said:
I'm not sure this is relevant, but there's a system called Abigail
that does naive physics in Lisp. It works under CLIM --- the "movie"
part even works under McCLIM if you fix a few things in Abigail. It
has stick figure animations, calculated in real time, of people
walking around playing with a ball, bouncing a ball and a couple
others.


Yeah, well, that's easy, elementary physics. When you're
calculating lots of interpenetrating objects, with complicated
collision geometry, correctly *AND* quickly, then say something.
Commercial middleware like Havok have got the hard cases solved well
enough, something that takes all the development time. Things like
basic physics or a scene graph are "solved problems" -- they're
published in books and/or given out as homework problems. Good physics
that's also fast enough for consoles is nowhere near a solved problem,
and your choice of language won't help you one iota in *coming up* with
algorithms to cover all the weirdball edge cases. [Note: I didn't
say *implementing* the algorithms. The problem isn't there, so leave
any language fanaticism outside.]

That's rather my point - doing these things well enough to work for
games in general is extremely non trivial, and getting someone else to
do it for you is a major bonus to productivity (and, in the case of
physics engines, sanity)
 
R

Raghar

That seems like a flawed conclusion. It is probably a rather
simple task to wrap any "C++-only" physics engine to allow
it to be called from whatever language you'd want to be
calling it from, including Lisp.
Yes it's a simple task. Create memory buffer, share it with graphic
library then batch fill memory buffer and set bit you are done, then
wait, or periodically check if GFX is done. Graphic library would
take information about memory buffer, returns if all was set
properly, and without delay reads first batch. (simillary in the way
of communicating between programs and devices)
The problems arises because you don't know if there wouldn't be bug
in the graphic library, hope thread implementation of graphic library
will not blast priorities of your threads, in most cases they'd do,
but it's not too hard a problem... (well sometimes it's dissasembly
currable hard problem).
Memory caching problems? Will it take too much, or too little.
The interface looks butt ugly problem.
You'd lose also a nice JIT inlining and escape analisis, and some
other "benefits" of JIT compiled languages.
If you are smart and though about a recompilling at runtime, you are
out of luck C++ engine will not alow this.
How many C++ engines supports this universal way of communication? If
none then you'd need to do a little extension of the engine, and risk
messing things really hard.

Communication between library designers, and program designers
problem isn't inter - language dependant.

So this is a short list of potential problems.

BTW I preffer term world engine.
 
P

Phlip

Pablo said:
I prefer to use SQL for most 3D Engine development, anyone else feel the
same?

Haw haw. At least PostgreSQL already has a complete GIS extension. You can
query for triangles. Hours of fun!
 
S

StatiK

I don't think C++ is bad. Because one time I was turned into a dog and
it helped me. I rest my case.
 
C

CII

I agree.

Hey

Recently, I researched using C++ for game programming and here is what
I found:

C++ game developers spend a lot of their time debugging corrupted
memory. Few, if any, compilers offer completely safe modes.

Unsurprisingly, there is a very high failure rate among projects using
C++ for modern game development.

You can not even change function definitions while the program is
running and see the effects live (the ultimate debugging tool).

Alternatively, you can't execute a small portion of the program
without compiling and linking the whole thing, then bringing your game
into a specific state where your portion of the code is being executed.

The static type system locks you into a certain design, and you can't
*test* new ideas, when they come to you, without redesigning your
whole class hierarchy.

C++ is so inflexible, even those who do use it for games, have to
write their game logic in some other language (usually very slow,
inexpressive and still garbage collected). They also have to interface
the two languages.

C++ lacks higher-order functions. Function objects emulate them
poorly, are slow and a pain to use. Additionally, C++ type system does
not work well with function objects.

C++ programs can not "think" of new code at run-time, and plug that
new code into themselves in compiled form. Not easily, anyway.

C++ coding feels very repetitive, for example, when writing class
accessors, you often have to write const and non-const methods with
completely identical function bodies. Just look at STL.

When programming in C++ you feel like a blind person trying to draw
something. You don't _see_ the data structures that your procedures
will operate on. Lisp programming is much more visual.

Constructors and smart pointers make it hard to tell cheap operations
from expensive ones.

C++ lacks automatic memory management and so it encourages copying
objects around to make manual memory management manageable.
Reference-counting schemes are usually slower than modern garbage
collectors and also less general.

Most important, C++ syntax is irregular, and you often find yourself
typing repetitive patterns again and again - a task easily automated
in languages with simpler syntax. There are even books on C++
patterns, and some C++ experts take pride in being able to execute
those patterns with computer-like precision - something a computer
should be doing to begin with.

C++ programs are slow: even though the compilers are good at
micro-optimizing the code, programmers waste their time writing
repetitive patterns in C++ and debugging memory corruption instead of
looking for better algorithms that are far more important for speed
than silly micro-optimizations.

It's hard to find good programmers for C++ projects, because most of
the good programmers graduated to languages like Lisp or avoided C++
altogether. C++ attracts unimaginative fellows with herd mentality.
For creative projects, you want to avoid them like a plague.

It is my opinion that all of the above makes C++ a very bad choice for
commercial game development.
 
C

CII

You cant just agree mate - you need reason

You say c++ is no good for games....

And yet 90% of modern games on PC and ported to ( consoles ) are designed
... blah blah

It seems like your looking for an excuse not to use it, maybe your just not
very
good at it.

From the rest of us who don't mind using C++, your negative comments don't
serve any productive purpose so - get fucked!

Hmm.. So my comments are negative simply because I happen to agree
with a point of view.. Interesting.

I posted that I AGREE for two reasons:

1- Because I do agree that C and C++ do suck for game programming,
and
2- To show my support of opinion no matter how old the thread.

Not all of us are "turned" yet you know. I for one still stand.

C++ is not "sacrus selectus" either . I have a Right to dissent and
to be myself. This should be a place for discussions, not for fights,
I believe. You C plusplusmongers make it sound like there's no life
outside of C. Oh brother.


Some C++ users I've known sound to me much like GW Bush when one
happens to disagree with their point of view. If C++ is so great, why
the anger and insults towards anyone who happens to disagree with
them?

I could give you many technical reasons for why I don't like or use C
(or C++, I don't care which), but I just don't have the time.

Besides, it seems to me that it all boils down to a matter of beliefs.
Incredible isn't it, how a high level "neat and bubbly" programming
language has managed to turn into some kind of sect.

Either way, a fact is a fact. It's true that C plus plus is used
widely over the industry, but that doesn't necessarily mean it's a
good language because of that. Another fact is that C p p as a
language is wasteful and obscure at best. Those are facts too.

I'll stick to hardware and machine language in the mean time.
Like I said, my opinion is my opinion and I have a right to it, so
move on with your life and be content with whatever it is that you do,
df.

Cheers.

The Soul is the Warrior.
 
C

CII

i think you're misunderestimating us c++ programmers.

indi

p.s. you should be properly shocked and awed by that response that i
declare victory in this exchange. i do not believe this to be premature.


I'm not "misunderestimating" anybody. I mean no offense.
Note how I said "Some C++ users I've known".
 
N

nokturnal

You cant just agree mate - you need reason

You say c++ is no good for games....

And yet 90% of modern games on PC and ported to ( consoles ) are designed
and implemented using c++ with a directx library. The top speck 3D game
engines of
their time quake2, unreal, now Halo - all built with C++ & DirectX (or
variant ).

If you don't need a class structure use a struct. Only use c++ structure
where
it is beneficial. For example:

My 3d engines graphics class (not using direct x)
contains an set of void functions such as plot, line , polyfill, raster etc
When the engine loads these functions are assigned to a fully optimised
version
of that function for the specified graphics mode!

for example i have mode13, 64k, + 16.7 million colours and 32Bit plotting
functions
each optimised to to their specific function. A global version of the
graphics class
exists MX3D_GRAPHICS and is declared in the class header file.

All of my functions simply reference MX3D_GRAPHICS->plot(x,y,r,g,b)
and have instant access to a fully optimised plotting function

Not only is this an extreme optimisation to performance but build time
is exponentially reduced, debugging time is limited a function call rather
than a trace through countless ifs and switch / case statements.

I really don't see your problem with C++, its mostly backward compatible
you can still implement asm, linear frame buffer (no memory restrictions)
most of the C functions still work the same - the only diference is that
there is
some extra functionality- polymorphism, inheritance etc that can make
programming
easier for you.

It seems like your looking for an excuse not to use it, maybe your just not
very
good at it.

From the rest of us who don't mind using C++, your negative comments don't
serve any productive purpose so - get fucked!
 
M

marcus

Are you kidding or what?
Do you actually think games should be written in Lisp???
C++ is slow???
C++ is fast and the speed comes from it beeing non interpreted. The
speed also comes from other things like non-garbage collecting.

OK you do sacrify some flexibility by using a non interpreted
language, but what you gain is speed.

And when it comes to Lisp, have you even considered the huge function
overhead?

If you think C++ is slow then you must be doing it wrong!
 
M

Mark A. Gibbs

CII said:
Some C++ users I've known sound to me much like GW Bush when one
happens to disagree with their point of view.

i think you're misunderestimating us c++ programmers.

indi

p.s. you should be properly shocked and awed by that response that i
declare victory in this exchange. i do not believe this to be premature.

--
Mark A. Gibbs (aka. Indi)
Administrator
#c++ on irc.Rizon.net

http://ca.geocities.com/[email protected]/
(temporary website)
 
E

Edi Weitz

Are you kidding or what?
Do you actually think games should be written in Lisp???
C++ is slow???
C++ is fast and the speed comes from it beeing non interpreted.

That sounds as if you think that Lisp is interpreted. You probably
don't know better but then you shouldn't publicly discuss these things
in several newsgroups.

Edi.

PS: Follow-ups set.
 
T

Tom Plunket

nokturnal said:
You cant just agree mate - you need reason

You say c++ is no good for games....

And yet 90% of modern games on PC and ported to ( consoles ) are
designed and implemented using c++ with a directx library. The
top speck 3D game engines of their time quake2, unreal, now Halo
- all built with C++ & DirectX (or variant ).

You might try spending some time learning a thing or two about
what you're talking about.

Alas, it is true that an easy way to learn without much effort is
to post completely incorrect information on the Usenet and just
wait for someone to come by and learn ya.

Quake 2 in C++ and DirectX? Ha that's funny.

Halo in C++ on the PC and ported to the console? Ha, that's
funny too.

(Tip- the answer to the above two mini-paragraphs' questions are
both "no and no".)
If you don't need a class structure use a struct. Only use c++
structure where it is beneficial.

Oh master of C++ enlighten us on the differences between a struct
and a class. I'm guessing your answer will be totally wrong, and
searching Google for the C++-FAQ-Lite on parashift.com might in
fact learn ya some more.
My 3d engines graphics class (not using direct x) contains an set
of void functions such as plot, line , polyfill, raster etc When
the engine loads these functions are assigned to a fully
optimised version of that function for the specified graphics
mode!

Don't assume that because you use something in school that it's
used in "the real world." Oftentimes the school environment is
tailored for learning more than doing.

When I was in college there was this graphics class that I took,
and guess what, it was all in C and it was just as Bjarne was
rolling out the first versions of CFront! Yay me!
for example i have mode13, 64k, + 16.7 million colours and 32Bit
plotting functions each optimised to to their specific function.
A global version of the graphics class exists MX3D_GRAPHICS and
is declared in the class header file.

And the reason you couldn't do exactly the same thing in C or
Java or Lisp is what exactly?
All of my functions simply reference MX3D_GRAPHICS->plot(x,y,r,g,b)
and have instant access to a fully optimised plotting function

Not only is this an extreme optimisation to performance but build time
is exponentially reduced, debugging time is limited a function call rather
than a trace through countless ifs and switch / case statements.

What in the hell are you talking about? "Extreme optimization"
in what appears to be using virtual functions? <Cue Christer
Ericson.>
I really don't see your problem with C++, its mostly backward
compatible you can still implement asm, linear frame buffer (no
memory restrictions) most of the C functions still work the same
- the only diference is that there is some extra functionality-
polymorphism, inheritance etc that can make programming easier
for you.

You might take some time to learn about some other languages
before talking about how much better C++ is. For instance, there
are some "interpreted" languages that can have very good
performance characteristics compared to C or C++ because of the
way the language is built and because of how the interpreter is
allowed to cache off information.
It seems like your looking for an excuse not to use it, maybe
your just not very good at it.

One person who is in this thread has demonstrated not being very
good at it, and it's not the person you're responding to.
From the rest of us who don't mind using C++, your negative
comments don't serve any productive purpose so - get fucked!

Let's hear it for productive comments! Yay you!

Sorry to comp.lang.*. Note followups.

-tom!
 
T

Tom Plunket

[Note followups]
C++ is fast and the speed comes from it beeing non interpreted.
The speed also comes from other things like non-garbage
collecting.

Believe what you like to believe. The fact that C++ is compiled
does not automatically make your programs fast.
OK you do sacrify some flexibility by using a non interpreted
language, but what you gain is speed.

Prove it.
And when it comes to Lisp, have you even considered the huge
function overhead?

What does that mean?
If you think C++ is slow then you must be doing it wrong!

In the hands of someone who knows nothing about other programming
languages, it is quite likely that some problems are solved in
less efficient ways.


-tom!
 
G

Gerry Quinn

Hmm.. So my comments are negative simply because I happen to agree
with a point of view.. Interesting.

I posted that I AGREE for two reasons:

1- Because I do agree that C and C++ do suck for game programming,
and
2- To show my support of opinion no matter how old the thread.

And it IS an old thread. There was a long and extensive thread to the
original silly post by a Lisp fanatic. Who, like most, has never
produced even a shareware game.
C++ is not "sacrus selectus" either . I have a Right to dissent and
to be myself. This should be a place for discussions, not for fights,
I believe. You C plusplusmongers make it sound like there's no life
outside of C. Oh brother.

There certainly are games outside of C/C++. Very few of them are in
Lisp, though, although they are not completely unknown (there was one
discussed recently here). And reading down, very few are coded in
assembly nowadays, though I don't doubt that the odd inner loop still
benefits.

What irritates some of us is the frequent assertion by Lisp-ers that
they are somehow superior to the common herd, coupled with the somewhat
modest ouevre of games - and other software - actually produced using
what is quite a long-established language with a vociferous crowd of
advocates.

[Cue, no doubt, presentation of The List, with about ten programs on it
from all fields, some of which have been re-written in other languages
since.]
Some C++ users I've known sound to me much like GW Bush when one
happens to disagree with their point of view. If C++ is so great, why
the anger and insults towards anyone who happens to disagree with
them?

I always wonder at the mentality of the US left-wingers who regularly
screech the vilest abuse while still taking great offence if anyone on
the right makes a civil observation that hurts their little feelingses.
I've heard Bush can be a little tetchy when provoked, but that is
hardly something confined to any particular shade of political opinion.
I don't recall him directing a stream of insults at anyone just for
having a different opinion. Still, off-topic here.
I could give you many technical reasons for why I don't like or use C
(or C++, I don't care which), but I just don't have the time.

Besides, it seems to me that it all boils down to a matter of beliefs.
Incredible isn't it, how a high level "neat and bubbly" programming
language has managed to turn into some kind of sect.

Uh... which language are you talking about here? Because of the three
languages mentioned so far, C, C++ and Lisp, only one looks anything
like a sect from where I sit. [Reading a thread started by a Lisp
prosyletiser who shows the usual signs. Note the name 'NeoLisper'
which shows identification with the fictional superhero Neo who through
his intuitive understanding of virtual reality code can bring about
miracles simply by desiring a particular end. This is of course an
expression of the Lisp-AI fantasy of, I don't know, twenty years ago,
in which users believed that if they used a sufficiently self-
referential language, AI would appear by magic. Evidently some people
still believe that, or something like it.]

Certainly C-ers and C++-ers often criticise each others' language
vigorously. But both somehow manage to Get Stuff Done. You rarely see
somebody posting unprovoked all over usenet about how C or C++ is the
best thing since sliced bread without actually having developed some
non-trivial program using it. And I've often been involved in
arguments about how to use C++. If C/C++ is a sect, it's a fissiparous
one.
Either way, a fact is a fact. It's true that C plus plus is used
widely over the industry, but that doesn't necessarily mean it's a
good language because of that. Another fact is that C p p as a
language is wasteful and obscure at best. Those are facts too.

I'll stick to hardware and machine language in the mean time.
Like I said, my opinion is my opinion and I have a right to it, so
move on with your life and be content with whatever it is that you do,
df.

Hardware and machine language. Read - modern programming languages are
too complicated and I'm frightened. If you've actually produced a
worthwhile distributable game (even a simple freeware one), I withdraw
that comment. Otherwise, I'd recommend you at least try one of the
game-related Basics, if you want to produce an actual game.

- Gerry Quinn
 
N

nokturnal

firstly i find it offensive that you agree with this comment!
It's hard to find good programmers for C++ projects, because most of
the good programmers graduated to languages like Lisp or avoided C++
altogether. C++ attracts unimaginative fellows with herd mentality.
For creative projects, you want to avoid them like a plague.

secondly - Quake 2 source code downloadable from ftp.idsoftware.com check it
out
if memory serves me correct c++ was the language of choice - if not it is
definately C.

finally - Contrary to your view of my response I do not recall saying any
negative
comments regarding lisp'ers. Im sure there isn't a real programmer out there
who
wouldn't agree with me when i say you should learn every language you can
before
choosing a speciality. I tried lisp in Emacs on my linux box - didn't like
it
i also do assemby, VB, Java and wouldn't use anything else but C / C++ for
3D programming.

Im sure lisp has its forte - AI but then again my partner asures me that
prolog is a much better.

So since you decided to agree with captain anal about our herd of neglegent
c++ programmers
please enlighten me as to what lisp has to offer that other languages don't!

...nokturnal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top