Advertisement

C or C++ (OOP)

Started by December 01, 2000 07:59 AM
10 comments, last by Pavel Krupets 24 years, 1 month ago
Hello. I know this is an incorrect question. But I read some articles about using C++ in games. In all of them I read about slow speed of games which use C++. HELP!!!
Ehh, what do you want help with?

And no, C++ isn''t slow. Lots of games are written in C++ (Unreal Tournament comes to mind) and they''re not slow
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Advertisement
Nowday,the hardwares of the PCs are more and more high-level,and more and more cheaper too,so,the speed for a game or the other softwares is NOT the main problem at all...

But the OOP feature in C++ is very suit for the modern softwares,especial for a video game,it make the all object in a game become very easy to manage and organize,in general,you can create one class for each type game object,such as the NPC,leading actor,and the builder etc....

It will increase the efficiency for developing a big game more and more...

So,yeah,not wrong,use C++ to develop a game is a good idea
============================= Hey,I just wanna know WHY! =============================
C++ is pretty much the language of choice for games these days. I don''t know how all these articles you read could say that C++ is slow unless they are comparing it to assembly. Now if they are comparing C to C++, C++ can be said to be slower if you use its object oriented capabilities improperly. If you get crazy with class inheritance, it is my understanding that you will pay penalties in your program because of all the run-time type determination (I believe there is a more correct technical term for this, but I forget what it is) that is happening. For example, if you have a class GameObject in your game and then 10 other objects derived from that, and ten derived from those, and so on, and your functions take paramaters of type GameObject, your game''s performance will suffer because it has to constantly determine which derivation of GameObject you are actually passing. With the power of today''s personal computers, this isn''t too much of an issue, so be smart with inheritance and you will have all the speed you could possibly want (as long as your graphics routines are optimized, of course ;-))

Hope this helps...
"That's a very nice hat."-Korben Dallas
C is slightly faster than C++. But is it important? The overall productivity you get with C++ generally outweighs any speed drawbacks that C++ MIGHT incur.

Whoever wrote those articles must have something against the OO paradigm

Edited by - NuffSaid on December 1, 2000 2:36:42 PM
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
Thanks for the tips...
Advertisement
I''m starting a crusade. I''m memorizing the FAQ of this board, and using link to it to answer every question that can be found in the FAQ.

Here''s some links, Pavel:
http://www.gamedev.net/reference/start_here/
http://www.gamedev.net/reference/start_here/#2
http://www.gamedev.net/reference/design/features/whatlang/
http://www.gamedev.net/reference/design/features/whatlang/page4.asp
Thanks for the links...
Well, it really depends on how good you are. Optimized ASM beats out any high level language, but its really how you use it. I could make something written in ASM run at 1 FPS, and C 30 FPS, maybe visa-versa, its how you use it.

Basically, make the decision on which language you think better suits you, C suits me well, and it certainly suits Carmack.

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

The Micro$haft BSOD T-Shirt
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
Well, it really depends on how good you are. Optimized ASM beats out any high level language, but its really how you use it. I could make something written in ASM run at 1 FPS, and C 30 FPS, maybe visa-versa, its how you use it.

Basically, make the decision on which language you think better suits you, C suits me well, and it certainly suits Carmack.

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

The Micro$haft BSOD T-Shirt
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt

This topic is closed to new replies.

Advertisement