Unformatted text preview:

Inform Game EngineAlice: Inform Tutorial Part 1 Gareth ReesGetting StartedThrough the Looking GlassGoalSimplest Inform GameNeed at Least One ObjectInitialise Function is RequiredReturn CodesMeaning of Return CodesSlide 11Before and AfterSlide 13Programming TipEvaluation OrderSlide 16Slide 17Simple ObjectMore Complex ObjectScenery ObjectDefining Object Methods - 1Defining Object MethodsRugSlide 24ArmchairSlide 26Slide 27Mantlepiece - 1Mantlepiece - 2Mirror - 1Mirror - 2Ball of WorstedSlide 33Testing Alice2.infCharacters - 1Characters - 2Kitten StatesChanging States - 1Changing States - 2Changing States - 3Kittens - 1Kittens - 2Kittens - 3Kittens - 4Autonomous ActionsActionsTesting Alice3.infSlide 48Slide 4901/13/19 1Inform Game EngineCIS 577Bruce R. MaximUM-Dearborn01/13/19 2Alice: Inform Tutorial Part 1Gareth Rees01/13/19 3Getting Started•Graham Nelson's The Inform Designer's Manual which describes the Inform language in detail. •You need to have release 6.01 or later of the Inform compiler and the Inform library in order to compile and run the examples. •The Inform home pages http://www.inform-fiction.org/I7/Welcome.html also has links to Inform 7.0 (which is very free text format)01/13/19 4Through the Looking Glass•Starts out in a room in Alice's house, in which Alice is playing with two kittens, one black and one white. •The text mentions an arm chair, a ball of worsted, a fireplace, a hearth rug, a chess set, a clock, a cat, and a looking glass above the fireplace. •It should be possible to involve many of these objects in the puzzle.01/13/19 5Goal•The puzzle will be to get through the looking glass. How can that be made difficult? •Perhaps the mantelpiece is too high for Alice to climb up onto without a chair, and the arm chair needs to be pushed over to the mantelpiece. •But the kittens get in the way of the chair, and Alice wouldn't want to hurt them, would she? So she has to distract the kittens.01/13/19 6Simplest Inform GameConstant Story "THROUGH THE LOOKING GLASS";! ^ is the new line characterConstant Headline "^An Interactive Tutorial^by Gareth Rees^";!Remove DEBUG line for production versionConstant DEBUG;!Every game makes use of these three librariesInclude "parser";Include "verblib";Include "grammar";01/13/19 7Need at Least One Object!Define initial locationObject Drawing_Room "Drawing room" has light with name "snow", description "The gentle sound of snow against the window pane suggests that it's cold outside, and you're glad to be here in the warmth. The drawing-room is reflected in the large looking-glass on the wall above the mantelpiece, and a very comfortable room it is too, with a warm hearth, a soft rug, and an arm-chair that you can curl up and sleep in.";01/13/19 8Initialise Function is Required[ Initialise; location = Drawing_Room; print "^^^^^It's a cold winter day outside, but in the looking-glass house it's summer. All you need to do is pretend there's a way of getting through into it somehow...^^";];01/13/19 9Return Codes•A routine inside an object returns 0 (false) by default•A routine outside of an object returns 1 (true) by default. •You can override this default using the `return', `rtrue' and `rfalse' statements, or by omitting the `print' instruction from a print statement.01/13/19 10Meaning of Return Codes`before‘`life' –True (1) means that the routine has successfully and completely dealt with the player's input, and the library shouldn't do anything more.–False (0) means that the usual library rules should now apply to the player's input (note that this doesn't necessarily mean that the routine has done nothing).01/13/19 11Meaning of Return Codes`after' –True (1) means that the `after' routine has printed a suitable response to the player's input, and the library shouldn't do anything more.–False (0) means that the usual library message should now be printed (again, this doesn't necessarily mean that the routine has done nothing).01/13/19 12Before and After•‘before’ –Should be used to change completely the effect of a particular action•‘after’–Should be used to change the message associated with a particular action01/13/19 13Meaning of Return Codes`describe' –True (1) means that the `describe' routine has printed a suitable description. The library shouldn't add anything else.–False (0) means that the library should print the usual description of the object.01/13/19 14Programming Tip•In an object's `before' routine, it's very common to want to –execute some code–print some text to tell the player what has happened–return 1 to prevent the library from doing anything else.• A good trick in this situation is to omit the `print' keyword from the last print statement.01/13/19 15Evaluation Order•Parse the command, setting up the variables `action', `noun' and `second' appropriately. •Call `GamePreRoutine' (if there is one). If this returns non zero, stop here. •Call the `before' routine of the player. If this returns non zero, stop here. •Call the `before' routine of the current location. If this returns non zero, stop here.01/13/19 16Evaluation Order•Call the `before' routine of the object `noun' (if any). If this returns non zero, stop here. •Carry out the action, if possible. If there was no action to carry out (i.e., the action didn't do anything interesting, for example `jump' or `smell', or the action failed, for example `put apple in banana') then print a failure message and stop here. •Call the `after' routine of the player. If this returns non zero, stop here.01/13/19 17Evaluation Order•Call the `after' routine of the current location. If this returns non zero, stop here. •Call the `after' routine of the object `noun' (if any). If this returns non zero, stop here. •Call `GamePostRoutine' (if there is one). If this returns non zero, stop here. •Print a message describing what happened at stage 6.01/13/19 18Simple Object! Just need to give it a name a descriptionObject red_queen "red queen" with name "red" "queen", description "She's a fierce little chess piece.";! Place this after the drawing room definition! Absent from game at start and Inform assumes no ! parent object01/13/19 19More Complex Object! Alice might want to put red Queen on the board! So make it a supporterObject chess_board "chess board" Drawing_Room has supporter with name "chess" "board" "checker" "chequer" "chessboard",


View Full Document

U-M CIS 577 - Inform Game Engine

Download Inform Game Engine
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Inform Game Engine and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Inform Game Engine 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?