This is a text adventure game engine that uses an AI language model to generate all game elements (plot, locations, objects, etc).
For example:
The Quest of the Lost Talisman
You are a brave adventurer who has been called upon to save the
kingdom from an evil sorcerer who has stolen the talisman that holds
the key to immortality. You must journey through treacherous terrain
and overcome many obstacles to retrieve the talisman and save the
kingdom.
Type your instructions using one or two words, for example:
> look
> take $object
> look at $object
> inventory
> go north
> drop $object
> ?
What do you want to do?
Every detail in the game is generated by a LLM (gpt-3.5-turbo by default).
The player will be prompted to interact with the game by typing commands. The game will then respond to the player's commands with text generated by OpenAI's language model.
The game engine includes the following default actions:
look
: Describes the current location.look <object>
: Describes that object.take <object>
: Take an object if it is in the same room.drop <object>
: Drop an object if the player is carrying it.go <north|south|east|west>
: Move to a different location in the game.help
: Displays a list of possible actions.
For any other action, the game engine will delegate the response to the
language model, which will act as a game master, providing a response
and modifying the game state as necessary. (See function: magic_action
)
The game structure object contains a title, plot and entities (player, locations, and objects).
Each entity has a type, a position, a short description, and a long
description. Locations also have exits
("north", "south", "east",
"west").
The script can be extended by modifying the GAME_TEMPLATE
, the prompts
or by adding additional game actions.
Nelson Ferraz (@nferraz)
This module is developed on GitHub.
Send ideas, feedback, tasks, or bugs to GitHub Issues.