Programming Language

Started by
63 comments, last by OldMan__ 19 years, 7 months ago
Quote:Original post by sim27
C++ Cons:
- full controll over computer (do your own mem-managment, etc.)
- no high-level-datastructures.. even with STD you're far away from the possibilites for example python gives you...

In my opinion these Cons are enough reason to forget C++ instantly..


I believe its speed that outdoes the cons.

Otherwise if you use a slower language, you will spend half your time trying work arounds to speed things up.
So that might counter the fast production speed of higher level languages.

But c++ isn't really that low level, its just slightly lower than java,

I like java, but I cannot not stand the slowness of it. It has heaps of useful libraries, so I would still use it for many things, but not when speed is most important.
Advertisement
I personally use C/C++ (a mix of the two) because I'm a hobbyist programmer. For that reason, I'm not interested in finishing my current project as fast as it is possible to do. I'm not interested in getting excellent development times. I prefer to enjoy the coding, and I use C/C++ for that because I'm most familiar with that language and I like having to do so much myself.

I've tried higher level languages, and I really dislike the loss of control. It took me a while to get used to using regexps for text parsing as opposed to treating strings as character arrays.
first of all thanks for your opinions. i must admit that maybe may original post was a bit harsh.. especialy the "forget c instantly" part.

i obviously have a very different view on what is "fun" about programming than some of you have... and your posts made that more clear to me.


Quote:white rabbit
My point is, there is a tool for each job.


very true.

Quote:
You don't see good fast games in Java, in Python, in Visual Basic, they are coded in C++, with c/asm cores.


well.. my opinion stands that those fast (professional, big, ..) games have an underlying framework in c++ (which might take most of the dev-time) but most of the specific coding (non engine stuff) is done on top of this. via data-driven design or an implemented scripting engine.

I am mostly interested in getting something up&running .. so no matter how hackisch and slow it might be, my (!) fun time starts when i get away from coding terrain-engines, loaders, shaders and that kind of stuff towards the game-logic side.

i think its like that:
- good thing, that a lot of you like coding in c++ to get most out of available hardware and make a game look great
- good thing that i enjoy not being touched by these issues but plainly get something playable.. make the game-logic work

having said that.. i think its easier for "you others" to get a job in the game-biz, but my chances for ever finishing a "nice", playable game are better :-)

Quote:
Until high level languages match that speed, or cpu processing power makes the speed diference insignificant


my personal view on this is, that SOMETIME the cpu-speed will be fast enough to do in real time what i code in python... but my coding-speed wont get faster any time soon. so why spend time with optimization (.. because i need a fast terrain-engine, smooth animations.. i know.. but thats just "polish" for the game.. imho. once the game is up and running and maybe a great thing.. people will come and do the trick for me)

if i could rephrase my question "why do you use c", i'd go like this:

is it more important to have a AAA-title or to proof that the inherent game mechanics are worth playing?
to make something else clear:

i understand that the optics of a game are vital to its success.. and i thought (and worried) a lot about having to start to seriously code c++, because i saw no other way to get a 3d-engine running (if it's not 3d.. forget it.. imho).

until i found the combination of plain opengl and python. that did the trick for me.

I think (!) of all the real-world languages python is the most high-level, fastest prototyping i know of.
Nobody does an entire game in C++. Everybody I know in the industry uses some dynamic language (Lua, Python, Perl, Java, Lisp, ...) for the soft-and-gooey stuff, and C++ for the hard-and-performance-sensitive stuff. It's not even controversial to say this: it's the accepted norm.

Note that a "struct" will take significantly less memory in C++ than the equivalent table/hash in a scripting language; this matters to people on constrained platforms like consoles, but not as much on a PC. Unless your game is all about cramming 2000 minutes of custom character animation into a minimum spec machine of 128 MB, or something along those lines.
enum Bool { True, False, FileNotFound };
Quote:Original post by sim27
C++ Cons:
- full controll over computer (do your own mem-managment, etc.)
- no high-level-datastructures.. even with STD you're far away from the possibilites for example python gives you...


These are some interesting cons, as the first isn't a con in a lot of situations, and I don't believe the second is anywhere close to true.

I don't use Python because Python seems to attract a lot of pricks, in my experience. I don't use Perl because no person with half a brain would write anything larger than 100 lines in Perl. I have used Lua and I like it very much because it is clean and fast.

The higher up you go in the language chain, the more control and speed you lose and the more cruft you gain. The trick is to find a balance, and the fact that you aren't limited to one language for any given project makes your balance different for every component of the game. Also in the mix is your target platform.

C# is a good choice on PC, a better choice for a console is C or C++ for the engine and a scripting language for the logic. A goo d choice on a handheld is straight C, possibly C++, or J2ME if the device supports it.

This assumes that you're never going to accept an app that runs slow just because it runs "fast enough", and I don't have any faith in the next generation of programmers to do that.

[Edit] I just noticed that the OP put full control over the computer as a Pro too... this makes my post much less necessary. Sorry for the oversight.

[Edited by - bobstevens on August 21, 2004 11:12:08 PM]
How refreshing... a discussion where we actually get close to a consensus. ^_^

Woops, i realized that with bobstevens' post my post developed an intire new meaning. I am mostly refering to the last 3 posts, _before_ bobstevens'.
"Follow the white rabbit."
To continue on bobstevens' idea :

Quote:Original post by sim27
C++ Cons:
- full controll over computer (do your own mem-managment, etc.)


In my opinion, this is not a real Con - instead, I found it to be a Pro.

When you have an application which can eat up to 1 GB or RAM (yes... we do, and this is the memory friendly version of our product :P), then you are happy to be able to control the way the memory is managed. Garbage collectors are generally a big black box. You know that some time you are enteninr the garbage collector. You know that it perform well. The problem is : when, how, what. I do not want my program to eat 1.5 GB because the gc has not been called yet.

Programming is still about controling :)

My own experience tends to prove me than every language has its own target application. Scripting languages are ok for things that need to be scripted. C# seems ok for high level system manipulation (just as current java in fact but java was originally aimed at low level development). Fortran is good for math because of its syntax and its big math libraries. perl is good for showing to your friend how obfuscated code can be (and therefore telling them that you're that 133t c0d3r everyone is talking about (yup... just joking :)).

And C/C++ is good for low level, system programming stuff. But he also proved to be good in a lot of other fields : UI, algorithms and so on. C++ is a very versatile language which can be adapted to nearly all situations whre a compiled program is required.

Now, speaking of the industry (whatever this industry is. I have been involved in the game industry some years ago but it is not the case for the moment). Rapid prototyping is a good thing. But rapid prototyping must evolve to a fully functional product. Obviously, I will not code a big system in python (nor in lua, nor in any scripting language). So why should I code my prototype using this language ? This will be a complete loss of time because I won't be able to reuse any part of that prototype code. Given the price we (me and my 4 people team) are selled to other companies, if I work during 3 month on a prototype product in a way which cannot be reused after that, I will be responsible of a net loss of nearly 150.000 USD.

Hope I'm clear (I'm somewhat tired :/).

Regards,
Quake1 uses scripts. Quake2 uses dlls. Quake3 uses scripts? Doom3 uses dlls. The reason for dlls is speed. But it really depends on what you're making and how much cpu you have to burn. C++ is popular because it's both fast and high level and there are lots of middleware libs using it. Opengl and DX for example. Asm is probably too low level for most but can speed things considerably so it's something to keep in mind. I don't believe in the common belief that once we got fast cpus we can afford slower langs. This is because we always needed fast cpus in the past because we found new things to suck up cpu cycles. We evolve as human beings and so do our needs.
Thinks I like about C/C++:

- great IDE VC 6/7 (win), KDevelop (lin)
- easy debuging
- very good help (MSDN)
- easy integration (libs[fmod, gui, maya, ...])
- multiplaform (Win/Lin/Mac/Unix)
- full control of memory
- fast and can use CPU specific futures
- that code you make now can be good for a cople of years
- standart api

When you are developing a game on a P4-1GHz maybe it will be good for that game to work on CPU (500MHz - 2GHz). (C/C++ will do this for you)

This topic is closed to new replies.

Advertisement