Re: Modulizing "Added Spells, Skills, Commands, etc"

From: Treker (treker@positron.net)
Date: 08/18/00


> On Fri, 18 Aug 2000, Treker wrote:
>
> > Perhaps in future releases of CircleMUD, it'd be a good idea to make a
> > header/source file pair called userdefined, which would contain all of
> > the "added" spells and skills, thus centralizing any of the
> > seek-and-replace work to one (or two) files, making it many times
> > easier to add new spells, skills, commands, and probably reducing the
> > code size (after adding the spells) as compared to the current method
> > which forces the coder to run through more code than is required
> > normally.
>
> Spells and skills are defined in spells.h.  You do not need to change any
> header files to add a command, just interpreter.c to add it to the command
> table (you should also, of course, add the actual command somewhere; where
> is arbitrary, but you might choose to follow the convention of wizard
> commands in act.wiz.c, object manipulation commands in act.item.c, etc.).
> Most other structures and defines are located in structs.h, with the
> exception of parameterized macros (located in utils.h).  The layout is
> pretty simple and already minimizes the amount of work you need to do to
> just making a few small changes in a few well-defined places.

This method could still be modified--by creating a vector full of skills,
their effects, how long they last, etc in each position of the vector (each
position=new skill).  Since vectors are dynamic, the eof() member function
could be used to detect how many spells are currently in use and dynamically
assign the spells during interpretation.

This is a feature only available in C++, but it would change the entire view
of MUDding from a must-be-C++-programmer-to-code, to a
must-have-a-brain-to-code type task.  =)

>
> > I understand that Circle works fine without classes, but I can see
> > many places where classes would reduce the code size and complexity.
> > I guess I'm babbling, so I'll stop.
>
> CircleMUD doesn't use classes because CircleMUD is written in C, not C++.
> It has nothing to do with how well CircleMUD works without them, and
> everything to do with the fact that they're just not available.  Having
> said that, were we to rewrite CircleMUD from scratch, today, it would most
> likely be in C++.
>
> -dak

Then we are in agreement that CircleMud must change with the times as new
technology and better ways of doing things are introduced.

The boundary between C and C++ is rather thin, some aspects can be
introduced into it that belong to C++ without drastically modifying
everything.

While the spells/commands/skills adding system may be near optimal right
now, I think that it should become so easy that eventually spells will be
stored in a file and loaded, so that they can be edited by an external
program (ie: circedit 2001 [hypothetically])

Commands added by an admin (imo) should be separated from most of the Circle
code--in their own source file, for example, thus preventing the need to
manually upgrade the code later to a higher patch level because the DIFF
program doesn't recognize the code.  But that's just my opinion, I could be
wrong.

Lastly, I'd like to apologize for firestarting.

-Treker


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/11/01 PDT