name-spaces and loading a file

Terry Reedy tjreedy at udel.edu
Sat Feb 19 14:35:04 EST 2000


"Alex Shinn" <foof at eyeofdog.com> wrote in message
news:8766vn2ijn.fsf at curious.eyeofdog.com...
> I'm working on an interactive story engine with the primary purpose of
> making it easy for non-programmers to write story modules.  A story
> would be comprised of a collection of files, each describing a scene,
> like the following:
...

Suggestions (emailed and posted):

1. Separate initial processing of input text from run-time use of compiled
internal version so you
can optimize different data forms for different operations (writing versus
running).

2. Allow more than one scene per system file (easy if you do 1.); little
files take up extra space (especially on Win95 with 32K disk blocks) and can
be a nuisance to work with.  Some authors may prefer to have related scenes,
if not all, in one file for easier editing.

3. Compile input text to either dictionary or scene class instance (former
may seem initially easier, but latter bundles scene methods within scene
class).  In other words, exec just once before running.

4. Store scene objects in one runtime file with marshall or pickle and
shelve (which you can use as an external dictionary).

5. To make interaction instantaneous: keep scenes when moving to another;
  prev_scene = cur_scene
After displaying graphic and text, read the possible next scenes.  This will
finish before a person can read and respond.  Then prompt for what to do.
-- (Optional, after or instead of above)  To reduce disk access further,
keep a cache of scenes (100 say depending on size and memory), deleting the
least most recently used when reading another off the disk.
This is a pretty standard algorithm; python code was posted a couple of
years ago and might be findable via DejaNews.

Terry J. Reedy








More information about the Python-list mailing list