Glimmr Canvas Animation

version 1/111030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next

  • Section: Undo, Save, Restore

    GCA handles undo and restore transparently:

        UNDO - The Inform library saves the state of the game just before getting input, at the beginning of a new turn. When the player types UNDO, the game will resume where it was when the state was saved, with any animations picking up exactly where they were.

        SAVE - Inform saves the game at the moment that the player confirms the intention to save the game. Again, when the game is restored, GCA will pick up exactly where it left off.

    Implementation note:

    The Glulx virtual machine does not store the state of the timer when saving the state of the game. That means that we need to do that ourselves in order to properly restore the game or undo a previous turn. GCA takes care of this for us by storing the timer interval in a global variable, and then either triggering the timer at the appropriate speed or turning it off as appropriate immediatedly after restoring or undoing. If we are making changing to save/restore, the after restoring the game rules, or undo code, we should be sure that we don't break this functionality.

    Glimmr Canvas Animation uses the Undo Output Control extension to manage the timer after UNDO. If you are using Ron Newcomb's Custom Library Messages or Default Messages extensions, however, you can simply include "[@ reset the Glulx timer]" in the text of your undo report message to manage the same thing. If you'd rather do this, include the following code block in your game, and you won't need Undo Output Control.

        Section - Reset timer after UNDO (in place of Section - Restart the timer after undoing in Glimmr Canvas Animation by Erik Temple)

        table of custom library messages (continued)
      library-action (action-name)   library-message-id (number)  library-message-text (text)  
      --  13  "[@ reset the Glulx timer][bracket]Previous turn undone.[close bracket]"