A python library for writing parser-based interactive fiction.

Overview

About IntFicPy

A python library for writing parser-based interactive fiction. Currently in early development.

IntFicPy Docs

Parser-based interactive fiction

Parser based interactive fiction, sometimes called text adventure, is a story displayed through text, that the reader/player interacts with by typing out commands. Typing "get lamp", for instance, will cause the character to take the lamp.

Why IntFicPy?

All of the major systems for writing parser based interactive have their own languages, useful for nothing else. With IntFicPy, I wanted to make it possible for creators who already knew Python to use that knowledge for writing interactive fiction, and for creators new to Python to work in a language for which myriad tutorials, and a strong online community already exist.

IntFicPy Engine

IntFicPy is a Python game engine for creating parser-based interactive fiction (text adventures). IntFicPy is designed to be comprehensive and extensible. It has 80 predefined verbs, including all the standards of the genre, many with syonyms (get/take) and alternate phrasings (put hat on/put on hat). Game creators can define their own verbs - which integrate seamlessly with the predefined verb set - in minutes. Built in support for complex conversations with NPCs, dark areas and moveable light sources, locks and keys, save/load, and much more.

Parser

Parsing natural language commands can be challenging. For this project, the problem was simplified substantially by the conventions of interactive fiction (IF). Commands are always in the imperative tense (phrased like direct orders). Knowing this, we can guarantee the basic word order of commands. The IntFicPy parser starts by looking at the first word of the command, which should contain the verb. It then uses clues from the command, like prepositions, and number of grammatical objects to determine which verb function to call.

Verbs

At the time of writing, IntFicPy has 78 verbs built in. Users can also create their own verbs, specific to their games. Each verb in IntFicPy is an instance of the Verb class. When a new instance is created, the verb is automatically added to the game's dictionary of verbs. When synonyms are added using the addSynonm method, they are also added to the dicitonary.

Item Classes

IntFicPy currently has 28 classes for items, all subclasses of Thing. Each class of item behaves differently when used for verbs. For instance, you can put a Thing in a Container, read a Readable, unlock a Lock using a Key, or look through a Transparent. Composite items can be created with the addComposite method, to create, for instance, a box with writing on it, or a dresser with three drawers. Non Player Characters and Conversations The class for non-player-characters in IntFicPy is Actor. The most important distinguishing feature of Actors is that the player can talk with them. Creators can either set up responses to Topics ("ask/tell/give/show X (about) Y", where X is an Actor, and Y is an item in the game or creator defined abstract concept), or use SpecialTopics. Special topics allow for a menu style conversation, where the player can select from topics that are suggested to them.

Installation and Use

First Release & Current Developments

The first full length IntFicPy game, Island in the Storm was entered into IFComp 2019. Many thanks to everyone who played and voted.

IntFicPy's first release, originally planned for fall 2019, is postponed until further notice, while I improve test coverage and refactor.

If you want to play around with the library, please do - and I'd love to hear your feedback - but be aware that IntFicPy is not currently stable.

How to Install IntFicPy

After cloning the repo, install the dependencies, then the IntFicPy package.

$ cd intficpy
$ pipenv shell
$ pipenv install
$ pip install -e .

You should now be able to run the example game.

$ python examples/testgame.py

You can also run the tests.

$ python -m unittest discover

License

IntFicPy is distributed with the MIT license (see LICENSE)

You might also like...
Tool to generate wrappers for Linux libraries allowing for dlopen()ing them without writing any boilerplate

Dynload wrapper This program will generate a wrapper to make it easy to dlopen() shared objects on Linux without writing a ton of boilerplate code. Th

Just some mtk tool for exploitation, reading/writing flash and doing crazy stuff

Just some mtk tool for exploitation, reading/writing flash and doing crazy stuff. For linux, a patched kernel is needed (see Setup folder) (except for read/write flash). For windows, you need to install zadig driver and replace pid 0003 / pid 2000 driver.

WriteAIr is a website which allows users to stream their writing.

WriteAIr is a website which allows users to stream their writing. It uses HSV masking to detect a pen which the user writes with. Plus, users can select a wide range of options through hand gestures! The notes created can then be saved as images and uploaded on the server.

Procedurally generated Oblique Strategies for writing your own Oblique Strategies

Procedurally generated Oblique Strategies for writing your own Oblique Strategies.

Analisador de strings feito em Python // String parser made in Python

Este é um analisador feito em Python, neste programa, estou estudando funções e a sua junção com "if's" e dados colocados pelo usuário. Neste código,

:snake: Complete C99 parser in pure Python

pycparser v2.20 Contents 1 Introduction 1.1 What is pycparser? 1.2 What is it good for? 1.3 Which version of C does pycparser support? 1.4 What gramma

A Gura parser implementation for Python

Gura parser This repository contains the implementation of a Gura format parser in Python. Installation pip install gura-parser Usage import gura gur

Parser for RISC OS Font control characters in Python

RISC OS Font control parsing in Python This repository contains a class (FontControlParser) for parsing font control codes from a byte squence, in Pyt

Neogex is a human readable parser standard, being implemented in Python

Neogex (New Expressions) Parsing Standard Much like Regex, Neogex allows for string parsing and validation based on a set of requirements. Unlike Rege

Comments
  • Clean refactor 2019

    Clean refactor 2019

    Clean up and refactoring.

    • Reorganize modules. Move modules into their own folders. Separate modules that don't belong in the same file. Reorganize to reduce circular imports.
    • Move a bunch of imports from inside functions to the top of the files
    • clean up repetitive init methods in Thing subclasses
    • refactor the objects save mappings into class objects so they can store their own index and prefix
    • run black against the whole codebase
    • update the example
    opened by RALWORKS 0
  • Exception importing helpVerb, helpVerbVerb, aboutVerb

    Exception importing helpVerb, helpVerbVerb, aboutVerb

    things.py:consumeLightSourceDaemonFunc() imports some outdated or non-existent verbs.

    Exception ignored on calling ctypes callback function: <rubicon.objc.api.objc_method object at 0x110c46c10> Traceback (most recent call last): File "/Users/jbassett/Projects/beeware/bee-env/lib/python3.9/site-packages/rubicon/objc/api.py", line 275, in call result = self.py_method(py_self, *args) File "/Users/jbassett/Projects/beeware/bee-env/lib/python3.9/site-packages/toga_cocoa/widgets/textinput.py", line 43, in textDidEndEditing_ self.interface.on_lose_focus(self.interface) File "/Users/jbassett/Projects/beeware/bee-env/lib/python3.9/site-packages/toga/handlers.py", line 66, in _handler result = handler(interface, *args, **kwargs) File "/Users/jbassett/Projects/beeware/calebais/src/calebais/app.py", line 136, in textbox_lose_focus self.handle_input(widget, **kwargs) File "/Users/jbassett/Projects/beeware/calebais/src/calebais/app.py", line 117, in handle_input self.game.turnMain(input_text) File "/Users/jbassett/Projects/beeware/bee-env/lib/python3.9/site-packages/intficpy/ifp_game.py", line 176, in turnMain self.daemons.runAll(self) File "/Users/jbassett/Projects/beeware/bee-env/lib/python3.9/site-packages/intficpy/daemons.py", line 11, in runAll daemon.func(game) File "/Users/jbassett/Projects/beeware/bee-env/lib/python3.9/site-packages/intficpy/things.py", line 456, in consumeLightSourceDaemonFunc from .verb import helpVerb, helpVerbVerb, aboutVerb ImportError: cannot import name 'helpVerb' from 'intficpy.verb' (/Users/jbassett/Projects/beeware/bee-env/lib/python3.9/site-packages/intficpy/verb.py)

    I was able to fix this problem by just removing those verbs from the function altogether.

    opened by RathmoreChaos 0
Releases(v1.3)
  • v1.3(Apr 6, 2021)

    • add Events API to provide a better abstraction for the old newBox/printToGUI system of adding text to the game
    • move core functionality out of the Qt GUI app and into intficpy
    • create a terminal interface for IFP games to include with intficpy by default
    • move the Qt GUI into its own repo
    Source code(tar.gz)
    Source code(zip)
  • v1.2(Apr 6, 2021)

  • v1.1(Apr 6, 2021)

  • v1.0(Mar 26, 2020)

Owner
Rita Lester
Python developer based in Edmonton, AB.
Rita Lester
Calibre Libgen Non-fiction / Sci-tech store plugin

CalibreLibgenSci A Libgen Non-Fiction/Sci-tech store plugin for Calibre Installation Download the latest zip file release from here Open Calibre Navig

IDDQD 9 Dec 27, 2022
Py-Parser est un parser de code python en python encore en plien dévlopement.

PY - PARSER Py-Parser est un parser de code python en python encore en plien dévlopement. Une fois achevé, il servira a de nombreux projets comme glad

pf4 3 Feb 21, 2022
App and Python library for parsing, writing, and validation of the STAND013 file format.

python-stand013 python-stand013 is a Python app and library for parsing, writing, and validation of the STAND013 file format. Features The following i

Oda 3 Nov 9, 2022
Cirq is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators

Cirq is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators. Install

quantumlib 3.6k Jan 7, 2023
Viewflow is an Airflow-based framework that allows data scientists to create data models without writing Airflow code.

Viewflow Viewflow is a framework built on the top of Airflow that enables data scientists to create materialized views. It allows data scientists to f

DataCamp 114 Oct 12, 2022
A simple string parser based on CLR to check whether a string is acceptable or not for a given grammar.

A simple string parser based on CLR to check whether a string is acceptable or not for a given grammar.

Bharath M Kulkarni 1 Dec 15, 2021
Python DSL for writing PDDL

PDDL in Python – Python DSL for writing a PDDL A minimal implementation of a DSL which allows people to write PDDL in python. Based on parsing python’

International Business Machines 21 Nov 22, 2022
Small exercises to get you used to reading and writing Python code!

Pythonlings Welcome to Pythonlings, an automated Python tutorial program (inspired by Rustlings and Haskellings). WIP This program is still working in

鹤翔万里 5 Sep 23, 2022
This repository requires you to solve a problem by writing some basic python code.

Can You Solve a Problem? A beginner friendly repository that requires you to solve familiar problems with python. This could be as simple as implement

Precious Kolawole 11 Nov 30, 2022
Basic infrastructure for writing scripts in Python

Base Script Python is an excellent language that makes writing scripts very straightforward. Over the course of writing many scripts, we realized that

Deep Compute, LLC 9 Jan 7, 2023