Is OOP the right one for game development?

Started by
54 comments, last by matias suarez 20 years, 5 months ago
Maybe i''m too philosophical today but i was wondering about so many posts of this or that lang. used for gamings. Does still c rules on games or is c++ dominant now?
Advertisement
I do not see why there must be a different approach to games than for any other software.
Games are software, nothing special.
OOP is just a technique for writing SW.

I''m personally not a strong believer in OOP. I mean is not the solution to everything like many claim.
Sure OOP fits for an entity system; for Input handling...well some nice function is probably enough.
Generally I think that more than OOP the game industry needs to lear I''m more atomic component programming(that seems an unknown topic for most of the university teachers).
Maybe this topic should have been posting in the SW Engeneering forum.

ciao
Alberto

-----------------------------
The programming language Squirrel
http://squirrel.sourceforge.net
-----------------------------The programming language Squirrelhttp://www.squirrel-lang.org
When your problem domain consists of objects with state and behavior, it is probably a good candidate for an object-oriented solution. But as the previous poster stated, not everything is best modeled with objects.

C++ supports OO, procedural, and generic programming, which is why it''s such a good general-purpose language.

--
Dave Mikesell Software & Consulting
Yeah, of course it''s fine. Many, if not most, of the professionals now use it.

The only thing you need to be wary of is which mechanisms are slow and which are fast. C ''seems'' faster to some people, but that''s because it provides fewer mechanisms

Richard "Superpig" Fine
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4
ry. .ibu cy. .y''ybu. .abu ry. dy. "sy. .ubu py. .ebu ry. py. .ibu gy." fy. .ibu ny. .ebu
OpenGL is a language

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

Using OOP may be slower because the overhead needed (methods are not stardard calls, they are _thiscall). But there is a small secret: private (and probrably protected) are faster. So, what you need is a good OOP desing. Put what you really need in public and hide everything in private. I thinck that is not a good idea to put costumizable members in private because you will need to make functions calls to work with them instead of accessing them imidiatly!

Procedural paradig works great for low level programing:
class Math{ float cos(float ang); float sin(float ang); ...};extern Math math; 

I thinck that this is.....stupid? Or maybe not!! Or maybe yes!!
Techno Grooves
Filami, you are an idiot.
I think there's always some confusion surrounding OOP: the most important thing to understand, is that its a paradigm.

I'm just going to take some time to vent here in regards to C vs. C++ - even though I'm aware OOP can be carried to a great number of languages ...

Firstly, to "use OOP", doesn't mean _everything_ is an object. For example, a program where you have an application class, an instance of that application class, a class for the renderer, etc. I see a lot of projects using this motif, and it proves to be _more_ complicated to write and understand, in terms of setting up the multitudes of heirarchies, than it would be if half of the program had been written using standing C techniques.

I once tried to develop an engine this way. After weeks of designing intricate class hierarchies and UML diagrams, I realized that I could have been half-done by this time. Elegant solutions are nice, but they can cost you more time and headaches than they're worth.

B. Stroustrop (if I'm spelling that correctly) has said publicly that this was never his intention in developing C++. He maintains that OOP should only be used where it serves an obvious benefit to your program. Carmack has stated the same thing on several occasions.

The point I'm trying to get across is - don't get the impression that OOP is everything. It isn't "god's answer" to programming.

[edited by - carb on October 21, 2003 12:43:17 PM]
- Ben
quote:Original post by carb
B. Stroustrop (if I''m spelling that correctly) has said publicly that this was never his intention in developing C++. He maintains that OOP should only be used where it serves an obvious benefit to your program. Carmack has stated the same thing on several occasions.


This is the correct answer. Know what you''re trying to do, know your priorities, and know your tools. OOP is one such tool. An entity class is probably a good idea, a triangle class for your renderer is probably not.

quote:Filami, you are an idiot.

WHAT A FUCK???? Whats hapening to you guys?? seems that no one can now their opinions in this damn Forum
What Did I sayed to offend you? I''ve just sayed that private methods can be faster and less function calls can be faster too...I''ve sayed that mathematics functions don''t need OOP design! Can ANYBODY tell me what is going wrong?? ...I''m getting tire of this guys!!
Techno Grooves
quote:Original post by Filami
quote:Filami, you are an idiot.

WHAT A FUCK???? Whats hapening to you guys?? seems that no one can now their opinions in this damn Forum
What Did I sayed to offend you? I''ve just sayed that private methods can be faster and less function calls can be faster too...I''ve sayed that mathematics functions don''t need OOP design! Can ANYBODY tell me what is going wrong?? ...I''m getting tire of this guys!!


Probably because making your interface private makes it impossible to call from the outside without going through a public interface, which was what you were trying to avoid in the first place. And so your code is just ..stupid as the other AP was getting at

This topic is closed to new replies.

Advertisement