Re: A few questions for the Gods :)

From: Minturn.Del.PRC.Oceana (Del@PRCOceana.Corona.Navy.Mil)
Date: 03/22/00


To start off, you gave an example from an existing ascii pfile.
It is not as simple as you may indicate:
1. First thing is to get togather all the variables that have
   to be saved in the binary pfiles.
2. You have to figure out a format you want to use.
    (It appears you used the same type of format as Sam's)
   but what will a "newbie" use? How will he/she format it?
   Also remember, this newbie has NEVER written a function to
   save and read data from a new file he/she is creating nor
   have they seen ascii pfiles before. So, they would have to
   base it on what they have seen. (World files)
   Not the best format to put them in (IMO).
   Lets not forget, do we save each individual character, or one BIG
   file for all players?
3. Next they have to figure out how to replace the existing code
   and save/read the new file.

You think this is easy? I don't think so. How many newbies converted thier
pfiles to ascii without using sam's code?
(ZIP, NONE)
Maybe after they are experienced they might have taken a shot at it, but
not likely. Why re-invent the wheel.. Sam's code is good!


Hundreds of questions, hundreds of answers for each question and you still
think it is easy! It took you two days to do it. Congratulations!!
It would take me 2 days to make sure I had all the variables and learn
what format would be the best to use in the files. From there out it would
be near impossible for me. (I am no newbie, nor am I a good C programmer,
but I do know how code works and can make some things. My faults lie in
reading/writing data, and structures/pointers. I am getting better over
time)


-----Original Message-----
From: Circle Discussion List [mailto:CIRCLE@post.queensu.ca]On Behalf Of
Patrick Dughi
Sent: Wednesday, March 22, 2000 11:53 AM
To: CIRCLE@post.queensu.ca
Subject: Re: [CIRCLE] A few questions for the Gods :)



> Write ascii pfiles myself? Yea right..
> Pretty simple.. my butt!
> Lets toss this project out for every newbie to try!

        It is pretty simple actually.  It's maybe a bit more complex than
using a single fread to fill a struct, but still simple. Lets use a simple
key:value assignment like most do (ex Strength: 18)

pseudocode for loading:

open playerfile
while(!feof(playerfile)) {
  fscanf key, value.
  big case/if/etc loop {
    case strength:
      GET_STRENGTH(ch) = atoi(value);
      break;
  }
}
close playerfile
return ch;


        Pretty easy.  The only complications are;

   multi-line things, like description and the sort.  Of course, since
mobs, objects, and rooms already have to deal with multiline bits, you
_could_ just pull the code straight out of there and use it in those
instances.

   functions which operate on the playerfile based on offset (like
anything that lists every player in the game, etc).  Just make a player
index, and load that into memory when you start up.  My version doesn't
even have a player index file - it verifies all player files on startup
and generates the index in memory only.

        I think ascii pfiles took me a full 2 days to get in and working,
including debugging, etc.  It took me another half week though to get an
online converter so players could go from binary to ascii without
realizing it.  Didn't help that I did ascii objects at nearly the same
time.

                                                PjD


     +------------------------------------------------------------+
     | 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/10/01 PDT