is it effective to use OOP in game programming?

Started by
16 comments, last by CoderTCD 21 years, 7 months ago
quote:Original post by randomZ
*g* Perhaps Half-Life with its unstable & ugly engine isn''t the best example to show the benefits of OOP ;-)

_________________________
"Reality is merely an illusion, albeit a very persistent one." (Albert Einstein)
My Homepage


huh? HL is an excellent engine even if it''s out-dated, it still has the biggest mod community in the world, it wouldn''t if it was unstable and ugly.

Advertisement
Pretty sure that Carmack went all C++ for Q3, and is using for his current projects.


"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I''m reaching up and reaching out. I''m reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one''s been. We''ll ride the spiral to the end and may just go where no one''s been." - Maynard James Keenan [TheBlackJester ]
[Wildfire Studios ]

"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I'm reaching up and reaching out. I'm reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one's been. We'll ride the spiral to the end and may just go where no one's been." - Maynard James Keenan Name: [email=darkswordtbj@hotmail.com]TheBlackJester[/email]Team: Wildfire Games
Projects O A.D.The Last Alliance

quote:Original post by TheBlackJester
Pretty sure that Carmack went all C++ for Q3, and is using for his current projects.


Quake 3 = pure Classic C.
Doom 3 = everything C++, except the main graphics engine which is still pure Classic C.

For what most people use C for, the same speed and codesize will come out from using C++. Most of the C++ standard is about improving coding habits and effeciency.

This thread could quickly become a C VS. C++ debate. I suggest at least looking at the first couple of chapters in Eckel''s "Thinking in C++ book" because it is free, very small, and easy to read. He starts off explaining C++ from a C perspective and I think it will help the original poster make his decision.

http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html
Learn OOP right and it owns classic C without classes (if your project has any kind of size that is). Also if you are working more people on a project itis MUCH easier when using OOP (define interfaces etc. and program out from them..)
OOP is just a different style of programming, it won''t affect the speed that much (at least not on today''s machines.) It just depends on your game''s design: if its poor, its performance will decrease and probability of bugs will increase. If you have a good design, then you wouldn''t notice much difference than coding it in straight C.
Probably key use of OO techniques is re-useability.
For example in my engine:

                   TGraphic (Abstract)                       |                       |                     TMesh-----------                       |            |                       |            |                   TSkinnedMesh    TProgressiveMesh    


I have a "standard" TGraphic class which acquires a D3D Deice from my D3D class, and contains a VB and an IB for any graphic object. Each new level adds functionality (TSkinnedMesh uses TMeshes load routine and some other code to get skining info, but uses the exact same rendering code).

OO is not the be all and end all, but CAN (and I find IS) useful (especially if you plan on ever re-using any of your old code).

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!


[edited by - thedo on September 2, 2002 3:24:36 AM]

[edited by - thedo on September 2, 2002 3:25:06 AM]
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
quote:Original post by thedo
Probably key use of OO techniques is re-useability.

Sssshh... Sabreman might hear you

"When you know the LORD you have no need for masturbation!"
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]

This topic is closed to new replies.

Advertisement