6
\$\begingroup\$

I'm having a go at creating a very simple text based game and I'm wondering how I can design the entities (characters, sentient scenery) with regards to the actions those entities can perform.

As an example, I have an 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 separate out the entity from the actions it can perform?

\$\endgroup\$

2 Answers 2

4
\$\begingroup\$

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: http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/

\$\endgroup\$
1
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Jan 16, 2011 at 18:23
1
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .