Game class hierarchy, multiple inheritence?

I'm at a stand still in my game until I really get my design figured out better. I've been making diagrams of "is a" and "has a" relationships and so forth. I'm finding that what I really want to do is use "can do" relationships using small one or two method interfaces.

For example, renderable, controllable, ..., but it would seam to require multiple inheritance to use the approach I'm thinking of.

Anyways, long story short I'm sort of confused and don't know how to proceed.

Here is a description of the game. You are exploring planets with a robot, the planets happen to have underground bases and are protected by other robots, you explore them, you collect items that give hints on how to proceed. You use stealth to sneak through the base, you hack computer terminals and explore file systems for clues. You can hack other robots and control them allowing you to move without suspicion. You can hack robots and make them attack anything that moves etc. Blah blah, you eventually find coordinates to other planet, figure out how to get there, you go there ... Or maybe you stow away on a supply run.

Basically, all robots are controllable, there are various weapons, mostly lasers. They can be installed on any robot, you can find weapon, install them. You have an inventory. Repair kits, upgradable components like circuitry, sensors, shields, invisibility. So forth.

So I'm brainstorming ways to design a set of class hierarchies to represent all of these components.

You have items
weapons
long range weapons
continuous beam weapons
non continuous
long range emp
close range weapons
short range emp
...
force field shield
invisibility cloak

and then there are has a relationships,

items have models
weapons have range, damage, ammo/charge
certain items are upgradable
certain items are components used to upgrade other components

And then you have the robot class. It has a collection of models representing it's main structure. It has a configuration of weapons and upgrades, and shields and other components installed. It has an inventory, limited to a certain size.

And then there is the player. The player has information, clues, data, etc.

What kinds of structures would you suggest to model this kind of game? I guess as a start what I'm concerned with is how to represent a "robot" which is made up of models, and items which have their own models. And they need to be able to be updated through AI, or from user controls, and some of their items also can be linked to controls etc.

Is multiple inheritance using various simple interfaces a good idea, or should I try to avoid multiple inheritance all together?

Any other thoughts?



Last edited on
Topic archived. No new replies allowed.