Interface complexity problem in game
- From: Brendan Guild <dont@xxxxxxx>
- Date: Sun, 25 Sep 2005 10:23:20 GMT
I'm trying to design a game carefully and deliberately, using every
abstraction trick that I can to make it extremely maintainable.
The active entities of my game are represented as objects of a common
class, subclassed and composed for varying behaviour. I let the
objects control their behaviour when I call a method on the object
called act(world). I can't define what this method will do, because
the point of it is that it will vary wildly from object to object.
I pass in a 'world' object that gives access to the things that may
be needed by the entity to do something interesting. And that is
where the problem is: My current strategy is going to result in the
class of the world object having perhaps hundreds of methods,
everything that any entity in my game might want to do to the world.
I know that it is a bad thing to have such a huge interface. I don't
know exactly what the methods will be at this stage in design, but I
want to adjust my design to allow me to add complexities to the
'world' without adding nearly as many complexities to the interface.
I do not have a clear idea of the domain that I am working with and
that's an unfortunate but unavoidable reality. However, I can say
that the overwhelming majority of methods on world objects will be of
the form: world.doSomething(parameter,position), where an action is
taken upon a spot in the world nearby to the entity such as slaying a
monster, opening a door, cutting down a tree, etc. with a different
parameter or parameters for each kind of action.
The encapsulated insides of 'world' will be unavoidably very
complicated. Does this mean that the interface must have undesirably
many methods, or is there a way to avoid that? Is it something I can
prepare for even without knowing what the exact complexities of
'world' will be?
.
- Follow-Ups:
- Re: Interface complexity problem in game
- From: H. S. Lahman
- Re: Interface complexity problem in game
- From: iamfractal
- Re: Interface complexity problem in game
- Prev by Date: A question about substitution principle
- Next by Date: Re: A question about substitution principle
- Previous by thread: A question about substitution principle
- Next by thread: Re: Interface complexity problem in game
- Index(es):
Relevant Pages
|