Any Tips on File Organization?

10 views
Skip to first unread message

Lelah Conrad

unread,
Sep 17, 1998, 3:00:00 AM9/17/98
to
I'd be interested in hearing whether you keep all your actors,
objects, rooms, etc. in separate files, or whether you keep them more
together by say, "section of the game".
I decided to keep events near the objects or locations they
impact, and to keep minor actors near the location they are involved
with. Otherwise I have separate files for objects, locations, and for
each major actor.
Some of the distinctions get a little messy though, and I
sometimes have trouble finding things that I know I need to work on.
I can't always remember where I put that little piece of code.

Lelah

or is it just the alzheimer's coming on? :)

Doeadeer3

unread,
Sep 17, 1998, 3:00:00 AM9/17/98
to
In article <360091ab...@news.nu-world.com>, l...@nu-world.com (Lelah
Conrad) writes:

>I'd be interested in hearing whether you keep all your actors,
>objects, rooms, etc. in separate files, or whether you keep them more
>together by say, "section of the game".

Section of game - rooms, takeable objects, NPC's. I put routines in another
file I usually label "utility" or something similar and I put the help screens
in yet another file. If I have a large game I put verb declarations (not sure
Alan has that, but something like verb kick * noun -> Kick;) in another file
and global declarations in another (attributes, properties, global variables,
arrays, constants).

I find it easier to work on takeable objects and NPCs in the same section of
code of the room they start in, because there may be "interwined" code in
several areas.

HTH. HAND.

Doe :-) And it is also easier for my declarations to be in separate files where
I can readily find them, ditto routines.


Doe doea...@aol.com (formerly known as FemaleDeer)
****************************************************************************
"In all matters of opinion, our adversaries are insane." Mark Twain

Michael S Gentry

unread,
Sep 17, 1998, 3:00:00 AM9/17/98
to

Lelah Conrad wrote in message <360091ab...@news.nu-world.com>...

>I'd be interested in hearing whether you keep all your actors,
>objects, rooms, etc. in separate files, or whether you keep them more
>together by say, "section of the game".
> I decided to keep events near the objects or locations they
>impact, and to keep minor actors near the location they are involved
>with. Otherwise I have separate files for objects, locations, and for
>each major actor.


I divided Anchorhead up by geography -- a file for the house, a file for the
town, a file for the sewers, etc. Dividing it by up actors/objects/rooms
would have proved troublesome, since there's a lot of object code that
interacts with the room it's in and vice versa. Same with NPCs.

--M
================================================
"If you don't eat your meat, you can't have any pudding.
How can you have any pudding if you don't eat your meat?"

J. Robinson Wheeler

unread,
Sep 17, 1998, 3:00:00 AM9/17/98
to
Lelah Conrad wrote:
>
> I'd be interested in hearing whether you keep all your actors,
> objects, rooms, etc. in separate files, or whether you keep them more
> together by say, "section of the game".


My concept of this keeps evolving. The first two games I've written
were in TADS. I kept everything in one big file (BBEdit lite is
amazingly nice about letting you create huge files), but I did
break it down into sections. In the first game, I sort of separated
it into levels/areas of the game, and had a room, then the objects
in the room, and then the next room, etc. I kept all functions and
daemon routines separate at the top of the file, so I knew where to
find them.

On the game I'm doing for Comp '98, I separated functions from
verbs from new/modified class definitions from rooms from objects
from NPCs from special-NPCs. Before each section I had a commented
line that said what the section was, which I used as index points
to zip around in the file.

When I started learning Inform recently, I began by porting this
game from TADS to Inform, and quickly decided that I had to go back
to integrating objects with the rooms they were in, mainly because
of the Object -> syntax.

Helping me in learning Inform was looking at the code for Christminster,
which I thought was excellently broken down into smaller files, one
for each "chapter" of the story, basically.


--
J. Robinson Wheeler
whe...@jump.net http://www.jump.net/~wheeler/jrw/home.html

L. Ross Raszewski

unread,
Sep 17, 1998, 3:00:00 AM9/17/98
to
In article <360091ab...@news.nu-world.com>,

l...@nu-world.com (Lelah Conrad) wrote:
> I'd be interested in hearing whether you keep all your actors,
> objects, rooms, etc. in separate files, or whether you keep them more
> together by say, "section of the game".
> I decided to keep events near the objects or locations they
> impact, and to keep minor actors near the location they are involved
> with. Otherwise I have separate files for objects, locations, and for
> each major actor.
> Some of the distinctions get a little messy though, and I
> sometimes have trouble finding things that I know I need to work on.
> I can't always remember where I put that little piece of code.
>
> Lelah

Well, I do pretty much trhe same thing. And, like you, it gets fuzzy some
times. I used to try to have all objects that didn';t explicitly start
_somewhere_ in a separeate "misc" file. But, with time, this became
counterintuitive.Generally, I try to put objects in the file with things
hthey're closely associated with, though that's not always clear.

Right now, my source code is spread out over 45 files: One for the player
character, one for each major NPC, one for each NPC's conversation topics,
one for miscelaneous code, one for miscelaneous objects, one for each
"region", one for string constants, one for extensions to the grammar, one
for class definitions, and so on.

Of course, there are a few times when this can get confusing, but most of the
time, I can find an object either by thinking of where it starts out, or by
looking in the "miscelaneous" file.

(the down side of this system is that I had to recompile inform to use a lot
more include files)

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum

Jonadab the Unsightly One

unread,
Sep 18, 1998, 3:00:00 AM9/18/98
to
Lelah Conrad <l...@nu-world.com> wrote in article
<360091ab...@news.nu-world.com>...

> I'd be interested in hearing whether you keep all your actors,
> objects, rooms, etc. in separate files, or whether you keep them
more
> together by say, "section of the game".

Well, I do it all in One Big File(TM), because that way I can get
to anything almost instantly with a string search, which I can do
from the keyboard, whereas if I split it up I'd have to take the
mouse up to the menu to get to the other file, and that gets old
fast. (Bad enough I have to do that to check something in the
library.)

Having said that, I do organise within the file.

I split the whole game up into geographical sections.

So first come my various declarations (attributes, properties,
global constants, ...), then the geographical regions, then
global routines, and lastly grammar.

Within each geographical region, there is a header (just
a comment line with magic character sequences for easy
searching) and N rooms. Each room has a similar header
with a different magic character sequence, followed by
the room object itself, followed by any inanimate objects in
the room, and if the room has an NPC that comes last.

But that's my organisation. You might find something
different that works better for you.

One disadvantage to my method is that floating objects
can go any of various places. I usually stick them with
one of the locations and then forget where they are.
I can always do a string search and find them immediately.

Another disadvantage is that an NPC (or a complex object
like a desk with six drawers, each with contents) makes
a location take forever to scroll through. But I only scroll
through if I'm scrolling through the whole game anyway,
say if I'm checking all the prose for quality.

> I decided to keep events near the objects or locations they
> impact, and to keep minor actors near the location they are
involved
> with. Otherwise I have separate files for objects, locations, and
for
> each major actor.

This makes sense to a degree, but I'd at least put scenery objects
with the room they go in.

> Some of the distinctions get a little messy though, and I
> sometimes have trouble finding things that I know I need to work
on.
> I can't always remember where I put that little piece of code.

That's my problem with multiple files. I can't find things.
It's okay if, say, all the grammar is in one file. You know where
to find grammar. But if you have two different files something
possibly might go in, you have to check both. If you have
several, it's messy. That's why I can't stand Visual Basic.
It forces such fragmentation. So when I have a choice, I use
One Big File(TM).

Some people find One Big File(TM) too hard to keep organised,
and prefer to break things up. It helps them. It's the way their
brains work. Mine doesn't. So it's a matter of personal taste.

I think.

> Lelah
>
> or is it just the alzheimer's coming on? :)

Oh, too many people mistake simple old age and forgetfullnes
for Alzheimer's. If I had a nickel for everyone somebody said
had Alzheimer's who really didn't have it, I'd buy Microsoft.

--

Dyslexic email address: ten.thgirb@badanoj

TenthStone

unread,
Sep 18, 1998, 3:00:00 AM9/18/98
to
l...@nu-world.com (Lelah Conrad) caused this to appear in our collective
minds on Thu, 17 Sep 1998 04:51:17 GMT:

>I'd be interested in hearing whether you keep all your actors,
>objects, rooms, etc. in separate files, or whether you keep them more
>together by say, "section of the game".

> I decided to keep events near the objects or locations they
>impact, and to keep minor actors near the location they are involved
>with. Otherwise I have separate files for objects, locations, and for
>each major actor.

> Some of the distinctions get a little messy though, and I
>sometimes have trouble finding things that I know I need to work on.
>I can't always remember where I put that little piece of code.

Depends on the length of the game. Much of the inspiration I get comes
randomly, often by looking over topic-meaningless code, so I try to
keep everything in one file -- especially because I do my editing (for
now) in Edit, specifically a version not supporting multiple windows.

Sometimes, however, this gets annoying; for instance, my largest game
got so that I couldn't load it when Windows was running or there wouldn't
be enough conventional memory left for it. Functions and classes were
seperated into another file, and just recently I've begun dividing the
main file into smaller parts. These smaller sections contain mostly
location and decoration objects; I have a list of all the aliases to my
location objects, so I don't worry about them. The active objects are
still -- for now -- in one file.

On the other hand, my writing of that game has been very schizophrenic,
and I'm recoding most of it anyway.

-----------

The imperturbable TenthStone
tenth...@hotmail.com mcc...@erols.com mcc...@gsgis.k12.va.us

David Glasser

unread,
Sep 18, 1998, 3:00:00 AM9/18/98
to
J. Robinson Wheeler <whe...@jump.net> wrote:

> When I started learning Inform recently, I began by porting this
> game from TADS to Inform, and quickly decided that I had to go back
> to integrating objects with the rooms they were in, mainly because
> of the Object -> syntax.

You do realize that you can use this syntax:

Object foobar "magical foobar of Baz" baz

to create a foobar in baz? The Object -> isn't a requirement.

--David Glasser
gla...@NOSPAMuscom.com | dgla...@NOSPAMfcs.pvt.k12.pa.us
http://onramp.uscom.com/~glasser | http://www.geocities.com/SoHo/6028
DGlasser @ ifMUD : fovea.retina.net:4000 (webpage fovea.retina.net:4001)
Interactive Fiction! MST3K! David Eddings! Macintosh!

burn...@cs.lafayette.edu

unread,
Sep 19, 1998, 3:00:00 AM9/19/98
to
Oh, I'm obsessive about this kind of thing. Basically I orgranize my inform
files like this:

1) In my "main" file I keep the model world. Rooms and objects that are in
them at the start of the game.

2) I keep my Entry Point Routines including Initialize in one file.

3) I keep my stand alone routines in one file.

4) I keep my verbs and associated routines in one file.

5) I keep each NPC in their own file.

6) I keep objects that are initially in the players inventory in one file.

7) I keep objects that are not present anywhere in the game world at the start
of the game in one file.

8) I keep conversation topic objects in yet another file.

9) And finally I keep all the class declartions in a seperate file.

That's A LOT of files I know but when I want something I can get to it REALLY
REALLY fast and the files stay relatively short.

Jesse

In article <360091ab...@news.nu-world.com>,
l...@nu-world.com (Lelah Conrad) wrote:

> I'd be interested in hearing whether you keep all your actors,
> objects, rooms, etc. in separate files, or whether you keep them more
> together by say, "section of the game".
> I decided to keep events near the objects or locations they
> impact, and to keep minor actors near the location they are involved
> with. Otherwise I have separate files for objects, locations, and for
> each major actor.
> Some of the distinctions get a little messy though, and I
> sometimes have trouble finding things that I know I need to work on.
> I can't always remember where I put that little piece of code.
>

> Lelah
>
> or is it just the alzheimer's coming on? :)
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----

T.J.A. Thurman

unread,
Sep 19, 1998, 3:00:00 AM9/19/98
to
"Jonadab the Unsightly One" <jon...@zerospam.com> writes:
[...]

> That's my problem with multiple files. I can't find things.
Grep is your friend, even under MS stuff.

Thomas
--
Thomas Thurman, Sidney Sussex College, | "...the name of Marigold's
Cambridge. CB2 3HU | tj...@cam.ac.uk | Godmother's house begins with I,
http://www.sid.cam.ac.uk/~tjat2/ | ><> | and it is a five-syllable word."

Brent VanFossen

unread,
Sep 20, 1998, 3:00:00 AM9/20/98
to
On Thu, 17 Sep 1998 09:29:24 -0500, "J. Robinson Wheeler"
<whe...@jump.net> wrote:

>Helping me in learning Inform was looking at the code for Christminster,
>which I thought was excellently broken down into smaller files, one
>for each "chapter" of the story, basically.

And as tremendously helpful as the code of Christminster was for me, I
found the breaking of the game into separate files frustrating.

I divide my source into sections with related objects together,
separated by comment lines that identify the section. All I have to
do to find a piece of code is to use the search feature of my text
editor. I can quickly locate any or every incidence of whatever I'm
searching for. One file is easier to archive than ten files would be.
One file is also easier to search.

Minor NPCs get grouped with the location where they live. Major NPCs
grow large enough to take up an entire section of their own.

Brent VanFossen

Reply all
Reply to author
Forward
0 new messages