Quake III source code to be released

Yeah, but struct can't include methods, only variables.

Also, OOP isn't as advantageous in game engine design as it might be in other areas. Not just because it is slower, but also because a game engine is little more than a giant while loop that tesselates and renders frames and listens for user input. Not much room for fancy inheritances and polymorphisms there. In addition to this, OpenGL isn't object-oriented (unlike Direct3D). Nonetheless, it's much more convenient if elements like polygons, textures, vectors and suchlike are represented as objects.
 
well.... in a strictly OOP way, no.

but by golly you can fill an instance of struct full of function pointers, then it behaves a LOT like an instanced class.

excpet you can't do inheritance with struct without a lot of nasty macros, and even then, it isn't perfect.

object oriented programming is good for defining the world's objects (items, things, entities, etc...) - but driving a game loop or a graphics engine... nah (at last not IMO)
 
Graz'zt said:
Yeah, but struct can't include methods, only variables.

Also, OOP isn't as advantageous in game engine design as it might be in other areas. Not just because it is slower, but also because a game engine is little more than a giant while loop that tesselates and renders frames and listens for user input. Not much room for fancy inheritances and polymorphisms there. In addition to this, OpenGL isn't object-oriented (unlike Direct3D). Nonetheless, it's much more convenient if elements like polygons, textures, vectors and suchlike are represented as objects.
Not entirely true. There are several parts of a game that can use inheritance and polymorphing quite handily, the A.I., for insance, or Networking if you want different ways to handle networking. Whether or not you can effectively use OOP depends entirely on how you structure the game.
 
it's not that difficult to make an inheritance and polymorprhing engine in C. I have made a rudimentary one at one time... used a lot of macros to define your classes, etc...

unfortunately, the one i made was a run-time based system. "classes" were defined at run time and instanced from there (so, basically, not precompiled). the performance was fairly decent, at least well enough for a business application standpoint - and it got the job done.
 
Back
Top