Monday 8 February 2016

I7 CYOA Framework update and overview

I've started writing the documentation for my CYOA extension for Inform 7. Two secret testers enjoyed the first example game and their excitement is getting me more excited.

The extension itself needs more examples and more testing, but having written the intro and overview, I want to share them now so that folks get a comprehensive sense of how this thing works and what it can do.

As for a shipping date – when it's ready!

INTRODUCTION

CYOA Framework for Glulx enables authors to create choice-based games or hypertexts using Inform 7. A world model switch allows projects to be integrated with Inform's world model features (rooms, objects, people, etc.) or to explicitly ignore those features if they're not needed. You can use this extension to do any of the following:

  • Create a project consisting entirely of prose, choices and links (no parser) with or without a world model underneath
  • Create choice-based interludes of any kind (conversations and puzzles are typical candidates) to include in a parser-driven game
  • Create hybrid projects in which the player can switch between the parser and CYOA mode at will (tricky, but doable!)

The extension handles the drudge work of automatically attaching keypresses and/or hyperlinks to choices depending on the player's interface preferences. The resulting CYOA projects are user-friendly and portable across a wide range of devices and input methods (keyboard, virtual keyboard, mouseclick, finger tap). Users can toggle a screen reader mode to further customise the interface.

The 'CYOA' of the extension's title stands for 'Choose Your Own Adventure', referring to the popular series of late twentieth century books and their mechanic of narrative progression via discrete choices. I named the extension 'CYOA Framework...' rather than 'Choice-Based Framework...' for two reasons:

1. The extension code is already crammed with incidences of the word 'choice'. Naming its choice-based mode 'CYOA mode' and being able to use the prefix 'cyoa' made everything easier.

2. It's a more spirited name.

Throughout this documentation, 'CYOA Framework for Glulx' will be referred to as CF, and the terms 'user' and 'player' are interchangeable, as are the terms 'game' and 'project'.

OVERVIEW

A master switch (cyoa-active) determines whether a project is running in CYOA mode or parser mode at any given time. An entirely choice-based game will never leave CYOA mode. As an author, you can toggle the game mode as required and direct where the player goes during transitions. You can also give the player the power to toggle modes at will.

The base unit of the CF project is the node.

A node generally consists of some prose describing the current situation or location, followed by a list of choices. Choices can also appear in the prose section of the node. (Graphics can be used as choices, too.)

In Inform terms, each node takes the form of a single node rule (e.g. 'This is the bedroom rule'). A node has four optional stages which run in a set order - setup, prose, choices, react. Having all the material for a particular node in one rule makes it easy to read and maintain.

CF offers four modes for automatically labelling choices with keypresses: numerals (1-9), letters (A-Z), particular (arbitrary key sequence defined by you) and smart (CF will use the first letter of the choice text, or a letter within each text flagged by you). You can change modes throughout your project as required.

When hyperlinks are on, all choices are automatically presented as clickable/tappable hyperlinks as well. Only the hyperlinks in the active node will function. Old hyperlinks are rendered inoperable every turn (with one exception discussed in the Advanced Concepts section further down.)

Having read the node prose, a user picks a choice by pressing the listed key or clicking on the hyperlinked choice. If the choice links to another node, the user will activate, or 'move to', the new node. An author can also link individual choices to Inform actions (e.g. 'opening the window'), to special 'continue' prompts, to custom programming, or to any combination of the above.

The extension supplies a world support switch (cyoa-support world) which lets you specify whether or not you want your project to be integrated with Inform's world model concepts: locations arranged in a map, manipulable objects in those locations, other characters who may or may not move around every turn, and the like.

If you set world support OFF, your CF project will behave a lot like a Twine project. There will be no rooms, objects or people to program or worry about. You will just be writing nodes of text connected to each other by choices. You can still avail yourself of any programming you need, but world model entities are rendered invisible in terms of the game's text output.

If you set world support ON, you need to assign every room in your game a base node. When the player moves to a new room in CYOA mode, that room's base node is activated, and while a player is 'in' a base node, they will perceive all relevant output from the world model. That's to say that objects and people in the room will be listed as usual.

If the player activates a non-base node (a node not specifically attached to a room) they are considered to be going 'off-node', during which time they will not see the world model-generated descriptions of objects and people in the current room. If they did, the intermingled texts could read confusingly.

Separate from the choices attached to particular nodes, CF includes a dedicated system of hotkey actions and a complementary options menu.

Hotkey actions are actions the player can invoke during any turn in CYOA mode by pressing the key(s) permanently dedicated to them (or clicking on their links if the player turns key input off). CF comes with a base set of 10 actions you can include:

  1. undoing
  2. mode-switching
  3. menu-visiting
  4. game-saving
  5. game-loading
  6. credits-reading
  7. interface-changing
  8. transcript-toggling
  9. game-restarting
  10. game-quitting

Hotkey actions are highly customisable. You can decide which ones are active, when they're active, what keys call them and which ones appear in the options menu. You can also create new ones.

The options menu (openable by a hotkey) makes hotkey actions selectable via CF's regular choice-listing format. Placing hotkey actions in the menu only can help free up more keys for use during regular play, declutter your status bar and move commands you believe users will need less frequently one step out of the way.

If the player can reach some kind of ending in your game, you can activate the CYOA menu equivalent of Inform's traditional 'final question' section. You can also customise the options that appear in the menu.

ADVANCED CONCEPTS

1. General actions

A general action calls its own node-independant block of code whenever a choice links to it, therefore it can be considered to be free of the context of any particular node. An obviously good, simple candidate to be a general action in a world model game is the inventory command, since the player's location and the state of the game have no bearing on it.

Choices that link to general actions are also the only choices in the game allowed to be made 'eternal', a concept mostly relevant if you force your players to use hyperlinks. If you switch cyoa-eternal general actions ON, all general action hyperlinks in the scrollback will continue to be useable until the screen is cleared. To make a project in which no hyperlink ever ceases to work, it must be built entirely out of general actions.

2. Dynamic/automatic choice generation

Making the appearance of a choice in a particular node conditional on the state of variables or the game is easy, but CF also allows you to generate choices – or kinds of choices – dynamically across a project. Here are a couple of basic examples: You could write a 'create gets' routine that scans rooms for objects and automatically creates 'Get (object)' choices for them. You could place an 'inventory' choice at the bottom of the choice list presented every turn.

For such purposes, CF includes four new rulebooks which run at specific moments as the extension processes and prints out the contents of a node -

  1. before preparing
  2. after preparing
  3. before choices
  4. after choices

By placing dynamic choice generation rules into the appropriate rulebooks, you can control when in the process any automatically created options will appear.

3. Limitations

The main thing CF can't do that some authors are likely to want to do is print choices or hyperlinks outside the main window, or in the status bar. Unified Glulx Input, the foundation of CF, doesn't support such things yet, so CF doesn't support them.

Graphics support in CF is of the most basic kind. If you use a graphic as a link, the graphic appears in the game window at its original size and flush against the left edge of the window. Nor can successive graphics be placed beside each other. But on the plus side, CF offers better support for graphics alt-text than ships with Inform.

No comments:

Post a Comment