What's interesting about ZIL?

The single most interesting thing is probably that it lets you build your own abstractions.

ZIL started out as a Lisp variant for mainframes, and the high-level Lisp features are still there to shape the language to the game’s needs. For instance:

  • The standard direction properties have syntax for making different kinds of exits:
  (NORTH TO OTHER-ROOM)
  (SOUTH TO DUNGEON IF IRON-GATE IS OPEN ELSE "The rusty gate won't budge.")

Suppose your game has a lot of people guarding doors. You might add a new syntax:

  (WEST TO CELL GUARDED BY VAMPIRE WHO "glares menacingly and you don't dare approach")
  • The library’s test system defines new syntax for test cases:
<TEST-CASE ("Take individual objects with AND")
    <COMMAND [TAKE HAT AND BANANA]>
    <EXPECT "hat: You wear the hat.|
banana: You pick up the banana.|">
    <CHECK <AND <IN? ,HAT ,WINNER> <FSET? ,HAT ,WORNBIT>>>
    <CHECK <IN? ,BANANA ,WINNER>>
    <CHECK <NOT <IN? APPLE ,WINNER>>>>

Every block like that becomes a routine that loads the input buffer, runs the action and captures its output, etc., and all the test routines and descriptions are loaded into tables without the author having to count or list them.

  • Adventure defines new syntax for maze rooms:
<MAZE-ROOM ALIKE-MAZE-6
    (EAST 3) (WEST 5) (DOWN 7) (SOUTH 8)>

<DEAD-END-ROOM DEAD-END-1 WEST ALIKE-MAZE-4>

Common properties are set automatically, e.g. MAZE-ROOM sets the description, and DEAD-END-ROOM creates an OUT exit as well as the specified direction.

1 Like

That’s pretty neat - some powerful compact features there I wouldn’t have expected so early on. I’d be fascinated to see your source code when complete.

You can see it in its current, mostly-complete state on Bitbucket: Adventure, library, library tests.