[Tutor] Objects & Classes...
Chad Crabtree
flaxeater at yahoo.com
Mon Jan 17 23:02:05 CET 2005
I was thinking (it's been a while since I played) that I would do it
like this. (strawman code)
class Character:
def __init__(self,name,attribs,skills,cyberware):
...initialize..
and code to check attrib and skill mins and maxes
physical and menatl attributes should be part of the character
(why would an attri bute need to be a separate class?)
def addCyberware(self...):
def removeCyberware(...):
etc et al.
class Troll(Character):
update min max code in class for each race
class Skill:
def __init__(self, stuff):
perhaps have a subclass for each skill?
in addition the class would be responsible for it's
presentation
class Cyberware:
set attributes skill atribute mods and sanity or what ever thne
subclass for each item. Also taking care of presentation
class Spell:
just like cyberware but perhaps one level further abstraction
class Augment(Spell):
class Damage(Spell):
class Curse(Spell):
I guess the question is should the character class be a *is a* or
*has
a* relationship with Race. Perhaps they could be mixins.
For persistence the only reasonable solution would be an object
persistence scheme of some sort. Then throw in a Top Down RPG Engine
and life is good.
Max Noel wrote:
>
> On Jan 17, 2005, at 20:51, Jack Cruzan wrote:
>
>> Ok, so each character has his name, race, his stats, his skills,
and his
>> gear.
>>
>> since the name and character is unique there is no need for a
class
>> these things.
>>
>> hmmm maybe I am conceptualizing this wrong.
>>
>> would each new character then be a dictonary? Made up of different
>> elements or would the character be a list? Since each character is
>> basically just a list of stats... the stats get modified up and
down by
>> race and certain gear... am I conceptulizing this correctly?
>
>
> I've thought about it a few times. Actually, when I learn a
> language, I often try to design and implement a SR character
> generator. Then I give up because it's really complicated and I
don't
> have time (other things to do using the aforementioned programming
> languages, mostly :D ).
> I'm probably gonna end up making a web-based one at some point,
> using either mod_python or Ruby on Rails. Gah, so many things to
do,
> and so little time...
>
> Anyway, my view of the problem was that at least the following
> should be classes:
> - Character
> - Attribute
> - Skill (perhaps a subclass: Specialization?)
> - Augmentation (with subclasses like Cyberware, Bioware,
AdeptPower)
> - GearItem
>
> Character would mostly be a container for the other classes, so
> most of its attributes would be dictionaries, like:
>
> class Character:
> def __init__():
> self.attributes = {'Body': Attribute(), 'Quickness':
> Attribute(), 'Strength': Attribute(), 'Charisma': Attribute(),
> 'Intelligence': Attribute(), 'Willpower': Attribute()}
>
>
> Ah, things would be so much easier if McMackie would release
the
> NSRCG source code (despite this abomination being written in Visual
> Basic), wouldn't they? ;)
>
> -- Max
> maxnoel_fr at yahoo dot fr -- ICQ #85274019
> "Look at you hacker... A pathetic creature of meat and bone,
panting
> and sweating as you run through my corridors... How can you
challenge
> a perfect, immortal machine?"
>
>
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250
More information about the Tutor
mailing list