Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having a go at creating a very simple text based game and am wondering what the standard design patterns are when it comes to entities (characters, sentient scenery) and the actions those entities can perform.

As an example, I have entity that is a 'person' with various properties such as age, gender, height, etc. This 'person' can also perform some actions such as speaking, walking, jumping, flying, etc etc.

How would you seperate out the entity from the actions it can perform and what are some common design patterns that solve this kind of problem?

share|improve this question
up vote 4 down vote accepted

The common answer you'll get is "with components". There are lots of questions with that phrase in them that you can search through.

In particular, here's a good article that has been linked to several times that's worth a read:

share|improve this answer
Thanks Tetrad, your reply has been very helpful. I still have a bit of research to do before I'll have a grasp on how the components model works (do I have any concrete classes atall for a character or simply some collection of components etc etc) but I'm sure I'll get there soon. Any other advice would be a bonus. Thanks for your time and help mate. – Jamie Dixon Jan 16 '11 at 18:23

There's plenty of prior art in the whole MUD and MUSH culture, with many open source platforms. Many MU*'S include support for adding behaviors/actions on the fly--i.e. admin users can create new commands via scripting. Then there's Inform7, which is arguably the state of the art for IF or and single-player, text-based games today.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.