Mind you, you *can* rewrite Nethack to use true OOP. As an example, you could easily use Java Interface-equivalent classes to describe all the attrbiutes that monsters may have (say, "class Large", "class Intelligent", etc). Then you can create new monsters by simply creating a new class and 'inheriting' those attributes ("class Tiamat implements Large, Intelligent, Flying, FireBreathing, PitA { ... }" ).
There's even sort of a meta-OOP floating with Nethack; one can define which interface they want at make/build time; this allows the Nethack team to actually do a primative MVC architecture so that those running the game on more 'graphic' terminals can chose an interface that's more suited for that.
But just because you can doesn't mean it will work. I know of numerous attempts to OOP'ive the classic Rogue-like games with no luck.
Just remember, any OOP structure/intherience tree/class diagram can be flatted to a procedural structure. (Initial versions of C++ did just this; they preprocessed code to munge class names and methods to unique C names) In most cases, this will be messy and filled with lots of switch blocks, but it can do the same thing. However, the flatter the object structure starts, the simplier the underlying C code, and this typically can be optimized further to get speed gains.
-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important
In reply to Re: Why dont games use OOP?
by Masem
in thread OOP, ".NET", Perl, and all that
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |