Logic Modules

[ LiB ]

Logic modules in the BetterMUD are simply Python scripts that can be attached to any entity type. Every entity has the capability to be given any number of logic modules, which allows you to mix and match behaviors.

For example, in my version of the BetterMUD, I have character logic modules named "combat" and "encumbrance." Chapter 18, "Making the Game," shows you how to implement these, so for now all you need to know is that when characters have these modules, they have the ability to attack other characters , and they have the ability to weigh the number of items a character is carrying. Now, if I take away the "combat" module from any character, that character cannot be attacked or attack anyone else, because the logic module is what gives the character those abilities . Likewise, if I take away "encumbrance," the game happily allows your characters to carry an infinite number of items without weighing them to see how much they can carry.

A cool thing about logic modules is that they use a flexible set of attributes that you can access from within C++. This means that from C++, you can ask a logic module to get a 32-bit signed value based on its name . I'll show you how this works a bit later on when explaining character quests.

[ LiB ]


MUD Game Programming
MUD Game Programming (Premier Press Game Development)
ISBN: 1592000908
EAN: 2147483647
Year: 2003
Pages: 147
Authors: Ron Penton

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net