A Python framework for parser-based web adventures.
Project description
Catchphrase provides software components to build parser-based interactive fiction for the web.
Catchphrase is a Python library, and part of the Turberfield namespace.
For a demonstration of such a project, see the repository tea-and-sympathy. You are free to download and experiment with that example.
This framework makes heavy use of the turberfield-dialogue library. The documentation is at an early stage.
Framework
A drama class to encapsulate game logic.
A parser system which maps text phrases to drama methods and parameters.
A presenter class which combines static dialogue with drama output.
Renderer functions to animate the output in HTML or plain text.
Drama
Drama objects dynamically generate dialogue.
Subclasses will override these methods:
build
interpret
Drama methods must declare by annotation the types of their keyword parameters. They must also provide a docstring to define the format of the text commands which apply to them.
Parser
The parser module provides functions to help drama objects respond to text input.
The CommandParser class interrogates drama methods to determine what parameters they require. Based on this information, and the declaration made in method docstrings, the parser generates all commands understood in the current context of the drama.
Presenter
The Presenter combines static dialogue with the generated output from a Drama object.
Prepare a turberfield-dialogue Folder object.
Create a Presenter from the Folder and the drama output.
Call the animate method to generate web frames ready for rendering.
Renderer
The Renderer is a namespace for functions which generate HTML5 elements from Presenter frames. There is also support for plain text output.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for turberfield-catchphrase-0.6.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b30cec9f50f5e2b58b7933c72b68e9242e67018c4939156d15d780dc7237d888 |
|
MD5 | 57347606ba9be432cfe6887370b78b10 |
|
BLAKE2b-256 | 755b266849cd68a1506ecb08ce0710f6c564507c71f2b5abed354f9e1e9a5b19 |