Skip to main content

A small package to make creating your own text adventure games easy!

Project description

Text Adventures

This library aims to enable you to easily create your own text adventure games!

Getting started

Simply install the library using pip or your package manager:

pip install TextAdventures

Import the package in your code:

import TextAdventures

And you're good to go!

Loading and running scenes

The scene language enables you to create your own text adventure games with almost zero code!

To load scenes from a file, use the load_scenes method:

import TextAdventures

TextAdventures.load_scene("Scenes.txt")

You can load scenes from any generic text file. You can load scenes from as many files as you want, the only thing to remember is that the first scene in the first file you load will become the starting scene.

To run your game using those scenes, call the start_game method:

import textadventures

TextAdventures.load_scene("Scenes.txt")
TextAdventures.start_game()

And that's all the code you will need to run your text adventure games!

Getting to know Scene

Scene is the mini 'language' I created to remove all the coding from making a text adventure game. The Scene language is very basic and should be relatively easy to get your head around.

In the Scene language, everything is done using ACTIONs. An action is defined by an opening square bracket [ followed by the action name (which is preferable written in uppercase but this is not required) and ending with a closing square bracket ] (so it should look like this [ACTION]). All text following an action is treated as a parameter.

The following is a list of all current actions:

  • [SCENE] - This indicates the beginning of a new scene. The subsequent text until the next action is treated as the name or title of the scene. All subsequent actions are read as a part of the same scene until the next [SCENE] action.
  • [TEXT] - All subsequent text until the next action is printed for the user to see. This is useful for story telling.
  • [GOTO] - All subsequent text until the next action is read as a scene name. This action ends the current scene and starts another specified scene.
  • [OPTIONS] - This indicates the start of a list of options from which the user must select one. All subsequent text until the first option action is treated as the option's description (which will be printed for the user to see).
  • [OPTION] - This indicates a singular option. All subsequent text until the next action will be treated as part of the option. This can only follow an [OPTIONS] action or another [OPTION] action and can only be followed by a [GOTO] action.
  • [INTERACTION] - This indicates an interaction must occur from the player. The subsequent two space separated 'words' must be the ASCII key which the user must press followed by the number of seconds the user has to press this key (in that order).
  • [SUCCESS] - This is a conditional statement indicating the user completed the above interaction action successully. This can only follow an [INTERACTION] action or a [FAIL] action and can only be followed by a [GOTO] action.
  • [FAIL] - This is a conditional statement indicating the user did not complete the above interaction action successully. This can only follow an [INTERACTION] action or a [SUCCESS] action and can only be followed by a [GOTO] action.

More information:

The Scene language is currently a very basic prototype, it is my intention to make this into a full-fledged custom programming language which can be run using this module or transpiled to C++ and compiled using a tool I will create when the language is much more complete.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

textadventure-0.0.1.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

textadventure-0.0.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file textadventure-0.0.1.tar.gz.

File metadata

  • Download URL: textadventure-0.0.1.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for textadventure-0.0.1.tar.gz
Algorithm Hash digest
SHA256 994bcaab6e9016d2f50878d6e333776c565f46c13afab1e18d279ba7c17b7a7c
MD5 4a894d43f1bc3e1e83b3cd78db5e46e8
BLAKE2b-256 8e454ef2c90eb6a92bb42055fb141fccc51ff903ef961e48beec7487ff616b9c

See more details on using hashes here.

File details

Details for the file textadventure-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for textadventure-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a4fc649e33f5910bdbe28a4e718a2e01538e49536f02aafb82efe51aab058f7
MD5 6e348450ec9596c7d2e3e5ad72dc55b6
BLAKE2b-256 81b6218f5479435c94e74e5d2dd4d7f122963a94f551318d75a7e204f6eb8100

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page