home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 8 / amigaformatcd08.iso / screenplay / utilities / graal / graal_tutorial.text < prev    next >
Text File  |  1996-10-15  |  107KB  |  2,872 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                             GRAAL - THE MANUAL
  8.  
  9.                                ___________
  10.                                ===========
  11.                                \         /
  12.                                 |       |
  13.                                 |       |
  14.                                 |       |
  15.                                 |       |
  16.                                  \_   _/
  17.                                    | |
  18.                                    | |
  19.                                    | |
  20.                                    | |
  21.                                    | |
  22.                                   /   \
  23.                                  =======
  24.  
  25.  
  26.  
  27.                             A Tutorial Manual
  28.                                for GRAAL 2
  29.  
  30.  
  31.                               by Per Thulin
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.                  GRAAL is the Swedish spelling of GRAIL
  42.                  - A suitable symbol and frequent guest
  43.                            in adventure games!
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.                     © Performance Software 1995/1996
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                  CONTENTS
  64.                                  ========
  65.  
  66.  
  67.  
  68.   1 INTRODUCTION
  69.       1.1 COPYRIGHT NOTICE(S)
  70.       1.2 ABOUT THE MANUAL
  71.       1.3 RELEASE INFO
  72.       1.4 KNOWN BUGS
  73.  
  74.   2 (FINALLY:) THE INTRODUCTION
  75.       2.1 SO, WHAT IS GRAAL?
  76.       2.2 OTHER TOOLS OF THE TRADE
  77.       2.3 THE THINGS THAT MAKE A GRAAL
  78.       2.4 GRAAL SCRIPT FILES
  79.       2.5 THE GRAAL.MAIN FILE
  80.       2.6 THE .ROOM FILES
  81.       2.7 THE .SECTION FILES
  82.       2.8 THE .SCENE FILES
  83.       2.9 THE .PTRN FILES
  84.       2.10 RUNNING THE ADVENTURE
  85.  
  86.   3 STARTING ON AN ADVENTURE
  87.       3.1 STARTING ON THE GRAAL.MAIN FILE
  88.       3.2 THE HERO - WHAT A CHARACTER!
  89.       3.3 BASICS ABOUT IMAGES AND BOBS
  90.       3.4 THE IMAGES IN THE GRAAL.MAIN FILE
  91.  
  92.   4 "A ROOM! A ROOM! A KINGDOM FOR A ROOM!"
  93.  
  94.   5 THE OBJECT MATTER
  95.  
  96.   6 SECTION OBJECTS AND BOBS
  97.  
  98.   7 (LIGHTS! CAMERA! ACTION!)
  99.  
  100.   8 USING EXITS
  101.  
  102.   9 THE DACT STATEMENTS
  103.  
  104.   10 HAVING A CHAT
  105.  
  106.   11 MASTER CLASS: CHARACTER AND GRAPHICS DESIGN
  107.       11.1 SIZE
  108.       11.2 COLOUR
  109.       11.3 DESIGNING ANIMATIONS
  110.       11.4 ALL ABOUT 3D AND HOTSPOTS
  111.  
  112.   12 MASTER CLASS: CUTSCENES
  113.       12.1 HOP, SKIP AND JUMP
  114.       12.2 NO BREAKS!
  115.       12.3 NESTING
  116.  
  117.   13 MASTER CLASS: SPECIAL TECHNIQUES OR "HOW THE HECK DID HE DO THAT?"
  118.       13.1 SPEAKING IN A FOREIGN TONGUE
  119.       13.2 AN AUTOMATED ROOM
  120.       13.3 THE ART OF AVOIDING A SEAGULL
  121.       13.4 A SPITTING IMAGE
  122.       13.5 A MAP ROOM
  123.       13.6 A SMALL GUY
  124.  
  125.   14 MASTER CLASS: HINTS AND TIPS
  126.       14.1 FLAGS
  127.  
  128.   15 QUESTIONS AND ANSWERS
  129.  
  130.  
  131.   SUPPORT TOOLS
  132.  
  133.   A THE ON-LINE MONITOR
  134.       A.1 OBJECT CONTROL
  135.       A.2 ROOM CONTROL
  136.       A.3 DIALOGUE CONTROL
  137.       A.4 BACK TO GRAAL
  138.  
  139.   B MACROS
  140.  
  141.   C "PRODUCTIFYING" YOUR ADVENTURES
  142.  
  143.   D THE EDITOR
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150. 1 INTRODUCTION
  151. ==============
  152.  
  153.  
  154.  
  155. 1.1 COPYRIGHT NOTICE(S)
  156. -----------------------
  157.  
  158. GRAAL 2 is Shareware. If you like it and use it, register and make
  159. me happy!
  160.  
  161. All rights to the GRAAL system remains with Performance Software and
  162. is copyright © 1996 Per Thulin.
  163.  
  164. Users of GRAAL may use the system freely to distribute their own
  165. graphic adventures, but are completely forbidden to use any of the
  166. supplied example material - puzzles, characters, animations, or
  167. scenes - in their own work. Quite simply, all material used in your
  168. own GRAAL adventures must be your own!
  169.  
  170. The shareware version of GRAAL is not crippled in any way, but it is
  171. not quite adapted for professional use, which is explained later in
  172. this manual.
  173.  
  174. You may not use the unregistered version of GRAAL for commercial
  175. purposes. If you plan on making money from your adventures, you
  176. MUST register GRAAL - and the registered version of GRAAL is really
  177. the only way to package GRAAL adventures in a safe and semi-professional
  178. way, not giving all the game's secrets away in unscrambled script files
  179. and the on-line monitor!
  180.  
  181.  
  182. To register, simply send the
  183. equivalent of £15, (or 150 SEK), in cash to:
  184.  
  185. Per Thulin
  186. Malmtorgsgatan 18
  187. S-653 40  KARLSTAD
  188. SWEDEN
  189.  
  190. State your current shareware version. You will receive the missing
  191. production tools, and the latest version if changes have been made
  192. to the Shareware version you already have.
  193.  
  194.  
  195. GRAAL is coded in Amos Professional. You know it makes sense... :)
  196. Also, let's not forget that Black Legend Craft 1 extension. It made
  197. things that much easier!
  198.  
  199. (The GRAAL Editor is coded in Blitz 2 Basic. You know it makes even
  200. more sense... ;)
  201.  
  202.  
  203.  
  204. 1.2 ABOUT THE MANUAL
  205. --------------------
  206.  
  207. This manual contains an awful lot of text. Don't be discouraged -
  208. that is simply because each little GRAAL statement carries an awful
  209. lot of power (and because I'm such a blabbermouth), and some sophisticated
  210. initial definitions automate most of the gameplay! Before you get totally
  211. discouraged, print out the following files from the example disk(s):
  212.  
  213. graal.main
  214. 1.section
  215. 1.room
  216.  
  217. If you look at these files, and disregard the abundance of comment
  218. lines starting with /*, you will quickly realise how precious little
  219. GRAAL code is actually needed for the basics of an adventure, and be
  220. able to read on with a lighter heart. Also remember that there is an
  221. editor included making your GRAAL-coding life a lot easier - you don't
  222. have to enter that many tricky parts manually, the editor can help you.
  223.  
  224.  
  225. The GRAAL documentation is divided into five main parts:
  226.  
  227. 1. The graal_2.readme file - essential to all who wants to read about
  228.    the news in GRAAL 2.
  229.  
  230. 2. This Tutorial Manual.
  231.  
  232. 3. An AmigaGuide on-line reference (graal.guide)
  233.  
  234. 4. The GRAAL Editor documentation (Editor.text)
  235.  
  236. 5. The productification tools documentation (prod.text)
  237.  
  238.  
  239. This manual contains:
  240.  
  241. 1. This introductory section, describing what GRAAL is and what it
  242.    is not.
  243.  
  244. 2. The tutorial section, describing how GRAAL was used to create the
  245.    first seven rooms of the Olaf Longhair adventure (the demo portion of
  246.    which is supplied with this release of GRAAL).
  247.  
  248. 3. "Master Classes" - more in-depth discussions on some of the
  249.    trickier concepts - dialogues, graphics, and so on.
  250.  
  251. 4. "Q:s and A:s", a section that also will be expanded upon in the
  252.    future - provided there are enough people interested!
  253.  
  254. If you want to play the provided "Olaf" demo AND build your own
  255. Graphic Adventure, I strongly suggest you play the game first! 
  256. Because "Olaf" is used as an example throughout the tutorial, some
  257. of the secrets of the demo is given away here. This is also a good
  258. way of deciding whether this kind of stuff is what you want to spend
  259. the rest of your life doing :-)
  260.  
  261.  
  262. 1.3 RELEASE INFO
  263. ----------------
  264.  
  265. This version of GRAAL has been tested on an A600 with WB 2.05, and
  266. an A1200 with WB 3.0. (If you want to make your own games, you need
  267. at least a standard A1200 and a hard drive)
  268.  
  269. System Requirements: Hard disk, >2MB RAM and fastmem recommended.
  270. The GRAAL text editor requires WB 2.0 or above.
  271.  
  272. GRAAL v2 brings you:
  273.  
  274. * A graphic adventure point'n'click interface along the lines of, 
  275.   among others, the Indy games and Monkey Island (Trademarks of
  276.   LucasArts Ltd.).
  277.  
  278. * Automation of most of the main character's walking, talking, and
  279.   general fiddling around.
  280.  
  281. * 32- or 64-colour (EHB), automatically scrolling background screens, 
  282.   320 to 640 pixels wide and 120 pixels high.
  283.  
  284. * Fully configurable command area and graphics set-up.
  285.  
  286. * "Unlimited" number of locations (rooms) in a game.
  287.  
  288. * Room and section data swapped in and out of memory at runtime to
  289.   minimise the growth of permanent in-memory data as the adventure
  290.   grows.
  291.  
  292. * Side-view "simulated 3D" scenes with foreground, any level of
  293.   middle and background objects.
  294.  
  295. * Animated objects and characters.
  296.  
  297. * Pixel-perfect detection of objects.
  298.  
  299. * A rather intelligent and easy-to-use dialogue system for those
  300.   totally silly discussions with sidekick characters we all have come
  301.   love so much.
  302.  
  303. * An equally intelligent and smart but perhaps a little more
  304.   difficult-to-grasp floor definition system - for defining legal
  305.   movement paths and automatic negotiation of obstacles.
  306.  
  307. * Cut-scenes.
  308.  
  309. * Soundtracker style music modules for background music.
  310.  
  311. * IFF and raw samples for sound effects.
  312.  
  313. * Run-time error checking (to a degree).
  314.  
  315. * GRAAL automatically detects if a GRAAL adventure is run from diskette
  316.   or hard disk, and adjusts disk swapping and save/load routines
  317.   accordingly.
  318.  
  319. * Also automatically detects extra memory and uses this as cache memory
  320.   to avoid unnecessary disk access.
  321.  
  322. * All tools needed except an art/animation package and (optional)
  323.   sound sampler equipment.
  324.  
  325. * Diskette layout system for automatic copying and labelling of
  326.   distribution master diskettes.
  327.  
  328. * Dynamic on-line monitor and debugger for script testing, on-the-
  329.   fly temporary corrections, and examination of the game status.
  330.  
  331. * A text editor especially constructed to be GRAAL-friendly, with extra
  332.   features to help with the editing of the more complex GRAAL statements
  333.  
  334.  
  335. The developer's registered version also gives you:
  336.  
  337. * Optimisation and encryption of distribution files.
  338.  
  339. * A keyfile disabling the monitor and other development functions for
  340.   the final delivery version.
  341.  
  342. * Extra graphics files offering various "requester looks".
  343.  
  344.  
  345. It does NOT bring you:
  346.  
  347. - Dynamic depth-scaling of characters.
  348.  
  349. - AGA (but on the other hand, a much broader customer base for your
  350.   games. Let's be kind to those ECS users out there! :)
  351.  
  352. - Multiple character control
  353.   ( planned for version 334.0. Let's be honest - it hasn't added too
  354.   much to the games where it has been used ;-)
  355.  
  356.  
  357. 1.4 KNOWN BUGS
  358. ---------------
  359.  
  360. * On my A1200/WB3.0, something in GRAAL (and other large, compiled
  361.   Amos Pro programs) constantly triggers the Workbench warning sound.
  362.   This is a little annoying, and I cannot guarantee that there is a
  363.   way to fix it, since the problem lies somewhere within the way Amos
  364.   Pro compiles.
  365.  
  366.   However, the remedy is simple enough: Just make sure to turn the
  367.   Workbench warning signals off using Prefs before using GRAAL or
  368.   playing a GRAAL game.
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375. 2 (FINALLY:) THE INTRODUCTION
  376. =============================
  377.  
  378.  
  379. Welcome to GRAAL. Maybe thy quest is over!
  380.  
  381. ...or maybe it has just begun. Because, although GRAAL is a powerful
  382. tool, designing a graphic adventure still needs an awful lot of hard
  383. work from your side - all GRAAL does is take most of the actual
  384. coding work out of the job and lets you get on with designing the
  385. story, logic, backgrounds, objects, animated characters and
  386. dialogue! Which, in itself, should keep you busy for quite a while.
  387.  
  388. GRAAL was mainly invented along with the 7-room demo of the first
  389. ever GRAAL adventure "Olaf Longhair, Part I", delaying the release
  390. of both, but ensuring that GRAAL really works on a full-scale and
  391. rather advanced graphic adventure. Although maybe not quite up to
  392. LucasArts standards, it proves that GRAAL can make at least a
  393. budget-level game any day! And since this manual was written
  394. parallel to the code that went into "Olaf" and GRAAL itself, you
  395. should find everything of importance right here.
  396.  
  397.  
  398. 2.1 SO, WHAT IS GRAAL?
  399. ----------------------
  400.  
  401. All GRAAL adventures consist of:
  402.  
  403. * The GRAAL program, which is the "adventure engine". It is named
  404.   GRAAL_2 in the development package. When you use it to run a
  405.   specific game, it is usually renamed to whatever that adventure
  406.   is called.
  407.  
  408. * GRAAL script files, containing the statements that make up the
  409.   adventure. There are different kinds of script files: One
  410.   graal.main file, .room files, .section files, .scene files, and
  411.   .ptrn files.
  412.  
  413. * IFF image files, depicting background scenes and object and
  414.   character "clip-art".
  415.  
  416. * A file called diskinfo.graal. This file contains, among other
  417.   things, the names of all the other files used in your adventure.
  418.   This file is used by GRAAL to locate files and handle disk
  419.   swapping in an intelligent way if your game gets so big it does
  420.   not fit onto one disk.
  421.  
  422. * Optionally, soundtracker music modules and sample banks.
  423.  
  424.  
  425. 2.2 OTHER TOOLS OF THE TRADE
  426. ----------------------------
  427.  
  428. If you don't have AmigaGuide (or Multiview - WB 3 and above), get hold
  429. of it NOW. You'll need it to read the on-line command reference.
  430.  
  431. You will not go far without a good paint program like Deluxe Paint, 
  432. Brilliance or Personal Paint to create all backgrounds, objects and
  433. animations. An image processing program like Photopaint, Image FX
  434. or ADPro is a good complement.
  435.  
  436. To take some of the work out of the backdrop scene creation, why not
  437. use a 3D modelling and rendering package? (Believe it or not, there
  438. are some good ones that are freeware, even - POV-ray, for instance.)
  439.  
  440. A sound sampler and software could also come in handy, as could a
  441. scanner or digitizer. But hey, it's up to you. Or rather, your
  442. wallet.
  443.  
  444.  
  445. 2.3 THE THINGS THAT MAKE A GRAAL
  446. --------------------------------
  447.  
  448. Because there are a lot of things in the GRAAL system to keep track
  449. of, and you need almost all of it to make the adventure work, the
  450. manual will try to explain most of the stuff in the tutorial form, 
  451. followed by in-depth discussions on a number of the trickier
  452. subjects and concepts. There is also an on-line command reference
  453. in Amigaguide format, which is a necessary complement to this manual, 
  454. and which will be vital once you get hang of things in general. Also, 
  455. the Olaf 1 demo provides you with well commented script files of all
  456. types. These demonstrate almost all major GRAAL techniques. (Beware:
  457. READ THE COPYRIGHT NOTICE!)
  458.  
  459. But first, a quick general look at the general structure of a
  460. GRAAL game:
  461.  
  462.  
  463. 2.4 GRAAL SCRIPT FILES
  464. ----------------------
  465.  
  466. The GRAAL code needed to make an adventure tick is contained in a
  467. number of script files. It is a compact language; if it wasn't for
  468. the heavy commenting, they would not take up too much space at all!
  469.  
  470. There are different types of script files, each controlling
  471. a different portion of the game. Their relationships form a tree-
  472. shaped structure, like this:
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.                       +-----------------+
  481.                       !   GRAAL.MAIN    !
  482.                       !                 !
  483.                       +--------+--------+
  484.                                !
  485.                 +--------------+--------------+
  486.                 !                             !
  487.        +--------+--------+           +--------+--------+
  488.        !    1.SECTION    !           !    2.SECTION    !
  489.        !                 !   . . .   !                 !
  490.        +--------+--------+           +--------+--------+
  491.                 !                             !
  492.           +-----+-----+                 +-----+-----+
  493.           !           !                 !           !
  494.      +----+----+ +----+----+       +----+----+ +----+----+
  495.      ! 1.ROOM  ! ! 2.ROOM  !       ! 3.ROOM  ! ! 4.ROOM  !
  496.      !         ! !         ! . . . !         ! !         !
  497.      +---------+ +---------+       +---------+ +---------+
  498.  
  499.  
  500. There may be any number of .section files beneath the graal.main
  501. file, and any number of .room files under each .section file.
  502.  
  503. (Although placed in the middle of the structure, the importance of
  504. section files vary greatly depending on the design of your adventure.
  505. In some cases, you may want to have only the one section file, 
  506. containing nothing at all! More about this further on.)
  507.  
  508. In all these script files there are three basic kinds of lines:
  509.  
  510. Comment lines - All comment lines must begin with the characters
  511.  
  512. /*
  513.  
  514. which can be followed by any text, like in
  515.  
  516. /* This is a comment if ever I saw one!
  517.  
  518. Use comments a lot, because the GRAAL syntax is not particularly
  519. reader-friendly, and what was clear in your mind when you typed it in
  520. may seem like pointless rubbish a couple of weeks later - if you don't
  521. have the comments there to remind you.
  522.  
  523. Empty lines - may be used as separators for improved readability.
  524.  
  525. Statement lines - each statement line contains a statement (or
  526. keyword, if you will), followed by a colon, and one or more
  527. parameters separated by semicolons. Like this:
  528.  
  529. statement: parameter1;parameter2;...;parameterN
  530.  
  531. In many cases, the parameters contained in a keyword line are
  532. conditions or commands, containing their own parameters. Example:
  533.  
  534. ACTION: 4;IFRF 2=0;SAY I Can't do that;EXIT
  535.  
  536. In this example, ACTION is a statement that comes into play when
  537. GRAAL is checking a command input by the player. More precisely, the
  538. ACTION statement in this example will be used if a sentence using
  539. verb 4 (parameter 1) has been entered by the player. GRAAL will then
  540. execute the commands SAY and EXIT, but only if the condition
  541. IFRF 2=0 has been fulfilled first.
  542.  
  543. Note: There must be a space between the ":" and the parameters, but
  544. there must be no spaces around the semicolons separating the
  545. parameters! Also, there is no semi-colon after the last parameter in
  546. a line.
  547.  
  548. Each statement in a script file may be up to 255 characters long.
  549. The script files are case sensitive, so make sure all keywords are
  550. written in upper case.
  551.  
  552. Any line in the three types of script files mentioned above that does
  553. not conform to the rules will be spotted by GRAAL at run-time, normally
  554. causing the execution of the adventure to halt with an error message.
  555. Double-check everything, and use the GRAAL editor for help with the
  556. parameter syntax and syntax checking!
  557.  
  558.  
  559.  
  560. 2.5 THE GRAAL.MAIN FILE
  561. -----------------------
  562.  
  563. "All right, but what do these different script files actually do?" I
  564. hear you scream.
  565.  
  566. Good questions! The first, and in many ways the most important, is
  567. the graal.main file. It is called that because that is what it must
  568. be called - if GRAAL doesn't find a graal.main file in the current
  569. directory, it will say so and terminate.
  570.  
  571. The graal.main file sets up everything that is common to the entire
  572. adventure, such as:
  573.  
  574. * All basic aspects of the main character's behaviour - he's
  575.   certainly going to be around in the entire adventure!
  576.  
  577. * Where the adventure starts.
  578.  
  579. * The fonts to be used for the user interface.
  580.  
  581. * All the objects that can be carried anywhere in the game.
  582.  
  583. * All the characters involved in dialogues.
  584.  
  585. * All the actions The main character can take that are common to all, 
  586.   or at least to most, locations.
  587.  
  588.  
  589. 2.6 THE .ROOM FILES
  590. -------------------
  591.  
  592. Once GRAAL has interpreted the graal.main file, it knows which room
  593. file to look for first. All room files have the suffix .room
  594. preceded by the room number, so the first room file used in the
  595. adventure is very often called 1.room . (If you decide on a better
  596. starting point for the adventure later on, you may of course tell
  597. GRAAL to start in, for example, room 45 instead.)
  598.  
  599. Since GRAAL reserves memory for each possible room number from 1 and
  600. up to the highest room number used, it is quite wasteful to have
  601. "gaps" in the room sequence. If you have deleted some rooms in the
  602. middle of the sequence, use the vacant numbers when you add new
  603. rooms, thus minimising the gaps in the numbering sequence.
  604.  
  605. The .room files do much the same for each adventure location or
  606. "room" as the graal.main file does for the adventure as a whole.
  607.  
  608. They contain, among other things, the following:
  609.  
  610. * The name of the IFF file to be used as the background in the
  611.   Scene Area.
  612.  
  613. * Information about "clip-art" to be loaded in and used as graphic
  614.   elements and objects for this particular room.
  615.  
  616. * The dialogues that take place in this room.
  617.  
  618. * The objects that can only exist within this room.
  619.  
  620. * All actions that are specific to this room.
  621.  
  622.  
  623. 2.7 THE .SECTION FILES
  624. ----------------------
  625.  
  626. .section files are very similar to .room files. Their main purpose
  627. in life is to make GRAAL more memory efficient. The basic idea is
  628. that many graphic adventures are divided into logical sections, a
  629. section being a number of connected rooms where the same objects can
  630. be handled and a number of puzzles need to be solved before you can
  631. move on to the next section. However, once you are through with a
  632. section, there are a number of objects and images you will never use
  633. again, and therefore they can be deleted from memory the freed space
  634. can be used for the objects of the new section. Or, perhaps the
  635. rooms of the section share a lot of graphics - like a labyrinth in a
  636. system of caves probably would.
  637.  
  638. How you define sections is up to you, and you do not need to use the
  639. concept at all if it is irrelevant. (In that case, just use section
  640. 1 for all the rooms, and place no commands in the 1.SECT file - just
  641. a few comment lines describing what the blazes you are up to, with a
  642. couple of totally blank lines in between.)
  643.  
  644.  
  645. 2.8 THE .SCENE FILES
  646. --------------------
  647.  
  648. .scene files are known as cut-scene files, containing non-
  649. interactive parts of the adventure (playing much like cartoon
  650. movies). They can also be used as subroutines, saving you the
  651. work of re-coding the same set of commands in a lot of places.
  652.  
  653. The cut-scene files are a little special (but simpler) than the
  654. previous script files, and will be discussed later on.
  655.  
  656.  
  657. 2.9 THE .PTRN FILES
  658. -------------------
  659.  
  660. .ptrn files are not scripts as such - they contain definitions of
  661. animation patterns that would be too long to enter into the other
  662. script files directly, or you wish to re-use in a number of
  663. different places in your scripts - or all of the above. (For those
  664. of you familiar with Amos Pro, the contents of the PTRN files follow
  665. the AMAL syntax exactly.)
  666.  
  667.  
  668. 2.10 RUNNING AN ADVENTURE
  669. -------------------------
  670.  
  671. At some point or other, you feel that the script files are ripe for
  672. testing. This is simply a matter of trying to start the adventure by
  673. running GRAAL_2, which must be placed in the same directory as all
  674. the script and graphics files you refer to in the game.
  675.  
  676. (You should, of course, run the syntax checker in the GRAAL_Editor
  677. on all scripts first to get rid of all typing errors and other such
  678. mistakes. This takes far less time than re-running GRAAL_2!)
  679.  
  680. First, the GRAAL_2 program loads. Then, the GRAAL title screen is shown.
  681. The progress indicator (the horizontal bar) indicates that the contents
  682. of the graal.main file are being loaded and processed. When the title
  683. screen disappears and the screen goes blank for a moment, the system is
  684. working on the first .room script.
  685.  
  686. Most likely, you will get some error messages before everything starts
  687. running smoothly. A GRAAL "run-time error" message will appear in yellow
  688. text surrounded by a red border on screen, stating the type of error, which
  689. room was currently loaded, and which file was last accessed. Note: This
  690. file may in some cases not be the actual culprit! For example, If GRAAL
  691. has loaded a small cutscene file, executed it and run into a problem in
  692. the calling script later on, it is still the name of the completely
  693. innocent cutscene file that is shown, so take this information for what
  694. it is.
  695.  
  696. Some problems may be of a less severe nature. In those cases, GRAAL
  697. sometimes lets you decide whether to continue playing, or exit the
  698. program (in which case it tries to clean up the memory just as if you
  699. give the "Q"uit command when playing the game the normal way).
  700.  
  701. Continuing after such a warning is not always safe: The error almost
  702. certainly affects some aspect of the game. However, things like flag
  703. value errors may often be corrected using the on-line monitor (see the
  704. appendices).
  705.  
  706. Also note that in the error messages, the offensive statements and commands
  707. are sometimes printed in a slighlty different way from how they appear
  708. in the script: All RBOBn, SBOBn, ROBJn and SOBJn statements are "translated"
  709. to show a numeric BOB image or object number. So if your N_xxxxBOBS
  710. statement in the graal.main file decide that ROOMBOBS start at image number
  711. 51, an erroneous statement containing RBOB4 would actually show up as
  712. the number "54" in the error message. (Sorry 'bout that. Read on, and
  713. perhaps you will understand what the heck I am talking about later.)
  714.  
  715. There will most likely always be some errors that are not trapped properly, 
  716. and the system may just "die on you". In those cases, try to determine how
  717. far the loading process has actually gone, and check the structure of YOUR
  718. scripts carefully against the Olaf 1 demo and the order in which things
  719. appear there! Also, resetting your Amiga before trying again often helps.
  720.  
  721. For an overview of the features of the GRAALplayer interface, read the
  722. "Olaf.guide" that contains instructions for the demo adventure.
  723.  
  724.  
  725. Enough of this already. Ready to start on an adventure?
  726.  
  727.  
  728.  
  729.  
  730.  
  731. 3 STARTING ON AN ADVENTURE
  732. ==========================
  733.  
  734.  
  735. I won't bother you with a lot of talk about how you must plan the
  736. contents of your adventure, have a good storyline, and so on and so
  737. forth. If you don't that's not my fault, is it? I simply assume you
  738. HAVE a story to tell, and that you are well aware of how graphic
  739. adventures of this kind works - if you don't, you'd better play some
  740. first. I will then show how you can do it all using GRAAL.
  741.  
  742. I won't even go into the basic idea behind my example adventure "Olaf
  743. Longhair", because surely you have played the demo by now!
  744.  
  745. This tutorial concentrates on everything that makes the first four
  746. rooms in Olaf Longhair tick - because once we have that much going, 
  747. almost everything follows along the same lines (or will be pointed
  748. out separately).
  749.  
  750. The four rooms, in order of appearance, are:
  751.  
  752. 1. The bar, where Olaf wakes up the morning after the night before, 
  753.    and has an informative chat with the bartender.
  754.  
  755. 2. The street outside the bar, where he bumps into a strange-
  756.    looking guy with an even stranger-looking animal.
  757.  
  758. 3. The harbour, where he meets a foreign captain and deals with a
  759.    rather irritating seagull.
  760.  
  761. 4. The shopping emporium of one Ali Harrod, Esq.
  762.  
  763.  
  764. 3.1 STARTING ON THE GRAAL.MAIN FILE
  765. -----------------------------------
  766.  
  767. Look at the graal.main file now.
  768.  
  769. One of the best ways to start out is to take a graal.main file that
  770. actually works, and alter it to suit your own needs. Using the GRAAL
  771. editor, you can also choose to create a graal.main file template, 
  772. with comments and statements showing what is mandatory and what is not.
  773. (This method can laso be used for the other script types.)
  774.  
  775. Here are some statements that can be set almost immediately. The other
  776. ones will be dealt with once we start designing rooms, objects and
  777. characters for the adventure.
  778.  
  779.   NAME: "Olaf Longhair - GRAAL Demo Version"
  780.  
  781. The name of my adventure is "Olaf Longhair Goes East". (The quotes
  782. are not there because they enclose a string or anything - I actually
  783. want them displayed on screen when the name of the adventure is
  784. called up by pressing the [V] key during a game!)
  785.  
  786.   VERSION: ...
  787.  
  788. The adventure version number. This is especially useful to guarantee
  789. that you don't try to load old saved game files when testing a newer
  790. version of the adventure.
  791.  
  792. Then follows a lot of statements dealing with the player interface
  793. layout, and numbers setting limits for how many images, objects, and
  794. other things GRAAL can handle in your adventure. Read the comments in
  795. the graal.main file, that's the best way to learn about them. Also, 
  796. each statement is thoroughly described in the "GRAAL.guide" on-line
  797. reference.
  798.  
  799. At this point, we will not get much further without bringing the big
  800. star, our main character, the man, Olaf Longhair himself, into play!
  801.  
  802.  
  803. 3.2 THE HERO - WHAT A CHARACTER!
  804. --------------------------------
  805.  
  806. One of the things GRAAL makes so easy to manage is the point and
  807. click control of the main character - in this case, Olaf.
  808. GRAAL controls what animation sequence is the correct one to use in all
  809. standard situations, in which direction Olaf is heading, where in a
  810. room he can actually place his feet, and so on.
  811.  
  812. Wonderful as all this may be, it doesn't relieve you of the responsibility
  813. for the character design - in other words, before GRAAL can do all this
  814. wonderful stuff, you must design the main character and the animations
  815. used for his basic movements.
  816.  
  817. Basically, what we need now are some still images and animation cels
  818. showing Olaf in various standardised poses. For "Olaf", all these are
  819. placed in the IFF picture file "Olaf_Original.iff", which you should
  820. take a look at now.
  821.  
  822. What the images portray are:
  823.  
  824. * Olaf walking towards, away, and sideways
  825.  
  826. * Olaf's front, back, and profile when standing still
  827.  
  828. * Olaf talking - the front, back, and profile views.
  829.  
  830. * Olaf manipulating things - also front, back and sideways views, 
  831.   but for each view also in three "height" versions - for objects
  832.   high up, far down, or "in mid-air".
  833.  
  834. As you notice, the images of Olaf in the file are neatly and evenly
  835. spaced. This makes it easier for GRAAL to "cut out" these images and
  836. store them in its image bank later.
  837.  
  838. Also note that there are no separate images for the right and left
  839. profiles - to make life a little easier, and less memory consuming, 
  840. the profile images will simply be flipped by GRAAL when a reversed
  841. view is required.
  842.  
  843. We will need more images of Olaf during the course of the game, but
  844. since they will only be used for special occasions, they are loaded
  845. into memory only when they are needed and erased afterwards. So
  846. "Olaf_Original.iff" contains all the "global" images of our main
  847. character and favourite hero.
  848.  
  849.  
  850. 3.3 BASICS ABOUT IMAGES AND BOBS
  851. --------------------------------
  852.  
  853. We are going to talk a lot about stills, cels, animations and BOBs
  854. in this tutorial, all concepts dealing with how an image is used.
  855.  
  856. A still is any image that is static.
  857.  
  858. An animation is any image that moves, and it does so by using a
  859. number of slightly different stills replacing each other, called
  860. ANIMATION CELS.
  861.  
  862. BOB is short for Blitter OBject. BOBs are well-known to Amos
  863. programmers. They are, basically, the way GRAAL displays all
  864. graphics on screen that aren't just backdrops: Objects, animated
  865. characters, texts, and so on. BOBs can be put into the display and
  866. deleted again without harming the backdrop picture. To achieve this, 
  867. the system must keep track of all the little graphic bits and pieces
  868. by assigning each one used at any time with a BOB number. To make it
  869. easier to keep track of the images used by the BOBs, they are stored
  870. in a BOB image bank.
  871.  
  872. Any BOB may use any image (or vice versa, depending on how you look
  873. at the world). For example, BOB number 44 may be used to display a
  874. flower, held in image bank position 56, in one scene. In another
  875. room or scene, the same BOB number 44 may be used to display a
  876. knife, which is image 78 in the bank. Confusing? Just keep this in
  877. the back of your head until we start discussing the script file
  878. statements!
  879.  
  880. Since re-cycling is the word of the day, there is no difference in
  881. the image types used for different purposes - all are stored in the
  882. BOB image bank, and you may use the same image as an animation cel
  883. in one situation and as a still image in another.
  884.  
  885. The BOB bank where we store all images, must be logically divided
  886. into four sections:
  887.  
  888. 1. BOB images for system use occupy slots 1-10. This reserved area
  889.    is not really necessary anymore - all user interface graphics
  890.    can be stored in any global BOB position - but it's kind of a
  891.    left-over from previous versions. (The only thing it REALLY means
  892.    that you actually have 10 more global bobs that you actually
  893.    specify with the N_GLOBALBOBS: statement. However, if you want
  894.    to keep things neat and tidy, I recommend you use 1-10 only for
  895.    "system graphics", and store "game graphics" in... see below...)
  896.  
  897. 2. Global BOB images are those that are kept in memory at all
  898.    times, for example all Olaf's basic movements. The number of
  899.    slots used for these are defined with the N_GLOBALBOBS: statement.
  900.    11 is always the starting number for this range. Make an
  901.    educated guess how many of these you'll need. "Olaf" uses about
  902.    40, which translates to images 11 to 50.
  903.  
  904. 3. Room BOB images are images that are only needed in a specific
  905.    room - as soon as the game switched to a new room, all these
  906.    images are erased from memory and replaced by the graphics for
  907.    the new room. The number of these is defined by the N_ROOMBOBS:
  908.    statement. When referred to in the scripts, their numbers are
  909.    always prefixed with RBOB: RBOB5 means room BOB 5
  910.  
  911. 4. Section BOB images work the same way as room BOBs, but for a
  912.    section (collection of connected rooms) rather than a single
  913.    room. Their number is defined by the N_SECTIONBOBS: statement.
  914.    When referred to in the scripts, their numbers are always prefixed
  915.    with SBOB: SBOB10 means section BOB 10.
  916.  
  917. If you make a mistake when estimating the number of each image
  918. category here, it is not the end of the world. The definitions can
  919. be altered at any time later on.
  920.  
  921.  
  922. 3.4 THE IMAGES IN THE GRAAL.MAIN FILE
  923. -------------------------------------
  924.  
  925. Back to the graal.main file now, to practice what was just preached:
  926.  
  927. N_GLOBALBOBS: 40
  928. N_SECTIONBOBS: 30
  929. N_ROOMBOBS: 70
  930.  
  931. This means that right now, we believe we need 40 global BOB images, 
  932. 30 for use in sections, and 70 for use in rooms. If we change our
  933. minds later on, we can always change the numbers then.
  934.  
  935. Let's define the main character's images. The statement
  936.  
  937. CLPART: Olaf_Original.iff
  938.  
  939. tells GRAAL that following statements will grab images from the
  940. picture file Olaf_Original.iff
  941.  
  942. BOBS: 10;11;1;1;31;47;32;0
  943.  
  944. tells GRAAL to grab 10 BOB images and store them in image slot 11
  945. and upwards (slots 1-10 are reserved for system use, remember?)
  946.  
  947. More BOBS and CLPART statements follow upon this first one, until
  948. all basic images we need have been stored in the image bank.
  949.  
  950. Now the images we need for Olaf's basic behaviour is in the image
  951. bank, which means we can tell GRAAL a little about their basic
  952. properties and how they should be used.
  953.  
  954. CHARACTER_HEIGHT: 40
  955. CHARACTER_WIDTH: 22
  956.  
  957. are two statement stating Olaf's approximate and average height and
  958. width. These values are used to position Olaf properly on the
  959. background in relation to walls, and also to place the text
  960. representing Olaf's speech at a proper distance above his head.
  961.  
  962. CHARACTER_COL: 9
  963.  
  964. Olaf's speech will be shown as text with colour no. 9. Use a rather
  965. bright colour, which along with the automatically added black border
  966. around the text should make it readable enough.
  967.  
  968. STILL_RIGHT: 14
  969. STILL_LEFT: $800E
  970. STILL_BACK: 12
  971. STILL_FRONT: 11
  972.  
  973. These statements tell which still images are to be shown when Olaf
  974. is facing in the respective direction, doing nothing.
  975.  
  976. But wait a minute: What is that strange BOB image $800E? Oh, that's
  977. quite simple, at least according to the very special logic of AMOS
  978. Pro syntax: It is simply image 14, flipped over so that it faces
  979. left instead of right! The "$" indicates that this is a hexadecimal
  980. number. Well, "E" is 14 in hexadecimal, and the Amos Pro way of
  981. flipping BOBs is to add hex 8000 to the image number! Thus, 14, 
  982. flipped over, is $800E!
  983.  
  984. (This strange remnant of Amos syntax may be eliminated in coming
  985. versions of GRAAL - then again, it may not. It would slow execution
  986. down if I altered it.)
  987.  
  988. Anyway, on with it.
  989.  
  990. PAUSE_RIGHT: 13
  991. PAUSE_LEFT: $800D
  992. PAUSE_BACK: 12
  993. PAUSE_FRONT: 11
  994.  
  995. These images are used when Olaf pauses after having gone in a
  996. certain direction. If you wish, they may be set to exactly the same
  997. values as the STILL_ images. However, as you see, Olaf uses image
  998. 13, a slightly more relaxed, forward-facing and "ready-for-input"
  999. pose, for the right and left poses in these statements than in the
  1000. STILL_ statements. 
  1001.  
  1002. (You don't HAVE to make the left pose the flipped-over version of
  1003. the right pose - if you want to draw different images for each
  1004. direction, go right ahead. But I'm too lazy!)
  1005.  
  1006. WALK_RIGHT: A 0,(16,6)(15,6)(14,6)(17,6)(18,6)(17,6) ...
  1007. WALK_LEFT: A 0,($8010,6)($800F,6)($800E,6)($8011,6) ...
  1008. WALK_AWAY: A 0,(29,8)(30,8)(31,8)(30,8)
  1009. WALK_TOWARD: A 0,(26,8)(27,8)(28,8)(27,8)
  1010.  
  1011. So far, all we have done is to specify still images. Now we enter
  1012. into the gruelsome, yet strangely attractive world of animation! And
  1013. yes, AMOS Pro users will immediately give a cry of joy: It's AMAL!
  1014.  
  1015. AMAL is AMOS Pro's animation language, and yes, GRAAL uses the same
  1016. syntax for animations. So let's see what we've got here:
  1017.  
  1018. "A 0," simply tells GRAAL to repeat the following animation sequence
  1019. indefinitely. (Stay calm - GRAAL will handle all starting and
  1020. stopping of standard character animations automatically.)
  1021.  
  1022. "(16,6)(15,6)(14,6)" and so on are the images and display lengths of
  1023. each animation cel. For WALK_RIGHT, first image 16 is displayed for
  1024. 6 frames (=screen updates), then image 15 is displayed for 6 frames, 
  1025. and so on. When the end of the list is reached, the animation loops
  1026. and starts over with image 16 again. As you see in the WALK_LEFT
  1027. statements, flipped images are used in animations also - no
  1028. problems.
  1029.  
  1030. It's quite wise to use 6 frames as the smallest time space for any
  1031. image during background scrolling - 3 is possible and may work well
  1032. if you have a limited number of BOBs in each scene in your adventure.
  1033. However, if you paint on a large canvas so to speak, the system will
  1034. have problems fitting all graphic updates into a 3 frame space and so
  1035. the animation may become jerky. (6 isn't safe in all situations, but
  1036. it usually works and is a good compromise.)
  1037.  
  1038. WALK_SPEED: 1.2
  1039.  
  1040. This statement just adjusts the speed with which the character
  1041. walks. Especially when walking sideways, you wish it to look like it
  1042. is the character's feet that actually propel him across the floor -
  1043. watch some really bad cartoons, and you will spot how the characters
  1044. "glide" across the floor as if it was made of ice! The proper value
  1045. here depends on how large steps your character takes in your
  1046. animations. Do a little experimenting!
  1047.  
  1048. TALK_MAP: 11;A 0,(20,18)(11,12)(20,12)(11,6)(19,12)
  1049.  
  1050. Not only walking is animated and automated in GRAAL - talking is as
  1051. well. The animation to be used for speech in each situation is not
  1052. connected to a certain direction, but rather to what image is
  1053. displayed on screen at the time the character starts talking - The
  1054. above statement tells us to use this animation if the character is
  1055. facing forwards (image 11) when the speech starts. As you see in
  1056. graal.main, there are six TALK_MAP:s specified - all STILL_ and
  1057. PAUSE_ images are accounted for, which indeed they must be for GRAAL
  1058. automation of the speech to work in all standard situations. Up to
  1059. eight TALK_MAP:s may be specified in all.
  1060.  
  1061. HANDLE_MAP: 11;A 1,(11,12)(36,1);A 1,(11,12)(34,1);A 1,(11,12)(35,1)
  1062.  
  1063. Standard "manipulation" or handling of objects are specified in a
  1064. similar manner - the animation to be used when a certain object is
  1065. handled depends on a) the previous character image on screen and b)
  1066. whether the object in question is placed high up, low down or in
  1067. mid-air - an animation sequence for each possible position is
  1068. supplied in the same statement, separated by semicolons.
  1069.  
  1070. Note that the last image in each sequence should be specified as
  1071. shown for only ONE frame - this is because a) the character will
  1072. stay in that position during the handling of the object anyway, and
  1073. b) we wish to immediately do some other graphic tricks after the
  1074. HANDLE command has been given, such as placing an object in the
  1075. character's out-stretched hand. Specifying too long a pause in these
  1076. animation sequences would produce an unwanted pause in the flow of
  1077. the script.
  1078.  
  1079. To summarise, if the character is facing forward using image 11, and
  1080. suddenly is commanded to handle an object placed in mid-air, (the
  1081. cup in the "Constantinoplian" bar is a concrete example), the middle
  1082. animation sequence in the above statement, which is "A
  1083. 1,(11,12)(34,1)", would be executed.
  1084.  
  1085. OK. That was a lot of hard work and tricky definitions to sink one's
  1086. teeth into, but guess what? We're done! We have actually completed a
  1087. large percentage of the animations needed for our hero, and can get
  1088. on with designing the adventure proper!
  1089.  
  1090. The statements we have defined above will be used and executed time
  1091. and time again throughout the adventure, and in a fully automated
  1092. fashion, too. But you control-freaks should not worry too much:
  1093. GRAAL contains enough script commands to enable you to break away
  1094. from the standard poses and animations in any given special
  1095. situation - if you are willing to take on the extra work and extra
  1096. coding in the scripts that is required.
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103. 4 "A ROOM! A ROOM! A KINGDOM FOR A ROOM!"
  1104. =========================================
  1105.  
  1106.  
  1107. As you may gather from the heading of this chapter, we now quite
  1108. badly need a room or other location to move about in - having our
  1109. hero confined to a lot of abstract image and animation statements in
  1110. the graal.main file will not make anyone happy.
  1111.  
  1112. Let's start with room number one. That's logical, because we have
  1113. already stated in the graal.main file that the adventure will start
  1114. there, remember? And this adventure starts in the bar, so room 1
  1115. will be "The Last Bar in Constantinople".
  1116.  
  1117. Similar to how the main properties of the adventure is defined in
  1118. graal.main, the properties of room 1 is defined in the file 1.room.
  1119. Have a look.
  1120.  
  1121. The first statement we come across here is
  1122.  
  1123. UPDATE: 3
  1124.  
  1125. which sets the updating speed of the scene area. The higher the
  1126. number, the slower the screen updating, and the more graphics GRAAL
  1127. is capable to shift between updates. To keep animations etc. from
  1128. becoming jerky, the number must be set high enough to cope with all
  1129. graphics.
  1130.  
  1131. Actually, this only becomes a real problem when the background is
  1132. scrolling, so the number set here is only used during such scrolls.
  1133. At all other times, the update rate is 3. And in this room, the
  1134. whole thing is completely irrelevant, because the scene fits into
  1135. the display without scrolling - it is exactly 320 pixels wide. For
  1136. other rooms, like the harbour, UPDATE: is set to 6. (I have designed
  1137. all of "Olaf":s animations to work with the update range set in
  1138. multiples of 3.)
  1139.  
  1140. Next, there comes a
  1141.  
  1142. SECTION: 1
  1143.  
  1144. statement, indicating that this room is part of section 1, as are
  1145. all the rooms making up Constantinople in this game.
  1146.  
  1147. Next, we need a background picture for the scene area. I prepared
  1148. the interior of this rather primitive bar in the file "1BG.IFF"
  1149. using the 3D modelling and rendering freeware program POV-RAY. The
  1150. gorgeous 24-bit image that was the result was then reduced to 16
  1151. colours, creating an image that is crude but suitably "cartoon-like"
  1152. for the purpose.
  1153.  
  1154. The background's 16 colour registers went into colour numbers 16-31
  1155. in the 32-colour palette, and the 16 standard colours used for Olaf
  1156. and any other common BOBs and images were copied into the palette in
  1157. places 0-15 (see the Master Classes for more info on handling
  1158. colours). The background file is defined with the
  1159.  
  1160. BG_IFF: 1BG.IFF
  1161.  
  1162. statement.
  1163.  
  1164. In GRAAL version 1, the height of the background iff:s must be 120, 
  1165. but the width may be from 320 up to 640, making for excellent
  1166. scrolling background scenarios (as shown in the Constantinople
  1167. main street and the Baghdad panorama, for instance)..
  1168.  
  1169. Each time we enter a new room, Olaf must have a starting position
  1170. and pose. This is defined by the
  1171.  
  1172. START_POS: 1;13;20;115;L;1
  1173.  
  1174. statement. This not only indicates where Olaf starts, but whether
  1175. the background screen starts scrolled to the far left, far right or
  1176. the middle. (In this case, it's all the same, since the scene fits
  1177. within the screen width.)
  1178.  
  1179. Any number of starting positions may be defined for the same room -
  1180. great for those really awkward labyrinths!
  1181.  
  1182. GRAAL is not truly 3D - nothing shown on a computer screen ever is -
  1183. but uses a simulated 3D persective. The bar in 1BG.IFF has a floor, 
  1184. extending from the very bottom of the scene area and a few lines up
  1185. in the picture - if Olaf moves higher up in the picture, he is also
  1186. going further back in the room. (The effect is demonstrated more
  1187. fully by the alley in the street outside the bar, which Olaf can
  1188. actually "walk into".)
  1189.  
  1190. Now, in order for Olaf to stay on the floor and not start climbing
  1191. the walls of the bar, we need some way of restricting his
  1192. movement. We do that using statements like
  1193.  
  1194. FLOOR: 1;16;113;304;119;1-1/2-2/3-3/4-4
  1195.  
  1196. Each such statement defines a rectangular part of the picture where
  1197. Olaf may place his feet. If there is more than one such rectangle, 
  1198. each is defined by a separate floor statement, and all floors must
  1199. overlap with at least one other floor to enable Olaf to find his way
  1200. from one floor to another. The last parameters, "1-1/2-2", describe
  1201. how Olaf navigates between the two floors in this room. See the the
  1202. FLOOR statement in the on-line reference for more information about
  1203. this.
  1204.  
  1205. It wouldn't be much fun to have an adventure take place in only one
  1206. room (although such a thing IS possible - how about a "closed room
  1207. murder mystery"?). So the next statement, 
  1208.  
  1209. EXIT: 1;5;60;12;119;10;116;Exit to\street
  1210.  
  1211. defines an exit from the bar. This creates a "clickable" rectangle
  1212. on the screen with some additional parameters describing the
  1213. properties of the exit. We will come back to the subject of
  1214. switching rooms further on.
  1215.  
  1216. So, now we have a background, an exit, and area to move about on, 
  1217. and much more. Time to add some special graphics to the room to
  1218. spice things up a little.
  1219.  
  1220. CLPART: 1FG.IFF
  1221.  
  1222. is a statement telling GRAAL that we wish to grab some clipart from
  1223. the 1FG.IFF file to use as images in this room. The
  1224.  
  1225. ROOMBOBS: ...
  1226.  
  1227. statements that comes next follow the syntax of the BOBS: statement
  1228. we used in the graal.main file. Every image grabbed with this
  1229. statement should later be referred to by a "room BOB image number", 
  1230. which is a number proceeded by "RBOB". For example, RBOB3 means room
  1231. BOB image 3.
  1232.  
  1233. The images we grab as RBOBs are all used for objects and graphics
  1234. that are unique to this room, and are not much use outside it
  1235. (although you CAN grab clipart from the same 1FG.IFF file anywhere
  1236. you like in the game, of course).
  1237.  
  1238. Perhaps some of the clipart we just loaded is supposed to be pasted
  1239. into the scene without doing anything except being pretty. The
  1240. statements STATIC: and ANIM: are used for this purpose - which one
  1241. depends on whether the image should be static or animated. We have
  1242. two such static objects in the bar. One is the barrel behind which
  1243. Olaf appears. It has no other function except hiding Olaf at the
  1244. start of the game and being a general foreground object which adds
  1245. a bit of depth to the scene. The other is the wooden pillar, also
  1246. placed in the foreground.
  1247.  
  1248. That is the graphics department of room 1 over and done with.
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256. 5 THE OBJECT MATTER
  1257. ===================
  1258.  
  1259.  
  1260. You could, theoretically, spring Olaf loose in the bar now, but
  1261. there would be absolutely nothing to do - just an exit pointing to
  1262. an undefined room, floors to move about on - and a barrel to hide
  1263. behind! So far, there is not a single object to interact with!
  1264.  
  1265. Just as with BOB images, objects are defined in various places
  1266. depending on where in the adventure they may appear - just in one
  1267. room, in a section, or in the entire adventure. Sticking with the
  1268. 1.room file for the moment, you see some
  1269.  
  1270. ROOMOBJ: ...
  1271.  
  1272. statements here. They define objects which are never removed from
  1273. the bar, and never changed in any way: One of the barrels, the plate
  1274. of spam that Olaf refuses to touch, and so on. Room objects are a
  1275. great way of adding atmosphere, detail, and red herrings to a game
  1276. without wasting computer memory - from the players' point of view, 
  1277. there is no way of telling whether an object is a room, section, or
  1278. global object. Only you know!
  1279.  
  1280. The policy in the tutorial is to leave details to the on-line
  1281. reference, but understanding the properties of an object is rather
  1282. vital, so we will examine one of the global objects present in the
  1283. bar closely. (The room objects are no good for this purpose, since
  1284. their use is severely restricted - they can't be picked, up, 
  1285. altered, or anything like that!).
  1286.  
  1287. In the graal.main file, locate the line
  1288.  
  1289. OBJECT: 16;piece of\paper;8;-1;56;RBOB6;60;119;14;0;$800E;with;-1;0; 
  1290.         8;47;LOW;WD;an;this;it
  1291.  
  1292. This statement describe the sheep bones on the left barrel in the
  1293. bar, and in some detail! Let's take it parameter by parameter:
  1294.  
  1295. 16; 
  1296.  
  1297. means this is global object number 16.
  1298.  
  1299. piece of\paper; 
  1300.  
  1301. is the name of the object. The backslash is replaced by a backslash
  1302. when the name is shown in the scene area.
  1303.  
  1304. 8; 
  1305.  
  1306. is the room where the object first appears
  1307.  
  1308.  
  1309. VIS; 
  1310.  
  1311. means the object can be seen and handled. (NVIS means "invisible".)
  1312.  
  1313. 56; 
  1314.  
  1315. is the BOB number (not the IMAGE number!) that will be used when
  1316. displaying the object.
  1317.  
  1318. RBOB6; 
  1319.  
  1320. is the BOB image number which is used to display the object by
  1321. default. This could also be an animation sequence using the same
  1322. animation syntax as the TALK_MAP: etc. statements explained
  1323. previously.
  1324.  
  1325. But wait a minute! We use an RBOB image, obviously grabbed in the
  1326. 8.room file, to display a global object, which is obviously not tied
  1327. to that one room? Isn't this strange? 
  1328.  
  1329. No, it actually makes sense. Room 8 is the only place where the
  1330. piece of paper will actually be SHOWN in that shape - when it is
  1331. used further on in the game, it will only be displayed using
  1332. its inventory icon. So this is a safe use of RBOBs!
  1333.  
  1334. 60;119; 
  1335.  
  1336. is the x and y position of the RBOBs hotspot.
  1337.  
  1338. 14;0; 
  1339.  
  1340. is the "character offset". When Olaf wants to handle the piece
  1341. of paper, he will walk to a position 14 pixels to the right and 0
  1342. pixels above the object's hotspot.
  1343.  
  1344. $800E; 
  1345.  
  1346. is the still image used to display Olaf once he has walked up to the
  1347. object. Since the object is to the left of him, he will face it using
  1348. image $800E. And specifying the correct still image for each object is
  1349. vital: Should Olaf begin to handle the object after walking up to
  1350. it, the HANDLE_MAP sequence linked to image $800E will be used. Should
  1351. he start to talk, the TALK_MAP sequence linked to the image will be
  1352. used. But you need not worry about this, as long as you specify the
  1353. HANDLE_MAPs, TALK_MAPs and still images used for object handling
  1354. correctly!
  1355.  
  1356. with; 
  1357.  
  1358. is a preposition. If a preposition exists, it is assumed that this
  1359. object can not be USEd on its own - it must be combined with
  1360. something else, and so the sentence line will read USE PIECE OF
  1361. PAPER WITH, and the system will wait for a second object to be clicked.
  1362. If this parameter is left blank, the object will be used on its own.
  1363.  
  1364. PICK; 
  1365.  
  1366. indicates that the object can be picked up (the condition IFPICK returns
  1367. TRUE). NPICK is used for the opposite.
  1368.  
  1369. Actually, you can easily override this parameter using script
  1370. commands - picking upp objects marked NPICK, and making the character
  1371. refuse to pick up objects marked PICK. Still, this setting means objects
  1372. which rely on the global ACTION: statements dealing with picking up and
  1373. dropping handles the object in the right way.
  1374.  
  1375. Also, there is no risk in making an object pickable even if it is
  1376. initially invisible (NVIS). If it cannot be seen, it cannot be accessed
  1377. by the player, and thus, the PICK status becomes insignificant...
  1378.  
  1379.  
  1380. (This should ALWAYS be NPICK for room objects, unless you make
  1381. sure you make the character drop the object again before he leaves
  1382. the room!)
  1383.  
  1384. 0; 
  1385.  
  1386. If the object is animated using an animation command (instead of the
  1387. single RBOB17 for this example), the animation channel must be
  1388. specified here. The range of possible values is 2-16, and as with
  1389. BOB numbers, the same number may not be used for two things
  1390. simultaneously. The piece of paper is not animated, and therefore this
  1391. parameter is 0.
  1392.  
  1393. 8; 
  1394.  
  1395. This is the object's "quick command", that is, the command issued when
  1396. the player points to the objects and clicks the right mouse button.
  1397. Verb 8 is LOOK AT.
  1398.  
  1399. 47; 
  1400.  
  1401. This is the object icon used to show the object in the inventory:
  1402. Global BOB image 47.
  1403.  
  1404. LOW; 
  1405.  
  1406. This is an important one for all objects which can be picked or
  1407. handled! It determines which of the "handle animations" Olaf will
  1408. use. Since the piece of paper is on the floor, the LOW animation
  1409. will be used. (Always place objects, or Olaf, using the character
  1410. offset co-ordinates so that one of the three positions can be used
  1411. in a natural way!)
  1412.  
  1413. DW; 
  1414.  
  1415. This is an "attribute string" which can be used to determine some
  1416. general properties for the object. "D" stands for dead object, and
  1417. "W" for "wood". (A rather pointless attribute in this case. Basically, 
  1418. it only tells us that it is softer then stone or steel!)
  1419.  
  1420. Attributes are used to make basic responses to some actions seem more
  1421. natural - you don't have to define separate replies to all objects, 
  1422. but can specify a general response for all cases of Olaf trying to
  1423. use the small knife on objects made of wood, for instance. You may
  1424. also find an "abstract" class very useful - when Olaf attempts to
  1425. pick up the horizon, it enables you to respond with some really
  1426. insulting remarks!
  1427.  
  1428. You should remember that GRAAL is quite flexible in many ways, one
  1429. being that there exists GRAAL commands to alter many of the object's
  1430. properties, such as the name, visibility, location and so forth at
  1431. any time during the game. See the on-line reference for a complete
  1432. list of commands. Generally speaking, the statements in the script
  1433. files set things up - it is the commands contained in DACT, LACT and
  1434. ACTION statements executed during gameplay that brings the whole
  1435. thing to life!
  1436.  
  1437. While we are at it, let us examine another, but more human, global
  1438. object: The bearded man / bartender.
  1439.  
  1440. Characters which are involved in dialogues must always be specified
  1441. as global objects. The bartender, starting out as the "bearded man", 
  1442. is one example. So, what is the difference between a bearded man and
  1443. some sheep bones? Well, the bartender is animated using a default
  1444. animation sequence, as you see. This sequence also uses RBOBs, since
  1445. the bartender never leaves 1.room. Furthermore, the bartender can
  1446. not be picked up (there's a relief!) and uses animation channel
  1447. number 8 for the animation. His special attributes are "MV" -
  1448. meaning he's a male character and alive.
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455. 6 SECTION OBJECTS AND BOBS
  1456. ==========================
  1457.  
  1458.  
  1459. There are a third class of objects involved in the bar scene, those
  1460. defined in the section file 1.section with the SECTIONOBJ:
  1461. statements. These are objects that only exist the very first time a
  1462. new section of the game is visited, and disappears again before the
  1463. section is exited. It is not that useful, but some of the objects in
  1464. Constantinople is of this kind - the magic flute, for example, which
  1465. disappears into the pawn shop before you can leave town.
  1466.  
  1467. You will probably find section BOB images (SBOBs) more useful than
  1468. section objects. These are grabbed in the section file the same way
  1469. RBOBs are grabbed in the room files, but with the SECTIONBOBS:
  1470. statement. Needless to say, they remain in memory during the visit
  1471. to the section, but disappear and are replaced by other graphics the
  1472. moment you walk into another game section.
  1473.  
  1474. You are not obliged to use the section concept at all, especially if
  1475. your adventure is quite small. However, you must have at least one
  1476. section file in your adventure, even if it just contains a comment
  1477. saying "Not Used". Then specify all your rooms as belonging to this
  1478. "empty" section.
  1479.  
  1480. Okay, we have everything in place, except one VERY important thing -
  1481. the instructions telling Olaf to deal with the commands you give
  1482. him!
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489. 7 (LIGHTS! CAMERA! ACTION!)
  1490. ===========================
  1491.  
  1492.  
  1493. We now have the lights and the camera, so to speak. But precious
  1494. little action. (Well, the lights aren't actually turned on yet. That
  1495. is done with a LIGHTS ON command, explained further on!)
  1496.  
  1497. All conditions and commands used to respond to the player's actions
  1498. are placed in ACTION: statements (leaving the dialogues out of it
  1499. for the moment).
  1500.  
  1501. ACTION: statements may appear in all three major types of script
  1502. file: .room, .section and graal.main.
  1503.  
  1504. The idea is that the ACTION: statements taking care of a certain
  1505. action is placed closest to the place where the action takes place.
  1506. If an action can only take place in one specific room, the ACTION:
  1507. statements for it are placed in that .room file. If the action is
  1508. only valid in a certain section, they are placed in the .section
  1509. file. If it is something that needs to be taken care of regardless
  1510. of where it appears, the graal.main file is the place.
  1511.  
  1512. In fact, almost every action should have some "safety net" in the
  1513. graal.main file - if no specific action is taken in the ACTION
  1514. statements of the .room and .section files, the graal.main ACTION:
  1515. statements should at least make it look like Olaf understood what
  1516. you were trying to do! There is nothing more unrewarding than
  1517. clicking away on lots of things and have absolutely nothing happen.
  1518.  
  1519. Okay. So we write a lot of action statements containing commands
  1520. that makes Olaf walk, talk, and jump! But how does GRAAL know when
  1521. to use what actions?
  1522.  
  1523. Well, suppose we want to pick up the cup on the barrel. Let's look
  1524. at how that is performed in GRAAL, keeping in mind that GRAAL always
  1525. checks the .room file first, then the .section file, and finally, if
  1526. nothing else helps, the graal.main file! Each file is checked from
  1527. the  top down to the bottom, which is very important to remember in
  1528. order to get the sequence of tests and commands right.
  1529.  
  1530. When the player has clicked PICK UP and the CUP, GRAAL starts
  1531. looking for appropriate ACTION: statements, knowing the number of
  1532. the verb (PICK UP = 2) and the object (the CUP is section object 3, 
  1533. referred to as SOBJ3).
  1534.  
  1535. The first parameter in each ACTION: statement is always the verb
  1536. number, and in 1.room, the first ACTION: 2;... statement that we
  1537. come across is
  1538.  
  1539. ACTION: 2;IFOBJ 1;....
  1540.  
  1541. "IFOBJ 1" is a condition telling us that the rest of this ACTION
  1542. should only be executed if our object was number 1. It wasn't - it
  1543. was SOBJ1 - so we continue to the next statement.
  1544.  
  1545. ACTION: 2;IFOBJ ROBJ1;....
  1546.  
  1547. No luck here, either. We weren't after the plate of spam, known as
  1548. ROBJ1, so we continue, and quickly find that there are no more
  1549. ACTION:s for verb 2 in the room file.
  1550.  
  1551. Switching to the 1.section file, let's see if we are more lucky. No, 
  1552. not a single PICK UP command, actually. This is not so surprising, 
  1553. since almost all objects start out in a certain room.
  1554.  
  1555. Well, why then wasn't there a command to handle the cup in the
  1556. 1.room file? Because, with the power of GRAAL, almost all PICK UPs
  1557. of any "pickable" object can be handled using a few single lines in
  1558. the graal.main file - the two objects especially handled in the
  1559. 1.room file were there because they are handled a little differently
  1560. from most of the rest. Going on to the graal.main file then, we find
  1561. the following:
  1562.  
  1563. ACTION: 2;IFCARR;SAY I Already have it!;EXIT
  1564.  
  1565. IFCARR says that if the object we refer to is already in the
  1566. inventory, then let Olaf say "I already have it!". EXIT means no
  1567. more tests on ACTION statements will be done for our current
  1568. input: The sentence line will be cleared and Olaf is ready to try
  1569. something else.
  1570.  
  1571. However, SOBJ1 is NOT in our inventory yet, so we go on:
  1572.  
  1573. ACTION: 2;IFPICK;MOBJ;HANDLE;W 12;PICK;HANDLE -1;EXIT
  1574.  
  1575. Now behold the true power of the GRAAL. This is the stuff we have
  1576. been tormenting ourselves for all along the tutorial up to this
  1577. point!
  1578.  
  1579. IFPICK; 
  1580.  
  1581. If the object is "pickable"...
  1582.  
  1583. MOBJ; 
  1584.  
  1585. Olaf walks to the default offset position next to the object (as
  1586. specified in the OBJECT: statement for the cup)...
  1587.  
  1588. HANDLE; 
  1589.  
  1590. Olaf stretches out a hand according to the HANDLE_MAP: animation...
  1591.  
  1592. W 12; 
  1593.  
  1594. and waits for about 1/4 of a second...
  1595.  
  1596. PICK; 
  1597.  
  1598. grabs the object (it disappears from the screen and enters the
  1599. inventory list)...
  1600.  
  1601. HANDLE -1; 
  1602.  
  1603. lowers the hand again to the position it had before the
  1604. HANDLE command...
  1605.  
  1606. EXIT; 
  1607.  
  1608. ...and then we are done!
  1609.  
  1610.  
  1611. Now, if our object hadn't been "pickable", the ACTION: used by us
  1612. above are followed by a couple of "safety nets". (Remember, we never
  1613. get to these lines if the object has indeed been picked up - the
  1614. "EXIT" command sees to that.) One example of such a safety net is:
  1615.  
  1616. ACTION: 2;IFTYPE -;SAY That was rather far-fetched, wasn't
  1617.   it?;EXIT
  1618.  
  1619. IFTYPE -; 
  1620.  
  1621. This checks if the referred object was an abstract object, like the
  1622. horizon in the Constantinople harbour. Since abstract objects can't
  1623. very well be picked up under any circumstances, 
  1624.  
  1625. SAY That was rather far-fetched, wasn't it?;EXIT
  1626.  
  1627. makes olaf "speak" this sentence using the talk-map corresponding to
  1628. his current position on the screen, and
  1629.  
  1630. And finally, if the object happens to be un-pickable, but of another
  1631. type, 
  1632.  
  1633. ACTION: 2;SAY I can't pick that up.;EXIT
  1634.  
  1635. gives a rather dull but to-the-point message to the player.
  1636. Don't go erasing ACTIONs in the supplied example graal.main file
  1637. altogether the first thing you do - a lot of these "safety net"
  1638. actions should be in almost any game, although you should of course
  1639. alter the wording and detailed behaviour to suit your own needs!
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647. 8 USING EXITS
  1648. =============
  1649.  
  1650.  
  1651. Now that we are familiar with the general behaviour of ACTION
  1652. statements, it is time to explain how exits work.
  1653.  
  1654. As you may or may not remember, the EXIT: statement in the 1.room
  1655. file defined a "clickable" rectangle on screen. However, we never
  1656. explained what happens when the player clicks the exit.
  1657.  
  1658. This is what happens: GRAAL interprets this as a very special input
  1659. sentence, with the VERB set to 0 and OBJ1 set to the number of the
  1660. exit. It then checks the ACTION statements just as if the player had
  1661. input a normal command. This is a typical ACTION statement to take
  1662. care of an exit command:
  1663.  
  1664. ACTION: 0;IFOBJ 1;MEXIT;GOTO 2,1
  1665.  
  1666. 0; 
  1667.  
  1668. was the verb number indicating an "exit click".
  1669.  
  1670. IFOBJ 1; 
  1671.  
  1672. tests if it was exit number 1 that was clicked.
  1673.  
  1674. MEXIT; 
  1675.  
  1676. is a special command that can only be used in ACTION: 0;...
  1677. statements. It makes the main character move to the exit point
  1678. specified in the EXIT: statement (not to be confused with the EXIT
  1679. *command*, which is something completely different).
  1680.  
  1681. GOTO 2,1
  1682.  
  1683. is a command specifying which room and entrance to go to. Voilà!
  1684.  
  1685. Of course, you are free to do whatever you like in these statements, 
  1686. just like in any other ACTION statement. You may manipulate the way
  1687. exits are interpreted to your heart's content!
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694. 9 THE DACT STATEMENTS
  1695. =====================
  1696.  
  1697.  
  1698. In each room file, there must be at least one DACT statement. The
  1699. DACT statements contain conditions and commands that are run through
  1700. each time the room is entered. The flow of control is the same as
  1701. for ACTION statements - if a condition is not met, the rest of that
  1702. DACT statement is disregarded, and if an EXIT command is
  1703. encountered, no more DACT lines will be checked this time around.
  1704.  
  1705. When GRAAL starts to run through the DACT statements, all graphics
  1706. and objects are already loaded into their proper places. However, 
  1707. the screen is still black - the light switch has not been pushed
  1708. yet, so to speak. This means you can do tests and move things around
  1709. using commands in the DACT statements before you let the player see
  1710. the scene, which is very, very useful. Once you are done preparing
  1711. the scene, simply use a LIGHTS ON command in a DACT statement. When
  1712. an EXIT command is encountered, control is handed over to the
  1713. player.
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720. 10 HAVING A CHAT
  1721. ================
  1722.  
  1723. There is only one major subject we have not discussed at all so far:
  1724. How to talk to other characters in the game.
  1725.  
  1726. In the bar where the game starts, there is a bearded bartender who
  1727. are very likely to become the first person Olaf speaks with. Let's
  1728. look at how this is done.
  1729.  
  1730. First of all, any character involved in conversations must be
  1731. defined as an object using an OBJECT statement in the graal.main
  1732. file. There is nothing special with the definition: Just make sure
  1733. the object cannot be picked up, visible, and placed in the room
  1734. where the dialogue takes place. Also, assign an animation channel to
  1735. it.
  1736.  
  1737. Each dialogue has its own unique number, and is defined by a
  1738. DLG statement in the graal.main file (below the OBJECT statements).
  1739. The  bearded man/bartender dialogue is dialogue number 1, and this
  1740. is the DLG statement:
  1741.  
  1742. DLG: 1;5;11;-20;A 0,(RBOB4,12)(RBOB6,24)...
  1743.  
  1744. 1; 
  1745.  
  1746. means this is dialogue number one.
  1747.  
  1748. 5; 
  1749.  
  1750. means that the object Olaf talks to is global object 5 (the
  1751. bartender).
  1752.  
  1753. 11; 
  1754.  
  1755. is the colour used for the text displayed when the bartender speaks.
  1756.  
  1757. -20; 
  1758.  
  1759. determines how far above the bartender's head the text is displayed.
  1760.  
  1761. A 0,(RBOB4,12)(RBOB6,24)....
  1762.  
  1763. is the animation used when the bartender talks.
  1764.  
  1765.  
  1766. Now that we have two statements in the graal.main file, we move on
  1767. to the 1.room file, where the actual dialogue contents are defined.
  1768.  
  1769. A dialogue always starts when GRAAL encounters a DSET command in an
  1770. ACTION or DACT statement. It then shifts into another mode, where
  1771. the player's input is no longer a normal command sentence, but only
  1772. the number of a dialogue alternative. GRAAL responds to the chosen
  1773. alternative by going through LACT statements that correspond to the
  1774. selected alternative, and does not consider the ordinary ACTION
  1775. statements. Sooner or later, GRAAL encounters an EDLG command in one
  1776. of the LACT statements, which terminates the dialogue and switches
  1777. the game back to the normal input mode.
  1778.  
  1779. Let's begin from the beginning. When the player commands TALK TO 
  1780. BEARDED MAN, the following ACTION line is performed:
  1781.  
  1782. ACTION: 5;IFOBJ 5;IFOF 1=0;MOBJ;SAY Hello;RESP R,1,Hello,yourself; 
  1783.   DSET 1,+3,+7,+9,+11;EXIT
  1784.  
  1785. 5; 
  1786.  
  1787. the verb is TALK TO - we have a match
  1788.  
  1789. IFOBJ 5; 
  1790.  
  1791. the object is the BEARDED MAN/BARTENDER - we still have a match
  1792.  
  1793. IFOF 1=0; 
  1794.  
  1795. Hello, what's this? It's a test of an object flag, a concept we have
  1796. not discussed earlier. Object flags are variables attached to each
  1797. object. There are six flags for each object, and each can have any
  1798. numerical, integer value. By assigning values to flags and testing
  1799. them, you can keep track of everything that has happened to an
  1800. object - it's up to you to decide what to use the flags for. In this
  1801. case, I have decided to use flag 1 for the bartender to see if this
  1802. is the first time ever we talk to him. All flags are initially 0, so
  1803. this test - IFOF 1=0 - is true in our case. Before the dialogue is
  1804. ended, the flag values will be set to 1 to indicate that next time
  1805. around, we should resume the conversation in a slightly different
  1806. manner.
  1807.  
  1808. OK, on with it:
  1809.  
  1810. MOBJ; 
  1811.  
  1812. We move up to the bartender just like we move up to any object
  1813. before manipulating it.
  1814.  
  1815. SAY Hello; 
  1816. Say "Hello".
  1817.  
  1818. RESP R,1,Hello, yourself.; 
  1819.  
  1820. This is the bartender's response. "1" means GRAAL will look up the
  1821. statement DLG: 1;... in the graal.main file to find out how the
  1822. bartender behaves when talking. "R" means the default bartender
  1823. animation will resume as soon as the talking is over.
  1824.  
  1825. So far, all statements have been performed with the game still in
  1826. the "normal" mode. Now comes the command which switches to dialogue
  1827. mode:
  1828.  
  1829. DSET 1,+3,+7,+9,+11; 
  1830.  
  1831. This command engages us in dialogue number one and tells GRAAL to
  1832. add the four dialogue alternatives 3, 7, 9, and 11 to the list of
  1833. possible lines for Olaf to speak. Since this is the first DSET
  1834. statement ever to be performed for dialogue one, they will be the
  1835. ONLY four alternatives.
  1836.  
  1837. EXIT
  1838.  
  1839. exits the parsing of the TALK TO command, and leaves us to get on
  1840. with the dialogue - the player now has to select a dialogue line
  1841. from the dialogue area which has replaced the normal control area.
  1842.  
  1843.  
  1844. Hmm. Dialogue lines 3,7,9, and 11. What are they? All the lines are
  1845. defined by LINE statements in the 1.room file. Let us take line 3 as
  1846. an example:
  1847.  
  1848. LINE: 1;3;What is this place?;Where did you say I was?; 
  1849.  
  1850. 1;3; 
  1851.  
  1852. means this is line 3 of dialogue 1
  1853.  
  1854. What is this place?; 
  1855.  
  1856. This is the line appearing in the dialogue command area (where the
  1857. player can choose a line to say) when the alternative is previously
  1858. unused.
  1859.  
  1860. Where did you say I was?; 
  1861.  
  1862. is the version that will appear if the alternative is "re-used". If
  1863. this second version is specified as a blank space only, the first
  1864. version of the sentence will always be used.
  1865.  
  1866. "one blank space"
  1867.  
  1868. The last semi-colon is followed by one, very important blank space, 
  1869. which tells GRAAL there are no conditions attached to this dialogue
  1870. line.
  1871.  
  1872. To explain the concept of dialogue conditions, let's look at another
  1873. of the initially added lines, line 7. The definition of that LINE
  1874. goes:
  1875.  
  1876. 1;7;Do you know anything about the ship in the harbour?; ;IFOF 2=1
  1877.  
  1878. First of all, notice there is no second version of this line. The
  1879. question will always look the same, regardless of how many times
  1880. Olaf puts it to the poor bartender.
  1881.  
  1882. Here, there is an additional condition that determines whether this
  1883. dialogue alternative is available to Olaf or not. Object flag 2 for
  1884. the bartender must be set to 1, otherwise the line will not appear
  1885. in the dialogue command area, no matter how many "DSET 1,+7"
  1886. commands are issued. However, once a DSET 1,+7 command has been
  1887. given, line 7 becomes a possible line: GRAAL will check object flag
  1888. 2 for the bartender each time the dialogue is re-engaged or
  1889. refreshed, and as soon as flag 2 becomes 1, the line will appear and
  1890. become available for Olaf to speak.
  1891.  
  1892. If you look through the lines, you will notice that only lines 3 and
  1893. 11 are unconditional. This means that if the first thing Olaf does
  1894. is engage in conversation with the bartender, only those two
  1895. alternatives will be visible. So what the player now sees in the
  1896. command area is:
  1897.  
  1898. What is this place?
  1899. My head hurts.
  1900.  
  1901. However, if he (which is unlikely) trundles off to the harbour to
  1902. look at the ship, and only then returns to talk to the bartender, 
  1903. line 7
  1904.  
  1905. Do you know anything about the ship in the harbour?
  1906.  
  1907. is also available.
  1908.  
  1909.  
  1910. OK, back to our poor player, currently facing the task of choosing a
  1911. sentence to speak.
  1912.  
  1913. When the player clicks one of the alternatives, the corresponding
  1914. line number is sent back to GRAAL. Let's assume the player clicks on
  1915.  
  1916. My head hurts.
  1917.  
  1918. This means the number "11" is returned. GRAAL now starts to search
  1919. for LACT statements starting with 1;11; - there had better be one, 
  1920. or nothing will happen! Fortunately, there is:
  1921.  
  1922. LACT: 1;11;RESP R,1,That's probably because...;DSET 1,N11
  1923.  
  1924. This is a typical example of a simple response to a dialogue line.
  1925. The bartender speaks, and then another DSET command is given.
  1926. Because we already are in dialogue mode, this command only
  1927. "refreshes" the dialogue - that is, makes alterations to the current
  1928. set of valid alternatives. In this case, the adjustment is to take
  1929. away line 11 and tell GRAAL that it should never been shown again.
  1930. That's what "N11" means.
  1931.  
  1932. Assuming Olaf hasn't been out exploring the town yet, he is now left with
  1933. only one alternative - the line
  1934.  
  1935. What is this place?
  1936.  
  1937. The response to this one is a bit more substantial. The bartender
  1938. makes a long response - so long, in fact, that is does not fit into
  1939. one LACT statement with ease. Instead, there are two statements, 
  1940. performed in sequence. When using this technique, remember NOT to
  1941. put an EXIT or DSET command at the end of the first statement, 
  1942. because that would interrupt the process and prohibit the second
  1943. statement from being executed!
  1944.  
  1945. In the process, the bartender - if he is still named "bearded man" -
  1946. reveals his identity. Therefore, there is a
  1947.  
  1948. NAME bartender; 
  1949.  
  1950. command, renaming object 5 "bartender" if it has not been done
  1951. already.
  1952.  
  1953. The response ends with DSET 1,+1,+2,+5. This means that three more
  1954. possible alternatives will be added to the set of lines available to
  1955. Olaf, all of which are unconditional. The current alternative - line
  1956. 3 - also remains, but now appears in its alternative form "Where did
  1957. you say I was?". This makes the conversation a bit more believable, 
  1958. since you usually rephrase your questions when you feel you need to
  1959. repeat them.
  1960.  
  1961. One of the added alternatives, line 1, is an "end-of-conversation"
  1962. alternative. When Olaf says "Thank you very much", the bartender
  1963. answers "Don't mention it.". Then, 
  1964.  
  1965. EDLG;EXIT
  1966.  
  1967. is performed, which switches the game back to normal input mode. As
  1968. you se in the LACT statement, object flag 1 for the bartender is set
  1969. to 1 to indicate that if we TALK TO the bartender again, it is a
  1970. resumed conversation - the initial "hellos" will be expressed a bit
  1971. differently.
  1972.  
  1973. See the on-line reference for information about the SETOF command.
  1974. We can use the simple form of the SETOF statement to set the
  1975. bartender flag because all throughout a dialogue, OBJ1 points to the
  1976. object we talk to. OBJ1 is normally the first object pointed to by a
  1977. command sentence. In other words, after we specify
  1978. TALK TO BARTENDER, OBJ1 remains pointing to the bartender until we
  1979. resume normal input mode again.
  1980.  
  1981.  
  1982. This concludes the basic tour of the features available in GRAAL
  1983. 1.0, but stay tuned: Below are a lot of hints and tips about how to
  1984. use the power and special techniques of GRAAL to their full
  1985. potential.
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992. 11 MASTER CLASS: CHARACTER AND GRAPHICS DESIGN
  1993. ==============================================
  1994.  
  1995. Well, fellow adventurer, by now you are a proficient GRAAL user.
  1996. I hope. Anyway, welcome to the first master class, where we will
  1997. look at some of the central GRAAL concept a bit more closely.
  1998.  
  1999. This chapter deals with designing your main character and planning
  2000. your graphics, something that must be done with some thought and
  2001. consideration - although small adjustments are easy to make at any
  2002. stage during the game development, things like the character size
  2003. influence every other piece of graphics you create, so beware!
  2004.  
  2005.  
  2006. 11.1 SIZE
  2007. ---------
  2008.  
  2009. Get a suitable character size, keeping the backgrounds in mind -
  2010. they are 120 pixels high, and in lowres, so you must use lowres when
  2011. designing too - otherwise your hero will look rather fat on the
  2012. screen! I should think a character between 40 and 60 pixels high
  2013. would be about right. Below 40 and there is not much room for detail
  2014. at all, more than 60 and the scenes start to feel cramped because
  2015. the character takes up too much space. Also, bigger graphics takes
  2016. more processing power.
  2017.     
  2018. In addition, the more pixels you have to animate, the more chances
  2019. you have of making a bad job of it! Really, I am not kidding. Small
  2020. can be beautiful sometimes.
  2021.  
  2022. Naturally, how you want the backdrops to relate to the main
  2023. character is also a factor - is he a small guy in a big, cruel
  2024. world, or an ace detective always moving around in cramped Victorian
  2025. tunnels and Baker Street studies?
  2026.  
  2027.  
  2028. 11.2 COLOUR
  2029. -----------
  2030.  
  2031. Use only some of the available colours for your character, and make
  2032. it a good spread of useful colours, because these colours will have
  2033. to be the same in all scenes!
  2034.  
  2035. Colours not used for portrayal of the main character, or frequently
  2036. occurring objects, can change according to the current scene - the
  2037. more colours you have left to play with, the more variation you can
  2038. bring to the backdrops.
  2039.  
  2040. Note: The first three colours more or less have to be as follows:
  2041. Colour 0 should always be used ONLY for transparent areas in BOB
  2042. images. Colour 1 SHOULD be a rather bright white, colour 2 MUST be
  2043. black!!
  2044.  
  2045. Here's a tip: When working with a background or clip-art picture in
  2046. a paint program, set colour 0 to something strange to distinguish it
  2047. from "usable" colours, but always set it back to black before
  2048. saving, or the borders around the adventure scenes when running the
  2049. adventure may become coloured in ways that we don't want! If you
  2050. don't follow this advice, you surely will make the mistake of using
  2051. colour 0 as the black colour in spots of the graphics, whereas it
  2052. will be transparent when used in the game - and vice versa!
  2053.  
  2054. Despite the fact that you should only use some colours for the
  2055. character, always create the graphics with a 32-colour palette (=5
  2056. bitplanes).
  2057.  
  2058.  
  2059. 11.3 DESIGNING ANIMATIONS
  2060. -------------------------
  2061.  
  2062. The following poses must be designed for the main character:
  2063.  
  2064. * The stills to use for front, back and "sideways facing left"
  2065.   still poses.
  2066.  
  2067. * The animations for walking towards, away, and sideways right to
  2068.   left.
  2069.  
  2070. * The animations for talking corresponding to the front, back and
  2071.   side stills. (Open and close the mouth in different ways, move
  2072.   the head slightly, etc.)
  2073.  
  2074. * The animations or stills used for handling objects (picking up, 
  2075.   handing over, etc.), also corresponding to the three "main
  2076.   stills" previously mentioned, but in three different heights for
  2077.   each still - High, Middle and Low, depending on whether the
  2078.   object is located on the floor, high up or on a table or
  2079.   something else in "mid air".
  2080.  
  2081. The reason you don't have to make separate animations and images for
  2082. right and left is that you can mirror one image to point in the
  2083. other direction using a simple trick described further on. This
  2084. saves memory as well as time spent in paint programs!
  2085.  
  2086. To get the animation smooth, it should be designed to work with
  2087. frame updating taking place every 6th vertical blank. This may sound
  2088. like nonsense to you, but what it means is that you can switch the
  2089. animation cel every six 50ths of a second, which equals six frames
  2090. displayed on a PAL TV system (or 60ths of a second on an NTSC
  2091. system).
  2092.  
  2093. Actually, too many animation cels for a certain movement may not
  2094. necessarily add that much to the game anyway. Olaf uses only 5 cels
  2095. for a basic walking movement, each cel being shown for 6 50ths of a
  2096. second.
  2097.  
  2098. So, now you should have you basic animations designed. Good. First, 
  2099. test them against some different backdrops that you think will be
  2100. representative for the game in your excellent paint program.
  2101.  
  2102. Then, satisfied that your character basically looks OK, you should
  2103. now design a "dummy room" in GRAAL, place some "dummy objects" in
  2104. that room that will force your character to use all his newly
  2105. learned physical skills. Then, give him a good work-out.
  2106.  
  2107.  
  2108. 11.4 ALL ABOUT 3D AND HOTSPOTS
  2109. ------------------------------
  2110.  
  2111. GRAAL rooms are usually displayed in a "simulated 3D" perspective
  2112. (although top-down views can be achieved). This basically means
  2113. that the things slightly higher up the picture seem "further away"
  2114. than the tings towards the lower end of the picture. Take the
  2115. harbour in "Olaf" as an example: When Olaf walks towards the water
  2116. and the edge of the quay, he's actually only moving a number of
  2117. pixels up the screen - there is no such thing as "away", because the
  2118. screen can never really be anything but 2D.
  2119.  
  2120. This simple fact allows us to play with foreground and background
  2121. objects. Anything placed towards the bottom of the screen will, generally
  2122. speaking, be "in front". I'm talking about objects as well as STATIC: and
  2123. ANIM: images now, mind you - everything drawn directly onto the
  2124. background picture will naturally always be part of the background!
  2125.  
  2126. So, as a rule anything lower down goes "in front" of anything further up, 
  2127. but that's not necessarily the way we want people to perceive things -
  2128. take the mug on top of the barrel in the bar, for instance. Looking only
  2129. at the placement of the images of the mug and the barrel, the mug should
  2130. logically be partly hidden by the barrel, because it is further up the
  2131. picture. It's not. Instead, it looks like it is placed ON the barrel, 
  2132. which is what we want. Also, when Olaf walks behind the barrel, he must
  2133. also walk behind the mug - if the mug is on the barrel but Olaf seems
  2134. to be walking in front of the mug but behind the barrel, everything
  2135. becomes hideously unrealistic.
  2136.  
  2137. The answer to this problem? It's simply a matter of setting each image's
  2138. hotspot correctly. The hotspot is the point of each image that tells
  2139. which point of the image will actually be placed at the x and y
  2140. coordinate specified for an object.
  2141.  
  2142. Each image has its own hotspot, and it is normally set when the image is
  2143. loaded with a ...BOBS: statement (the last parameter - look it up in the
  2144. reference). The GRAAL default is to place the hotspot at the middle of
  2145. the bottom edge of the image - you might say at the "foot" of the image.
  2146. This is normally very appropriate, especially so for people and living
  2147. objects. But you can place the hotspot anywhere you like - if you specify a
  2148. value other than the default, the hotspot will be offset in the y direction
  2149. that number of pixels from the top edge of the image. Both negative and
  2150. positive values are allowed.
  2151.  
  2152. Study the ROOMBOBS: statement for the mug image in room one, compare that
  2153. to the mug's x and y position in the OBJECT: statement in graal.main, and
  2154. you will see that the hotspot is placed well below the actual image, making
  2155. it the "frontmost" object in the bar.
  2156.  
  2157. The hotspot of an image can also be altered using the HOTSP command -
  2158. this is used in some cutscenes dealing with the ship in the harbour, 
  2159. to switch the depth-placing of the sail. This is because the captain
  2160. first walks behind the sail, but when summoned ashore, he suddenly has
  2161. to go in front of it! The solution? Just alter the sail's hotspot...!
  2162.  
  2163.  
  2164.  
  2165.  
  2166. 12 MASTER CLASS: CUTSCENES
  2167. ==========================
  2168.  
  2169.  
  2170. CUTSCENES are simply script files (suffixed with .scene) that contain
  2171. nothing but commands. That's right - no conditions, and no statements!
  2172. This means lines should NOT start with ACTION: or anything like that -
  2173. just fire away with the command name in column one of each line!
  2174.  
  2175. The immense usefulness of cutscenes may not be apparent at first, 
  2176. but you will soon find out that you use quite a lot of them -
  2177. because in addition to being used for "movie scenes", they are also
  2178. very handy whenever you have a sequence of GRAAL commands that you
  2179. need to use in a lot of different places. In these cases, cutscenes
  2180. can act the way procedures or subroutines do in ordinary programming
  2181. languages. In those cases, you must make sure all of the cutscene is
  2182. executed, and you probably don't want to show the cutscene indicator
  2183. to the player. It's easy enough - just read on!
  2184.  
  2185. The logic of cutscenes ought to be a fairly simple subject, since
  2186. there are no conditions allowed in them! In practice, two things
  2187. require you to think very carefully about designing your cutscenes:
  2188. The "skip" function (pressing the <Esc> key to jump past a cutscene)
  2189. and nested cutscenes.
  2190.  
  2191.  
  2192. 12.1 HOP, SKIP AND JUMP
  2193. -----------------------
  2194.  
  2195. Normally, a cutscene consists of two parts: The main part at the
  2196. top, always containing ALL the actions in the scene, and the FINAL
  2197. section at the end.
  2198.  
  2199. The FINAL section is ONLY used if the <Esc> key was pressed during
  2200. execution of the main part. It must duplicate all statements
  2201. necessary to set the scene exactly the same way it would have been
  2202. set if the main part had been run through completely. Remember, you
  2203. never know exactly where in the flow of the main part the player
  2204. decides to press <Esc> and breaks out of the action!
  2205.  
  2206.  
  2207. 12.2 NO BREAKS!
  2208. ---------------
  2209.  
  2210. In some circumstances, for example when you use cutscenes as
  2211. "subroutines" as discussed above, you may not want the skip option
  2212. to be in effect. In this case, start the entire cutscene with the
  2213. cutscene statement NOBREAK, which disables the <Esc> key for the
  2214. duration of the cutscene. If a cutscene starts with NOBREAK, you
  2215. don't need a FINAL section in it.
  2216.  
  2217.  
  2218. 12.3 NESTING
  2219. ------------
  2220.  
  2221. Now, to complicate things even further, cutscenes may be nested in
  2222. up to three levels - that is, you can execute a cutscene within a
  2223. cutscene from within a cutscene!
  2224.  
  2225. "Why on earth would I want to do that?" you ask. Well, a good
  2226. example is the harbour scene in room 3 of "Olaf". There are a number
  2227. of occasions when Olaf needs to interact with the captain, calling
  2228. him ashore time and time again. The captain's going ashore and
  2229. aboard can not be handled as simple PTRN sequences, because he, the
  2230. ship itself, and the sail need to be rearranged in various ways to
  2231. make the captain go behind the sail, in front of the sail but behind
  2232. the gangplank, etc.
  2233.  
  2234. Therefore, the captain going ashore is played using one cutscene, 
  2235. the going aboard in another (well, actually two, depending on
  2236. whether his hat is secured with the rubber band or not). These
  2237. cutscenes are then used from within, or in conjunction with, a
  2238. number of others specifying what is going on when the captain comes
  2239. ashore to talk to Olaf.
  2240.  
  2241. Let us call the first cutscene the "master scene" and those called
  2242. from within that "sub-scenes". Now, what we have to watch out for is
  2243. this:
  2244.  
  2245. If we press <Esc> at the very beginning of the master scene, or
  2246. indeed anywhere before the last sub-scene, this means some of the
  2247. sub-scenes will not come into play at all. However, the contents in
  2248. each sub-scene may affect how the game should be set up at the end
  2249. of the master scene.
  2250.  
  2251. To conclusion is that the FINAL section of the master scene also
  2252. must include all statements that are present in the FINAL sections
  2253. of the relevant sub-scenes. Let's look at Olaf and the captain
  2254. again, when Olaf tries to use the dictionary on the captain and gets
  2255. it all wrong. This is depicted in CUTSCENE 13 structured like this:
  2256.  
  2257. 1. First, CUTSCENE 2 is called as a sub-scene to make the captain
  2258.    come ashore.
  2259.  
  2260.    Note: Sub-scenes should always be called with parameter ,F to
  2261.    stop the cutscene indicator symbol flickering on the screen. The
  2262.    master scene should be called with parameter ,S because when
  2263.    it's finished, the whole scene is finished.
  2264.  
  2265. 2. Then, Olaf tries to speak hindi or something like that, and gets
  2266.    punched out.
  2267.  
  2268. 3. While Olaf is still on the ground recovering, CUTSCENE 3 is
  2269.    invoked to put the captain back aboard the ship.
  2270.  
  2271. 4. Once the captain is back aboard, Olaf gets up and notes that the
  2272.    whole endeavour wasn't particularly successful.
  2273.  
  2274. 5. The FINAL section of the master scene CUTSCENE 13 then needs to
  2275.    contain the following: The commands from the FINAL section of
  2276.    CUTSCENE 3, because those make sure the captain is back in place
  2277.    aboard the ship, and some commands to put Olaf back on his feet
  2278.    in the right position. We do NOT have to bother about anything
  2279.    in CUTSCENE 2, because the captain's coming ashore does not have
  2280.    anything to do with how things look after the master scene is
  2281.    finished.
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289. 13 MASTER CLASS: SPECIAL TECHNIQUES OR
  2290. "HOW THE HECK DID HE DO THAT?"
  2291. =======================================
  2292.  
  2293.  
  2294. This is a walk-through of some of the particularly clever stuff in
  2295. the Olaf script files. I hope it goes to prove that I have tried not
  2296. only to solve specific "Olaf" problems when writing GRAAL, but
  2297. provided a set of commands that are flexible enough to allow even the
  2298. nearly impossible to be done without an endless array of novelty gadgets
  2299. of limited use.
  2300.  
  2301.  
  2302. 13.1 SPEAKING IN A FOREIGN TONGUE
  2303. ---------------------------------
  2304.  
  2305. The conversation with Rajah Singh on the quay is rather special -
  2306. you are forgiven for thinking a special font is being used to
  2307. display the foreign language of Rajah. However, this is not the
  2308. case. Instead, I have combined a "blank" RESP command with BOBON and
  2309. BOBOFF commands. Have a look in the 3.room file:
  2310.  
  2311. First, the "foreign language" was "written" in an ordinary picture
  2312. (3FG.IFF) using DPAINT.
  2313.  
  2314. Then, the "words" were grabbed as RBOBs using ROOMBOB statements.
  2315.  
  2316. Rajah's responses to Olaf dialogue lines are as follows:
  2317.  
  2318. First, a BOBON command is used to display the RBOB with the "foreign
  2319. language".
  2320.  
  2321. Immediately upon that, a RESP command displaying nothing but blank
  2322. spaces is used to make Rajah Singh "speak".
  2323.  
  2324. After that, a BOBOFF takes away the strange text again. Simple, eh?
  2325. No need to construct an entire font (and no need for another GRAAL
  2326. command to handle that font!).
  2327.  
  2328.  
  2329. 13.2 AN AUTOMATED ROOM
  2330. ----------------------
  2331.  
  2332. As you may have noticed, you can never get into normal game mode in
  2333. Ali Harrod's shop - As soon as you walk in, you end up in dialogue
  2334. mode, and when you end the dialogue, you are immediately transported
  2335. out of the boutique. This is thanks to the DACT statements, where
  2336. the programmer can grab control and keep it for as long as he likes!
  2337. Have a look in 4.room - there is not a single run-through of DACT
  2338. statements that does not end with a DSET... EXIT combination, 
  2339. forcing the player into dialogue mode. Therefore, there are no ACTION:
  2340. statements either.
  2341.  
  2342. This technique is useful in a lot of circumstances - many times, it
  2343. relieves you of having to think out a lot of elaborate ideas for a
  2344. room where you really don't want the player prowling around.
  2345.  
  2346.  
  2347. 13.3 THE ART OF AVOIDING A SEAGULL
  2348. ----------------------------------
  2349.  
  2350. As long as the seagull in the harbour is sitting on the pollard, 
  2351. Olaf steers well clear of it when walking about. He simply walks
  2352. where the room file FLOOR: statements say he can move!
  2353.  
  2354. However, as soon as the seagull is scared off, Olaf is free to
  2355. approach the pollard and pick up the feather. This is made possible
  2356. by two FLOOR and one NFLOOR command executed in the cutscene where
  2357. the seagull takes off (4.scene).
  2358.  
  2359. Having chased the seagull away, one problem remains: The next time
  2360. we re-enter the room, we want things to be the way they are now, and
  2361. not according to how they are set up in the room file statements.
  2362.  
  2363. A room flag comes to the rescue here - it allows us to "remember"
  2364. the seagull status between visits to the room.
  2365.  
  2366. Room flag 1 for the room (room 3) is used - as long as it is zero
  2367. (the initial state), the seagull is on the pollard. As soon as the
  2368. bird is scared off, we set the flag to 1 with a SETRF 1=1 command in
  2369. the cutscene. This room flag is tested in a DACT: statement - if it
  2370. is set to 1, the bird is moved to the roof of the shed, and the default
  2371. floor definitions are changed exactly the same way as in cutscene 4.
  2372.  
  2373. Remember, as long as the LIGHTS ON command has not been used, the scene
  2374. remains black and we can move anything we want around without the player
  2375. being aware of what is done!
  2376.  
  2377.  
  2378. 13.4 A SPITTING IMAGE
  2379. ---------------------
  2380.  
  2381. The spitting llama on offer by Ali Harrod is composed of two
  2382. animations, because I decided a single one would be too large.
  2383. Instead, the llama itself is one animation, and the "spit" is
  2384. another, very small one, animated by an AMAL "Move" command.
  2385.  
  2386. The movement of the llama and spit animations are synchronised - the
  2387. llama being displayed on top of the spit. (Well, almost synchronised.
  2388. If you leave the llama sequence on and walk away for a quarter of an
  2389. hour, you will notice that things have become a little strange when
  2390. you return. But who could keep away from the game that long, anyway?
  2391. And if you don't like it, you can always make one big animation of
  2392. the whole thing!)
  2393.  
  2394.  
  2395. 13.5 A MAP ROOM
  2396. ---------------
  2397.  
  2398. I had planned on only delivering the first four rooms with GRAAL, 
  2399. but ended up giving you seven. The reason is some quite interesting
  2400. techniques were used in rooms 5 and 7, which may come in handy.
  2401.  
  2402. Room 5 is an outline map of the East, showing the towns of
  2403. Constantinople, Gurgan and Baghdad. The thing is, there is no Olaf, 
  2404. and nothing to do except watch a short cutscene and, when
  2405. revisiting, point to one of the three towns.
  2406.  
  2407. Olaf was done away with by a simple CHAR OFF command in a DACT
  2408. statement - nothing strange about that (once you read the on-line
  2409. reference). Remember that the main character will always be made
  2410. visible when entering a new room, unless you put it away again with
  2411. CHAR OFF.
  2412.  
  2413. There are no objects in the room, and although you can try to
  2414. manipulate the objects in the inventory, whatever happens will not
  2415. get through to you, because Olaf is not there to tell you about it.
  2416. However, three small exits placed just over the towns on the map
  2417. provide three ways to get on with the game.
  2418.  
  2419. I have chosen to display the exit names the normal way, although I
  2420. might just as well have put a blank space instead of names in the
  2421. EXIT statements - the names of the towns are written on the map, and
  2422. it shouldn't have taken the player too long to figure out where to
  2423. click, anyway.
  2424.  
  2425.  
  2426. 13.6 A SMALL GUY
  2427. ----------------
  2428.  
  2429. Character scaling is not well supported in GRAAL at the moment, but
  2430. thanks to the system's flexibility, you can (partially) ignore that!
  2431. To prove it, I have made a big Baghdad panorama in room 7, requiring
  2432. Olaf to be shown at half the normal size.
  2433.  
  2434. Tough job? Not very. The secret is the BOBS command, which can be
  2435. used to switch the global BOB images to a new size. I simply took
  2436. the Olaf_Original.IFF picture containing the standard animations for
  2437. Olaf, halved its size, and re-saved it under a different name. When
  2438. Olaf arrives at Baghdad, all graphics are replaced using BOBS
  2439. commands and the new picture CLPART file. In addition, for this
  2440. sunset scene I also altered the colour scheme for the Olaf images
  2441. slightly. It blends better with the background picture that way.
  2442.  
  2443. There is one problem here which you must be aware of:
  2444. Loading saved games does not automatically restore global BOB images.
  2445.  
  2446. So, if you are in Baghdad (Olaf small) and load a saved game placing
  2447. him in, for example, room 2, he will still be small. Or would be, if
  2448. we did not do anything about it.
  2449.  
  2450. Well, this is not too difficult to take care of. In fact, in GRAAL 2
  2451. there is a new function making it even easier than it used to be.
  2452.  
  2453. Each time GRAAL loads a stored position (or executes the RESUME command, 
  2454. which is, in effect, a "load from RAM:"), it immediately looks for
  2455. ACTION: statements containing the special "verb" -2.
  2456.  
  2457. This means that all we need is an ACTION: -2;... statement in the
  2458. graal.main file being able to determine whether the global BOBs should
  2459. be reloaded or not.
  2460.  
  2461. To achieve this, and keep track of Olaf's looks, I used a room flag
  2462. belonging to room 0. Room 0 is a "dummy" room which is never used in
  2463. a game, so there are actually 20 excellent "global" room flags
  2464. there, which can be used to keep track of "global game states".
  2465.  
  2466. So, if room flag 1 for room 0 is 1, (i.e. IFRF 0,1=1), Olaf needs a
  2467. change of clothes. The change is taken care of by some BOBS
  2468. statements in a cutscene file, restoring the original BOB images.
  2469. And that's that.
  2470.  
  2471. Like this:
  2472.  
  2473. ACTION: -2;IFRF 0,1=1;CUTSCENE 17,H
  2474.  
  2475. and the contents of 17.scene is simply:
  2476.  
  2477. /* The correct graphics file
  2478. CLPART Olaf_Original.iff
  2479. /* Some BOBS commands to load the images
  2480. BOBS 10;11;...
  2481.  
  2482.  
  2483. ...you get the picture. (And so does GRAAL.)
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489. 14 MASTER CLASS: HINTS AND TIPS
  2490. ===============================
  2491.  
  2492. Here are some general hints and tips that may prove useful.
  2493.  
  2494.  
  2495. 14.1 FLAGS
  2496. ----------
  2497.  
  2498. * Avoid setting flags in cutscenes, if you have a choice. It's hard to
  2499.   keep track of the games' status in the main script files if the
  2500.   setting of flags is "hidden from sight" in the cutscenes. (And
  2501.   forget I mentioned I've done just the opposite in a few places. Do
  2502.   as I say, not as I do! :-)
  2503.  
  2504. * Since all variables have the initial value 0, it is good practice to
  2505.   let that value represent the initial state of the object, room, 
  2506.   situation, etc.
  2507.  
  2508. * Use room flags for all things that relate to the scene as a whole, 
  2509.   rather than the flags of a particular object.
  2510.  
  2511. * Remember that ALL aspects of room objects and section objects get reset
  2512.   as soon as you leave the room or section. You can compensate for this
  2513.   using room flags to track room object states, and then set the objects
  2514.   up in whatever way they should be by using DACT statements.
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.  
  2521. 15 QUESTIONS AND ANSWERS
  2522. ========================
  2523.  
  2524.  
  2525. Q: Anything I should think about when assigning BOB numbers to
  2526.    objects?
  2527.  
  2528. A: Use numbers below 60. Make sure a BOB number is never used for
  2529.    more than one thing at a time in the same room. Otherwise, no: No
  2530.    information is connected to or "belongs to" BOB numbers and their
  2531.    use, so there are no other fixed rules.
  2532.  
  2533.  
  2534. Q: What about animation channels then?
  2535.  
  2536. A: Same thing. Look up the reserved channel numbers in the on-line
  2537.    reference, and make sure you never try to use the same channel for
  2538.    two things in the same room!
  2539.  
  2540.  
  2541. Q: What are the rules for room object use?
  2542.  
  2543. A: A room object can only exist in one room - therefore, it can
  2544.    never be picked up or added to the inventory. Nor may you use its
  2545.    object flags for very much, because they will be reset each time you
  2546.    exit the room.
  2547.  
  2548.    ROBJ references should only exist in .room files, never in .sect or
  2549.    graal.main!
  2550.  
  2551.  
  2552. Q: What are the rules for section object use?
  2553.  
  2554. A: A section object only exists within one section, and preferably
  2555.    disappears totally during the first visit to the section -
  2556.    otherwise, you must keep track of how the objects have been handled
  2557.    via room flags or such devices, if you happen to re-enter the
  2558.    section.
  2559.  
  2560.    In other words, take particular care if your adventure is designed
  2561.    in such a way that you can go back to, for example, section 1 from
  2562.    section 2 - not only must you be sure that section 1 still looks
  2563.    okay with respect to section object use, but also, the section 2
  2564.    section objects will suffer the same problems! Even if you haven't
  2565.    "solved" section 2 yet completely, going back to section 1 will end
  2566.    your first visit to section 2 and thus reset your section objects for
  2567.    section 2!!
  2568.  
  2569.    SOBJ references should only be used in .room and .sect files, not in
  2570.    the .main file.
  2571.  
  2572.  
  2573. Q: I need some very precise movement paths for my character in some
  2574.    situations, and the floor system is not quite up to the job.
  2575.  
  2576. A: There are a couple of ways.
  2577.  
  2578.    A) Try the PATH: statements (new to GRAAL 2). These allow you to
  2579.    connect otherwise unconnected floors using "twisting" paths. Read more
  2580.    in the room PATHS: statement in the on-line reference.
  2581.  
  2582.    B) Use an un-named exit! When you specify an EXIT: with no
  2583.    description, GRAAL shows no exit name in the scene area, nor does it put
  2584.    a "Go to ..." message in the sentence box when the exit is clicked. That
  2585.    way the un-named exit is just a "clickable area" in the scene area, and
  2586.    you can use ACTION: 0;... statements for it to do anything you like.
  2587.  
  2588.  
  2589.    1. Put an un-named exit over the destination on the screen your character
  2590.       should reach using a special movement or animation.
  2591.  
  2592.    2. In the ACTION: statements, use whatever commands you need to transport
  2593.       the character to the destination point: Perhaps first an ordinary
  2594.       CMOVE to the closest edge of the actual floors, and then OMOVE 0...
  2595.       to make the final part (up the ladder, down the hole, or whatever).
  2596.  
  2597.    Note: Remember, if you move the character outside the normal floor area, 
  2598.    you are in a bit of trouble if he must also be able to return: If
  2599.    you click outside your unnamed exit, the normal floor system will try to
  2600.    move the character the normal way, and if it is no longer in any floor
  2601.    area... well, problems arise. They can be dealt with, though, using some
  2602.    careful planning. The easiest way is to make sure the player does not get
  2603.    the opportunity of clicking anywhere before the character is safely back
  2604.    on a legal floor again! Some clever use of a number of un-named exits
  2605.    together with SHOW EXIT and HIDE EXIT commands may do the trick.
  2606.  
  2607.  
  2608. Q: I have the need for menu-style pictures with multiple user options.
  2609.  
  2610. A: Yes, why not indeed? Just use EXIT: statements with no name/description
  2611.    to define the clickable areas needed on screen, and then ACTION: 0;...
  2612.    statements to handle the player input. Or, define room objects that are
  2613.    actually buttons.
  2614.  
  2615.  
  2616. Q: I want a way to show the player's score at any time!
  2617.  
  2618. A: In GRAAL 2, the neatest way is probably to put a "SCORE" button in the
  2619.    command area using the VERB_ZONE: and VERB_TEXT: statements in the
  2620.    graal.main file. VERB_TEXT: allows you to define "direct verbs", that is, 
  2621.    commands that do not wait for or use an object. If you define a verb
  2622.    "SCORE" and make that a direct verb, you can then use a TEXT command
  2623.    to display the score held in a flag (preferably a room flag for room 0
  2624.    - as mentioned elsewhere, these make excellent "global flags").
  2625.  
  2626.  
  2627. Q: I want an object / person to follow my character around.
  2628.  
  2629. A: There is no direct support for this in GRAAL. However, if you plan
  2630.    the thing carefully, you may be able to use one of the timers (see the
  2631.    documentation of the DOAFTER command), and the "character offset"
  2632.    abilities of the OMOVE command to move things relative to the main
  2633.    character independently of the player input. Just keep in mind that
  2634.    only the main character makes use of the floors and paths defined...
  2635.  
  2636.  
  2637. Q: I want to do some advanced arithmetics, using the contents of one
  2638.    variable to alter another and so on.
  2639.  
  2640. A: Yes, OK, OK. You can do a lot more stuff with flags, values, and
  2641.    comparisons in GRAAL 2 than was possible in GRAAL 1. Still, be very
  2642.    careful when using this freedom. Too much random number-juggling
  2643.    in flags have a tendency to make the number of possible alternatives
  2644.    so large that the game becomes difficult to test, and needs a lot
  2645.    of ACTION: statements to cover all possibilities.
  2646.  
  2647.  
  2648. Q: I don't quite understand the FLOOR: statements.
  2649.  
  2650. A: The best description is in graal.guide. Make sure you read ALL the
  2651.    information about FLOOR: there - it's even got some diagrams! Then
  2652.    look at one of the rooms in the demo adventure to put theory to practice.
  2653.  
  2654.  
  2655. Q: I'm trying to run the GRAAL editor and GRAAL in parallel, but changes
  2656.    I make to the scripts in the editor do not seem to take effect, even
  2657.    though I'm sure I have saved them to disk.
  2658.  
  2659. A: 1. You must exit the room / situation where updates were made and
  2660.       then re-enter to force a reload of the scripts in question. Alter-
  2661.       natively, use the "Go to" button in the on-line monitor, which
  2662.       also forces a reload.
  2663.  
  2664.    2. You must have MAX_CACHE: 0 in graal.main before starting GRAAL for
  2665.       this. Otherwise, an old copy of the script file still in memory
  2666.       will probably be used instead of your updated version.
  2667.  
  2668.    3. Changes to graal.main NEVER take effect without restarting the game.
  2669.       So there.
  2670.  
  2671.  
  2672. Q: My tunes play in a strange tempo!
  2673.  
  2674. A: GRAAL only supports the "old" soundtracker tempo format of "ticks" -
  2675.    the primary tempo should always be 33, and the secondary can be
  2676.    altered using tracker commands to achieve the desired tempo. (Between
  2677.    5 and 7 is usually good.) Any attempt to use BPM settings instead will
  2678.    get you into trouble for sure.
  2679.  
  2680.  
  2681. Q: After playing a tune with the TRACK command, samples played with the
  2682.    SAM command get caught in a loop!
  2683.  
  2684. A: Naughty you - you have used an undocumented feature of GRAAL! It CAN
  2685.    play med modules (MMD0 and MMD1 formats), provided you have the file
  2686.    extension ".med" in the module name. However, this causes the above bug
  2687.    in the sample routines to appear - this is Amos's fault. I know there
  2688.    exists an Amos bugfix or work-around for this, but I DON'T HAVE IT.
  2689.    If anyone has seen it, mail it pronto, and the med support will be made
  2690.    official!
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.                             SUPPORT TOOLS
  2697.                             =============
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703. A THE ON-LINE MONITOR
  2704. =====================
  2705.  
  2706. GRAAL_2 is equipped with an on-line monitor able to show you the
  2707. values of all flags and states of all objects. Simply press the [G]
  2708. key during testing, and voilà - a screen drops down covering
  2709. everything else.
  2710.  
  2711. The monitor has three sections: Object, Room and Dialogue Control. You
  2712. will use the Object and Room Control most frequently. Let's go through
  2713. it all one step at a time:
  2714.  
  2715.  
  2716. A.1 OBJECT CONTROL
  2717. ------------------
  2718.  
  2719. All current objects - that is, the global objects and the objects for
  2720. the current section and room - are shown in the list. Click on one to
  2721. select it, and information about its location and value for flag 1 is
  2722. shown in the other fields and gadgets.
  2723.  
  2724. To see the values for the other object flags, click on the "Flag"
  2725. cycle gadget. To set a new value for a flag, enter a new value in the
  2726. "Value" fields, and click the "<-Set" button.
  2727.  
  2728. The best way to add objects to the inventory is to select the object
  2729. in the list and the click the "<-Pick" button. This sets the room to
  2730. 999, which is the room used for the inventory.
  2731.  
  2732.  
  2733. A.2 ROOM CONTROL
  2734. ----------------
  2735.  
  2736. When you call the monitor, the Room and Entrance fields show the room
  2737. and entrance numbers used in the last GOTO command.
  2738.  
  2739. To switch to a new room, type the room number in the Room field and
  2740. press [Enter]. Note that you must press [Enter] for the data for the
  2741. desired room to be available in the flag Value field.
  2742.  
  2743. To set a new flag value for a room flag, proceed the same way as with
  2744. object flags.
  2745.  
  2746. One of the best things about the monitor is that it allows you to jump
  2747. instantly to any room and entrance you desire during testing. Simply
  2748. type in the room and entrance numbers, and the press the "<-Goto"
  2749. button. The monitor will disappear and the selected room will be
  2750. loaded.
  2751.  
  2752. If you have set MAX_CACHE to 0, using "<-Goto" is also a very handy
  2753. way of reloading a room script - pressing "<-Goto" without changing
  2754. rooms will still reload the room script, and that will force any
  2755. changes to take effect immediately.
  2756.  
  2757.  
  2758. A.3 DIALOGUE CONTROL
  2759. --------------------
  2760.  
  2761. To be honest, I haven't used this option that much. Basically, it
  2762. allows you to investigate the status of the lines in a dialogue -
  2763. which could be handy at times, because it is the line state that
  2764. determines whether a dialogue line is able to pop up in the set of
  2765. dialogue lines.
  2766.  
  2767.  
  2768. A.4 BACK TO GRAAL
  2769. -----------------
  2770.  
  2771. The "Back to GRAAL" button quits the monitor and returns control to
  2772. the game. If any changes were made to flag values etc. in the monitor, 
  2773. GRAAL will reload the current room. This is because changes may affect
  2774. the way objects and stuff in general are set up in the DACT
  2775. stataements.
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781. B MACROS
  2782. ========
  2783.  
  2784. Macros are new to GRAAL 2.0. They allow you to record a sequence of
  2785. player input selections, store them in a file, and play them back later.
  2786.  
  2787. The primary use is for testing - being able to play the same sequence of
  2788. events back over and over again, and having it done automatically, makes
  2789. testing a whole lot easier. They are especially useful for running
  2790. through parts of the game which are really "finished", but still need
  2791. to be tested from time to time to check that no alterations you have
  2792. made to other parts of the game affects them.
  2793.  
  2794. The macro functions only work in development mode - once the keyfile
  2795. is in place, they are not available.
  2796.  
  2797.  
  2798. B.1 Starting a macro recording
  2799. ------------------------------
  2800.  
  2801. 1. Start the game. Load a saved game, or go to the position from which you
  2802.    want to start the macro recording by playing the game in the normal
  2803.    way.
  2804.  
  2805. 2. Press the [R] key. A message telling you that macro recording is activated
  2806.    is shown very briefly in the scene area.
  2807.  
  2808. 3. From now on, every command you execute, and every exit or dialogue line
  2809.    you choose, will be recorded to memory.
  2810.  
  2811.  
  2812. B.2 Saving a macro
  2813. ------------------
  2814.  
  2815. 1. When you have reached the point where you want the macro to stop, press
  2816.    the [R] key again.
  2817.  
  2818. 2. A dialogue box pops up, asking for a macro file name. The name you type
  2819.    will be suffixed with the text ".macro"
  2820.  
  2821. 3. Click the "Save" button. The macro file is now stored in the development
  2822.    directory.
  2823.  
  2824.  
  2825. B.3 Playing a Macro
  2826. -------------------
  2827.  
  2828. 1. Make sure the game is in EXACTLY THE SAME POSITION as when you started
  2829.    the macro recording. Preferably, you have a saved game position to load
  2830.    to ensure this.
  2831.  
  2832. 2. Press the [P] key. A dialogue box appears, asking for the macro file
  2833.    name. Type the name - you do not have to enter the ".macro" part.
  2834.  
  2835. 3. Click the "Load" button.
  2836.  
  2837. 4. The contents of the macro are now re-played before your very eyes.
  2838.    Sit back, watch, and enjoy!
  2839.  
  2840. 5. You may abort the playing of the macro at any time by pressing the
  2841.    [Esc] key between commands.
  2842.  
  2843.  
  2844. B.4 Restrictions
  2845. ----------------
  2846.  
  2847. The original timing of the player input is not preserved in the macros.
  2848. When a macro is played back, execution of the next command starts as soon
  2849. as the previous is finished. This means macros are not suited for recording
  2850. parts where the timing of player input is critical. In other words, if
  2851. you are using the new GRAAL 2 timer functions, stop to think before you
  2852. record macros - is the timing in the sequence going to affect the result
  2853. of the playback or not?
  2854.  
  2855.  
  2856.  
  2857.  
  2858. C "PRODUCTIFYING" YOUR ADVENTURES
  2859. =================================
  2860.  
  2861. Read the file "prod.text" for an explanation of how to get your adventure
  2862. onto diskettes.
  2863.  
  2864.  
  2865.  
  2866.  
  2867. D THE EDITOR
  2868. ============
  2869.  
  2870. GRAAL sports its very own script editor, called GRAAL_Editor. It is
  2871. documented in the file Editor.text.
  2872.