PDA

View Full Version : Classes, C++, and EQ mobs



joojooga
03-14-2003, 10:48 PM
First, WROX's definition of a class..

As we have seen, a class is a data type that you define to suit your own application requirements. Classes in object-oriented programming also define the objects to which your program relates. You program the solution to a problem in terms of the objects that are specific to the problem, using operations that work directly with those objects. You can define a class to represent something abstract, such as a complex number, which is a mathematical concept, or a truck, which is decidedly physical (especially if you run into one on the highway). So, as well as being a data type, a class can also be a definition of a real-world object, at least to the degree necessary to solve a given problem.

You can think of a class as defining the characteristics of a particular group of things that are specified by a common set of parameters and share a common set of operations that may be performed on them. The operations that are possible are defined by the class interface contained in the public section of the class definition. The Box class that we used in the last chapter is a good example - it defined a box in the most elementary terms.

Of course, in the real world there are many different kinds of box: there are cartons, coffins, candy boxes and cereal boxes, and you will certainly be able to come up with many others. You can differentiate boxes by the kinds of things they hold, the materials they are made of, and in a multitude of other ways, but even though there are many different kinds of box, they share some common characteristics - the essence of boxiness perhaps - and, therefore, you can still visualize them as actually being related to one another, even though they have many differentiating features. You could define a particular kind of box as having the generic characteristics of all boxes - perhaps just a length, a breadth and a height - plus some additional parameters which serve to differentiate your kind of box from the rest. You may also find that there are new things you can do with your particular kind of box that you can't do with other boxes......

Anyway, I've been working C++ for a little bit now and I'm getting into classes. In terms of everquest mobs, would you agree that based on that definition that EQ Mobs are classes and their capabilities and behaviours are public functions of their class? Nerdy I know, but I think its kinda cool..

chud
03-16-2003, 10:26 PM
Object oriented concepts really hit home when I first started playing around as wizard in dikumud (a player in a multi-user world that can design/program objects). My good friend was the dikumud server admin, and the OO design was reflected all the way up through the entire world. The OO concepts of the mud insipired him to rewrite the server code in C++.

I still to this day attribute my solid understanding of objects and the way that they can work in a larger sense to "playing games" while in college. Books give infinite examples of what objects are, the way to design/use them, and the pros/cons -- but there' nothing better than applying the concepts in a fun environment.

Don't ever let someone discourage you from doing what you enjoy, especially if you are learning something along the way.