Skip to main content

RicherAdventureLib

adventurelib provides basic functionality for writing text-based adventure games, with the aim of making it easy enough for young teenagers to do.

- @lordmauve

richeradventurelib expands upon this by allowing programmers to implement colours and styles into their games using the rich library

Use bbcode-like syntax in your games ([bold italic orange3 on blue]You are in the bedroom[/]) and even add emojis (:fire: You cast fireball :fire:)!

Furthermore, richeradventurelib places the entire story interface inside a rich terminal layout, allowing the user to view the status of the game and their inventory, with many more configurable possibilities!

Screenshot of demo gameplay

The foundation of adventurelib is the ability to define functions that are called in response to commands. For example, you could write a function to be called when the user types commands like "take hat":

@when('take THING')
def take(thing):
	print(f'You take the {thing}.')
	inventory.append(thing)

It also includes the foundations needed to write games involving rooms, items, characters and more... but users will have to implement these features for themselves as they explore Python programming concepts.

Usage

The usage of richeradventurelib is almost identical to that of the original adventurelib with a few additions:

Usually in an adventurelib game, you would have this at the very bottom of your file:

look()
adv.start()

However, the introduction of the sidecar UI complicates this a bit more. Firstly, you must define two variables: one for the state and one for the UI.

import richeradventurelib as adv


TITLE = 'Moonfall Trail'

state = adv.GameState(title=TITLE, location_name='Lantern Cabin', tracked_vars={"health": 100, "strength": 10})
ui = adv.SidecarUI(title=TITLE, state=state)

Then at the very bottom of your file, you must start the UI, sync the state, and start the game with the UI provided.

ui.start()
sync_state()
look()
adv.start(help=False, ui=ui)

Throughout the game, whenever you need to update a tracked variable, use state.set_var(var, value)

For example, when updating the health:

state.set_var('health', 100)

AI Acknowledgement

I used GitHub Copilot for a lot of the code in this project, namely the demo game and most of the implementation of the sidecar layout. The exact amount could be found through this project's hackatime (reviewers have access I think?).

As of this commit, the AI usage for this project remains under 30% of the total time.

Metadata

Release files for richeradventurelib 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for richeradventurelib 2.0.0
File Size Uploaded Provenance Actions
richeradventurelib-2.0.0.tar.gz 11.5 kB Without provenance Details for richeradventurelib-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for richeradventurelib 2.0.0
File Interpreter ABI Platform Actions
richeradventurelib-2.0.0-py3-none-any.whl Python 3 none any Details for richeradventurelib-2.0.0-py3-none-any.whl

Total release size: 23.4 kB

Release files / richeradventurelib-2.0.0.tar.gz

Download URL richeradventurelib-2.0.0.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0448107ec370637940cef0560d9537e8d0c4c3849580769a0ef47aa4b1177e8f
BLAKE2b-256 checksum
How to use checksums
617a3f701d17d44528fe9780a8b86db158aff1beef6d7839804f161c93df02c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / richeradventurelib-2.0.0-py3-none-any.whl

Download URL richeradventurelib-2.0.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29017f6ef36cab7fec56ab4dba3fa94fba4d6efa494a5273c7ebf8738aac2603
BLAKE2b-256 checksum
How to use checksums
2cf81a6d415660c3d3fecdd089e6d6cde7fc5cfddf7345d8717c43d429dacf65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for richeradventurelib 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page