Add README
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
# LLM Adventure Game
|
||||
|
||||
A simple text‑based adventure game that uses OpenAI's GPT‑3.5 to generate the story. The game runs in a terminal and accepts free‑form player commands. The LLM keeps the narrative and responds to the player.
|
||||
|
||||
## Features
|
||||
|
||||
* **LLM powered narration** – GPT‑3.5 generates vivid scenes and dialogue.
|
||||
* **Interrupt / pause** – Type `pause` to view the current game state and resume later.
|
||||
* **State persistence** – The game automatically saves the conversation history to `game_state.json` so you can quit and resume.
|
||||
* **Simple command interface** – `help`, `pause`, `resume`, `exit`.
|
||||
|
||||
## Requirements
|
||||
|
||||
* Python 3.8+.
|
||||
* `openai` library.
|
||||
* An OpenAI API key.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
# Clone the repo
|
||||
git clone https://git.brojs.ru/RK-A/llm-adventure-game-2.git
|
||||
cd llm-adventure-game-2
|
||||
|
||||
# Create a virtual environment (optional but recommended)
|
||||
python -m venv venv
|
||||
source venv/bin/activate # On Windows use `venv\Scripts\activate`
|
||||
|
||||
# Install dependencies
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Set your OpenAI API key
|
||||
export OPENAI_API_KEY=sk-... # On Windows use `set` instead of `export`
|
||||
|
||||
# Run the game
|
||||
python main.py
|
||||
```
|
||||
|
||||
Once the game starts, type any action or command and the LLM will generate the next part of the story.
|
||||
|
||||
### Pausing and Resuming
|
||||
|
||||
* Type `pause` to pause the game. The current state will be printed.
|
||||
* While paused you can type `resume` to continue or `exit` to quit.
|
||||
* If you exit the game, the state is cleared. If you close the terminal or hit `Ctrl+C`, the state is saved and you can resume by running `python main.py` again.
|
||||
|
||||
## License
|
||||
|
||||
MIT License.
|
||||
Reference in New Issue
Block a user