OO and game design questions

Aahz aahz at pythoncraft.com
Mon Nov 15 17:52:52 EST 2010


In article <i9lfbu$1af$2 at localhost.localdomain>,
Martin Gregorie  <martin at address-in-sig.invalid> wrote:
>On Tue, 19 Oct 2010 19:49:20 -0400, Dave Angel wrote:
>>
>> Thanks, that is what I was trying to say.  In the same sense that
>> emptying a list makes it quite small, if it's a general purpose object,
>> you just want to remove all the attributes.
>
>I think a 'place' (to generalise it) is quite a small object in any case. 
>All it needs to contain is a few lists:
>- a list of exits, which in some implementations might be simply
>  references to other places, but might usefully be objects with
>  two sides, each having an appearance and a link to the place 
>  where that side appears.
>- a list of fixed objects which only serve to describe the place.
>- a list of mobile objects that actors can pick up and move
>- a list of actors who happen to be there.
>
>plus a describePlace() method and add(), remove() and getItem() methods 
>for each list. It may be possible to use a single list for all types of 
>object, in which case the object itself would be very small indeed.

Maybe you want a rule-based approach:

http://eblong.com/zarf/essays/rule-based-if/
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"Look, it's your affair if you want to play with five people, but don't
go calling it doubles."  --John Cleese anticipates Usenet



More information about the Python-list mailing list