Saturday, July 7, 2012

Class structures

Let me first state that when noting that you are working on "class structures", you should enunciate.  Otherwise many people will assume you are planning on superheating something.

I have been a Web developer for some time.  My ideas of class structure is to a certain extent driven by that experience.  As a result, I began with the highest level object, the player character.  I chose the class name "SentientBeing" and the working title for the project instantly became "Sentient Beings".   All NPCs are currently "Being"s and "SentientBeing" inherits from that.

I then began working toward base structures and adding properties and methods as I went.  All beings have "name"s for instance, they all have a "Skin", a skin is a container for "BodyPart"s and "Joint"s.  "Joint"s have a position as well as a range of motion, etc.

All "Being"s must exist in an environment.  The interaction that "Being"s can have with the environment I'm still considering.  For instance, if you are gathering herbs do the herbs go away or simply become invisible to/unusable by the current player.

And so we come to the reason for this blog.  As I write this, I think to myself that a "SelectableObject" and it's child "InteractableObject" (that obviously needs a better name).  For that matter, such objects should have "Visible" and "Usable" properties.  As for being able to blow holes in walls... although that would be useful, it would have dramatic effects on gameplay.  For instance, is the damage permanent?  If a wall is destroyed and a player walks through the opening but the wall returns to its original state, can they be stuck?  Is it possible to destroy a wall from underneath something or someone?  All in all, the realism of being able to damage objects is desirable, but the implications are significant.  I will probably add a health property to objects and leave the default at 0 for most objects while allowing a select few to be damaged/destroyed.

The chat interface will probably be my next subproject.  Built in audio chat has been sorely lacking in current games.  Although 3rd party options have alleviated this to a certain extent, it should be built-in and controllable. A single player being able to "drown out" an entire area is never desirable.