Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8012

Re: What's the best way to write this base class?

From Mel <mwilson@the-wire.com>
Newsgroups comp.lang.python
Subject Re: What's the best way to write this base class?
Followup-To comp.lang.python
Date 2011-06-20 07:57 -0400
Organization Aioe.org NNTP Server
Message-ID <itncj3$s1g$1@speranza.aioe.org> (permalink)
References <142e76c3-b304-43ef-af24-919fa6146369@c9g2000yqp.googlegroups.com> <mailman.122.1308411487.1164.python-list@python.org> <fa2ee2a4-f46f-42c7-846c-b854977f9e38@16g2000yqy.googlegroups.com> <mailman.166.1308534779.1164.python-list@python.org> <5c8be025-2d2c-42fc-a764-bd1ca03ba398@d14g2000yqb.googlegroups.com>

Followups directed to: comp.lang.python

Show all headers | View raw


John Salerno wrote:

> On Jun 19, 8:52 pm, Chris Kaynor <ckay...@zindagigames.com> wrote:
> 
>> Having a character class (along with possibly player character,
>> non-player character, etc), make sense; however you probably want to make
>> stuff like health, resources, damage, and any other attributes not be
>> handles by any classes or inheritance in order to allow you to make such
>> data-driven (ie, read from a file). Doing so makes the game much more
>> extendable: using classes, you are likely limited to 5 or 'combinations
>> and a few developers (plus, any designers need to know programming).
>>
>> A basic way to determine between using subclasses over a data driven
>> approach is: is there significantly different back-end behavior or merely
>> attribute differences.
> 
> Can you give a basic example of how this data-driven approach would
> work? You don't have to provide any code, just a description would be
> helpful. Such as, do I create a data file per character, and then have
> each character instance read/write to that file? Is it good to have so
> many files open at once, or would they only need to be read, closed,
> then opened again at the end to write?

Battle for Wesnoth is set up this way.  I don't know what the code does, but 
you can go wild creating new classes of character by mixing up new 
combinations of attribute settings in new configuration files, and injecting 
them into the standard game config files.

AFAIK you are stuck with the attributes the game is programmed for.  I've 
seen no way to create a new dimension for the game -- Conversation, for 
instance, with currently unknown attributes like vocabulary or tone.

	Mel.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

What's the best way to write this base class? John Salerno <johnjsal@gmail.com> - 2011-06-17 21:17 -0700
  Re: What's the best way to write this base class? Chris Angelico <rosuav@gmail.com> - 2011-06-18 14:53 +1000
  Re: What's the best way to write this base class? "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-06-18 03:55 -0700
    Re: What's the best way to write this base class? Tim Chase <python.list@tim.thechases.com> - 2011-06-18 06:24 -0500
      Re: What's the best way to write this base class? "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-06-18 06:37 -0700
        Re: What's the best way to write this base class? Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-18 08:51 -0600
  Re: What's the best way to write this base class? TheSaint <nobody@nowhere.net.no> - 2011-06-18 19:04 +0800
  Re: What's the best way to write this base class? Mel <mwilson@the-wire.com> - 2011-06-18 10:22 -0400
  Re: What's the best way to write this base class? Ethan Furman <ethan@stoneleaf.us> - 2011-06-18 08:37 -0700
    Re: What's the best way to write this base class? John Salerno <johnjsal@gmail.com> - 2011-06-18 09:26 -0700
      Re: What's the best way to write this base class? Chris Angelico <rosuav@gmail.com> - 2011-06-19 02:34 +1000
      Re: What's the best way to write this base class? Chris Kaynor <ckaynor@zindagigames.com> - 2011-06-19 18:52 -0700
        Re: What's the best way to write this base class? John Salerno <johnjsal@gmail.com> - 2011-06-19 21:04 -0700
          Re: What's the best way to write this base class? Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-06-20 00:12 -0700
          Re: What's the best way to write this base class? Mel <mwilson@the-wire.com> - 2011-06-20 07:57 -0400
            Re: What's the best way to write this base class? Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-20 12:31 -0600
          Re: What's the best way to write this base class? Terry Reedy <tjreedy@udel.edu> - 2011-06-20 13:58 -0400

csiph-web