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
NYCU(NCTU)-差勤-助教

NCTU-TA-fill 填寫 差勤-助教時數 有沒有覺得在差勤系統填助教時數有點浪費生命? 今天有個懶鬼浪費好多時間幫大家寫了code 只要填好的必要的資料,就可以讓電腦自動幫你完成差勤助教的時數填寫喔! https://pt-attendance.nctu.edu.tw/verify/userL

14 Dec 21, 2021
A slapdash script to solve Wordle or Absurdle automatically

A slapdash script to solve Wordle or Absurdle automatically

Michael Anthony 1 Jan 19, 2022
FileTransfer - to exchange files from phone to laptop

A small website I locally host on my network to exchange files from my phone and other devices to my laptop.

Ronak Badhe 4 Feb 15, 2022
Free Vocabulary Trainer - not only for German, but any language

Bilderraten DOWNLOAD THE EXE FILE HERE! What can you do with it? Vocabulary Trainer for any language Use your own vocabulary list No coding required!

Hans Alemão 4 Jan 02, 2023
Using graph_nets for pion classification and energy regression. Contributions from LLNL and LBNL

nbdev template Use this template to more easily create your nbdev project. If you are using an older version of this template, and want to upgrade to

3 Nov 23, 2022
A fast Python in-process signal/event dispatching system.

Blinker Blinker provides a fast dispatching system that allows any number of interested parties to subscribe to events, or "signals". Signal receivers

jason kirtland 1.4k Dec 31, 2022
En este repositorio pondré archivos graciositos de python que hago de vez en cuando

🐍 Apuntes de python 🐍 ¿Quién soy? 👽 Saludos,mi nombre es Carlos Lara. Pero mi nickname en internet es Hercules Kan. Soy un programador autodidacta

Carlos E. Lara 3 Nov 16, 2021
Really bad lisp implementation. Fun with pattern matching.

Lisp-py This is a horrible, ugly interpreter for a trivial lisp. Don't use it. It was written as an excuse to mess around with the new pattern matchin

Erik Derohanian 1 Nov 23, 2021
Shopping-card - Shopping Card Project With Python

Shopping Card Project this application was built to handle problems with saving

moein98 1 May 06, 2022
pyToledo is a Python library to interact with the common virtual learning environment for the Association KU Leuven (Toledo).

pyToledo pyToledo is a Python library to interact with the common virtual learning environment for the Association KU Leuven a.k.a Toledo. Motivation

Daan Vervacke 5 Jan 03, 2022
Our Ping Pong Project of numerical analysis, 2nd year IC B2 INSA Toulouse

Ping Pong Project The objective of this project was to determine the moment of impact of the ball with the ground. To do this, we used different model

0 Jan 02, 2022
The Python Achievements Framework!

Pychievements: The Python Achievements Framework! Pychievements is a framework for creating and tracking achievements within a Python application. It

Brian 114 Jul 21, 2022
Wordle-solve - Attempting to solve wordle

Wordle Solver Run with python wordle_beater.py. This hardmode wordle solver take

Tom Lockwood 42 Oct 11, 2022
Generate a wordlist to fuzz amounts or any other numerical values.

Generate a wordlist to fuzz amounts or any other numerical values. Based on Common Security Issues in Financially-Oriented Web Applications.

Ivan Šincek 3 Oct 14, 2022
Cairo-math-64x61 - Fixed point 64.61 math library for Cairo / Starknet

Cairo Math 64x61 A fixed point 64.61 math library for Cairo & Starknet Signed 64

Influence 63 Dec 05, 2022
App to decide weekly winners in H2H 1 Win (9 Cat)

Fantasy Weekly Winner for H2H 1 Win (9 Cat) Yahoo Fantasy API Read

Sai Atmakuri 1 Dec 31, 2021
bib2xml - A tool for getting Word formatted XML from Bibtex files

bib2xml - A tool for getting Word formatted XML from Bibtex files Processes Bibtex files (.bib), produces Word Bibliography XML (.xml) output Why not

Matheus Sartor 1 May 05, 2022
Saturne best tools pour baiser tout le système de discord

Installation | Important | Discord 🌟 Comme Saturne est gratuit, les dons sont vraiment appréciables et maintiennent le développement! Caractéristique

GalackQSM 8 Oct 02, 2022
Never miss a deadline again

Hack the Opportunities Never miss a deadline again! Link to the excel sheet Contribution This list is not complete and I alone cannot make it whole. T

Vibali Joshi 391 Dec 28, 2022
WinBoost: Boost your windows system.

Winboost runs a complete checkup of your entire system locating junk files, speed-reducing issues and causes of any system or application glitches or crashes. Through a lot of research and testing, w

Smit Parmar 4 Oct 01, 2021