Code Monkey home page Code Monkey logo

gpt-adventures's Introduction

GPT Adventure Game Engine

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).

Playing

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)

Game Structure

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").

Modifying

The script can be extended by modifying the GAME_TEMPLATE, the prompts or by adding additional game actions.

AUTHOR

Nelson Ferraz (@nferraz)

DEVELOPMENT / SUPPORT

This module is developed on GitHub.

Send ideas, feedback, tasks, or bugs to GitHub Issues.

gpt-adventures's People

Contributors

nelson-ferraz avatar nferraz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.