are new games developed in c or c++ ?
thnx in advance.
are new games developed in c or c++ ?
thnx in advance.
Usually both. Lots of times the core of the engine is done in C and assembly, but it's usually C++ for all of the more high-level aspects such as the actual enemies, AI, etc. I always go completely C++ just because I love OOP, but then again, I'm not a professional game developer... yet
I go full C++, I don't like mixing stuff together, and I am very fond of OOP.
Depends on the platform though - the PS2 when it was released was predominantly coded using C and Assembly. In fact Ratbag games in Adelaide have been recruiting programmers with embedded systems and Assembly language experience for their PS2 games.
I think there is a shift though on the whole to OOP principles with gaming - as compilers get better and the performance difference between C and C++ diminishes (as it has been for a long time now), OOP becomes very attractive for large projects.
I know of at least one developer who began investigating the possibilities of using Java to write a large scale RTS. But they couldn't get the performance they required and thus moved to C++.
From the game dev's I know and have talked with - it appears as though the only three current options in game development are C/C++ and Assembly.
Last edited by foniks munkee; 12-23-2002 at 06:27 AM.
"Queen and huntress, chaste and fair,
Now the sun is laid to sleep,
Seated in thy silver chair,
State in wonted manner keep."
Yeah, it's mostly C++, and if not, then it's most-likely just because there isn't a C++ compiler for the particular platform (or at least not one that's very optimized). In terms of performance, there shouldn't be any difference in speed when using the C subset of C++ than from actually using C itself. In that respect, there really isn't a need for actual C at all (though actually coding directly in assembly for certain things still has a lot of benefits).
In fact, some large-scale games are done almost completely in assembly (IE Railroad Tycoon).
... although even he admits it was a rather silly thing to do ...
Is the difference in speed between c and c++ big?
Because i'm not using classes or any other c++ advantages.
There shouldn't be a speed difference when using the C subset of C++ in comparison to just using C, but that of course all depends on how good the compiler is.
When using the OOP parts of C++, you can't really compare it to C because there isn't a direct correspondence to things like polymorphism in C. However, what it comes down to is if you wanted to use the OOP aspects of C++ in C and actually manually went in and made your own vtables and manually did all of the casting in C, then you probably wouldn't have code as optimized as you would if you'd just used OOP C++ and you would have had to do a hell-of-a-lot more coding.
Even using classes and member functions (without inheritance) and templating should not make your code any slower because all of that is generally just a syntactical variant on things in C.
What it really comes down to is just preference in terms of whether you'd use C or C++, unless you are limitted by your compiler. Even if you don't like OOP, there's still templating, etc. that C++ has which C doesn't. For just about all games nowadays, developers recognize the benefits of OOP and the enhanced typesafety of C++ and all its other boops and beeps, so they use it for most or all of their projects, but C and assembly are still used a lot as well.
Oke, i think i will stick to my c++ compiler anyway,
will use classes in the future, im just not comfortable with
Last edited by Travis Dane; 12-23-2002 at 09:42 AM.
Travis, I strongly suggest that you start to use classes. Classes can be extremely beneficial and should be used by every C++ coder. If you don't understand them well enough right now, then take some time out and get to understand them better. Trust me, it will be worth it.
I know how classes work just fine, i tried them many times
but always ended up trashing the program,most of the times
the reason is that i don't know wich function could go best
in wich class, any tutorials on that? or on the layout of a game?
It's really subjective how you set up the classes, but if you aren't sure which functions should be a part of which classes then just use the logic "Is this object the one performing the action." If it is then that's the class the function should be a member of.
Travis - I would suggest you pick up a book on Object Oriented Programming. Something generic that discusses the design of a program in an OOP fashion, not nessecarily language specific. It sounds as if you understand how to code a class, but just need to have some guidance as to what makes an effective class - when to inherit etc. This in itself is a skill that has to be learnt.
There used to be a speed difference between C++ and C. But this was not the fault of C++ itself. It was generally to do with the compiler - but compiler technology has come along way, unfortunately the perception that C++ is slow still lingers.
It is true that if you use some of the features of C++ you can have some performance hits - stuff like RTTI (Run Time Type Information), but you would normally pick and choose the time to use these facilities - and really that is to be expected in that case.
Any online tutorials covering those aspects recomendable??
Programming books are almost impossible to get where i live,
so if there are any tutorials out there i would love to hear em
Travis, I've been thinking about creating a tutorial for my site that is going to show how to display a bitmap (along with maybe a few other things in the tutorial) using OOP with Allegro. I'm not sure which API you use, but you would probably be able to get the relative content out of the tutorial. I'll send you a PM if/when I put up the tutorial.
Also, if you go to a store like Barnes and Nobles or most bookstores you can find good programming books, or you could buy one online. For Christmas I'm getting The C++ Programming Language: Special Edition book. I recommend getting this book, because it is a must read book for any C++ user. Other than that I'm not really sure where you could find some OOP tutorials.