Re: [QUESTION][NEWBIE?] Ascii vs. Binary player files?

From: Patrick Dughi (dughi@imaxx.net)
Date: 10/01/00


< previous bits snipped>

        When it comes down to it, the difference between ascii and binary
rests on one thing; programmer ability and time.  The major advantages of
ascii pfiles are ease of editing, and ability to make a player file change
with very little effort.  The major disadvantages are imperceptible file
load rates (except when scanning every file - this is usually why a
seperate index is built), and the added overhead of parsing user-supplied
text for special cases where it may conflict with you text-based labeling
system (like people making their description have an 'exit' early, and
then add a level set line).

        Now, what does a binary file have to offer?  Well, they're faster.
They don't deal directly with user-supplied text.  They're the default so
easier to take care of.  The various utilities (wizlist/etc) don't have to
be rewritten.  Of course, it is alot harder to manipulate and scan for
potential problems.  Worse, potential problems have a trickledown effect -
make a couple of player files too large, and everything underneath them
may be scrubbed.  Hard to deal with, trust me, from someone who knows.

        As far as access, binary files and text files present vastly
different levels of ease of use.  From a human standpoint text(ascii)
files are easy.  From a code perspective, parsing text is difficult, time
consumping, and to be avoided.  On the other hand, binary files are a snap
to read and write by a program (fread/fwrite) - though humans usually
don't speak binary quiet as fluently.

        Maybe they just don't have a really user-friendly hex editor?

        You can write code (yes, even perl code) that easily
reads/writes/edits binary files just as well as a text file.  Look at the
pack/unpack functions.  It's just a tiny bit more effort to get that
mindset - well, just the first time, then it's easy.  You can also write
converters pretty easily.

        So, do you have the time and experience to get that mindset, and
write converters/accessors/etc, or do you feel more comfortable with an
easy-to-manipulate files.  Don't forget, you (the coder) aren't the only
one who accesses the files - your admins may have to too.

ps - if you're curious, i use ascii.  i'm lazy, and it's easier. :)
   Anything I write for my RL job ends up being binary though.

                                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