Game Development and OO
Ok, this is probably gonna get me killed or something, but I think it''s a valid question.
Most of us on this forum would have some exposure to OO. Personally I work with it everyday and I think it''s brilliant.
Anyway, alot of articles, books, etc state that the modelling aspect of OO is particulary applicable to games. And thats true in a lot of ways. However it seems from reading posts on this forum that most game developers do things for the sake of speed that violate encapsulation and do other bad OO things (casting, etc).
So is OO worth it?
--
ChoasEngine
"Those parts of the system that you can hit with a hammer (not advised) are called hardware; those program instructions that you can only curse at are called software."
-- Unknown
I think part of the way to become a GREAT programmer, is to find when you break the principles, and when to stick to them.
Object Orientation is a pretty idea, and it sometimes really helps to bring a design together, but sometimes you need to violate some principles for ease-of-use, or speed.
Though, usually, in a language like C++, there is a LOT you can do before you are really violating any Object Orientation principles
Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~
Object Orientation is a pretty idea, and it sometimes really helps to bring a design together, but sometimes you need to violate some principles for ease-of-use, or speed.
Though, usually, in a language like C++, there is a LOT you can do before you are really violating any Object Orientation principles
Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~
I''m a big OO programmer. I use it so much I can''t go back to regular procedural programming unless I am doing a simple tool. I think OO programs are easier to design, implement, debug, and are easier to buiid among teams. Don''t sacrifice good design for speed. If you design your program well, you won''t need to.
Domini
Domini
Actually, designing a GOOD OO approach is a very hard thing to do, especially with large projects. It takes a lot of planning and vision, but it makes it SO much easier to program if you do it right.
Also, as MadKeithV said, there may be a few extreme times you may "break the rules" for speed, but if the design is good, you shouldn''t have to break rules for ease of use.
Also, as MadKeithV said, there may be a few extreme times you may "break the rules" for speed, but if the design is good, you shouldn''t have to break rules for ease of use.
quote:Original post by Domini
Don''t sacrifice good design for speed. If you design your program well, you won''t need to.
I don''t mean this as an inflammatory question, but where do you get this wisdom? Have you experienced it, or is it just "what everyone else says".
Be very careful where you tread, optimising C++ is a lot harder than it seems at the beginning, and sometimes you DO need to tradeoff.
Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~
Myself I think that a good compiler should be able to optimise most of the speed deficiencies in C++.
For example get and set routines if declared inline can be optimised away.
I happen to agree with domini. I couldn''t possibly go back to procedural programming.
As an aside what about generic programming( templates )? Do they have a place in game programming?
For example get and set routines if declared inline can be optimised away.
I happen to agree with domini. I couldn''t possibly go back to procedural programming.
As an aside what about generic programming( templates )? Do they have a place in game programming?
I''ve experienced it. If you make sloppy code that runs fast, especially at the beginning of the project, you will run into problems. I also develop my programs with the intention that I will want to upgrade them later. By using classes and encapsulating code, you can easily upgrade by just reimplementing a class, and you never have to touch other stuff.
I use to break OO design alot. I still do some of the time. Usually, I''ll just make another class a friend instead of making everything public.
Domini
I use to break OO design alot. I still do some of the time. Usually, I''ll just make another class a friend instead of making everything public.
Domini
Generic programming is brilliant - it actually lets you work out some of the performance considerations of C++ without having to think about it too much. I just wish Visual C++ 6.0 would have better support for it, they''ve really skimped on the ANSI standard with respect to templates.
Domini - if you have experienced, I agree with you.
Check the resent "C++ operator overloading, and why it blows " thread, to find the evolution that lead to it.
I wrote an article on C++ Optimisation, that I hope will get published here. I''ve been editing it with some of the people here on the ''boards to make it worth reading.
You can get a version at my web page. That''s a word95 document by the way.
If you have any suggestions or criticisms, I''ll be happy to hear them!
Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~
Domini - if you have experienced, I agree with you.
Check the resent "C++ operator overloading, and why it blows " thread, to find the evolution that lead to it.
I wrote an article on C++ Optimisation, that I hope will get published here. I''ve been editing it with some of the people here on the ''boards to make it worth reading.
You can get a version at my web page. That''s a word95 document by the way.
If you have any suggestions or criticisms, I''ll be happy to hear them!
Give me one more medicated peaceful moment..
~ (V)^|) |<é!t|-| ~
Im a big OO user and learned the hard way. My first game was in C++ but wasnt very OO designed, I have tried to go back and update the code almost a dozen times and given up becasue even I can not follow it.
OO is essential in any big project, even a one-man project.
http://www.positech.co.uk
OO is essential in any big project, even a one-man project.
http://www.positech.co.uk
Personally, I have been working with OO (language and design methodolgy) for more than 10 years.
An OO language does have certain pitfalls for new programmers resulting in (and always do) awful code and badly implemented designs, this leads to bugs, inefficient code and general bad mouthing of OO.
Experience can produce fast efficient OO code. In fact IMHO OO methododolgy is ideal for game writing.
An OO language does have certain pitfalls for new programmers resulting in (and always do) awful code and badly implemented designs, this leads to bugs, inefficient code and general bad mouthing of OO.
Experience can produce fast efficient OO code. In fact IMHO OO methododolgy is ideal for game writing.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement