An interactive text adventure game based on a time loop mechanism. Players must solve puzzles, engage in conversations, and save their fellow student within a limited time frame.
- Natural Language Interaction
- Dynamic Dialogue System
- Time Loop Mechanism
- Multiple Endings
- Character Trust System
- FastAPI
- OpenAI GPT API
- Python 3.9+
- Uvicorn
- Vue 3
- TypeScript
- Vite
- Pinia
# Clone repository
git clone https://github.com/MPX0222/StorytellingAgent.git
cd StorytellingAgent
# Create virtual environment
conda create -n story_agent python=3.9
conda activate story_agent
# Navigate to backend directory
cd backend
# Install dependencies
pip install -r requirements.txt
# Create and configure .env file
cp .env.example .env
Edit .env
file with your configuration:
OPENAI_API_KEY=your_openai_api_key
OPENAI_API_BASE=your_openai_api_base
OPENAI_MODEL_NAME=gpt-3.5-turbo
OPENAI_TEMPERATURE=0.7
OPENAI_MAX_TOKENS=1000
# Navigate to frontend directory
cd sharp-school
# Install dependencies
npm install
# Configure environment variables
cp .env.example .env.local
Edit .env.local
file:
VITE_API_BASE_URL=http://localhost:8000
Backend:
# In backend directory
uvicorn app.main:app --reload --port 8000
Frontend:
# In sharp-school directory
npm run dev
Visit http://localhost:5173 to start playing.
Access the complete API documentation at http://localhost:8000/docs after starting the backend service.
-
Basic Controls
- Use command line for natural language input
- Click action buttons
- Build trust through conversations
-
Key Tips
- Watch the time
- Observe character reactions
- Use information from each loop
- Create new character class in
backend/agents
- Inherit from
LLMAgent
base class - Implement required methods:
process_dialogue
get_dialogue_options
- Add new location in
game_state.py
- Update
_handle_movement
method - Add corresponding scene descriptions
- Fork the repository
- Create a feature branch
- Submit changes
- Create Pull Request
MIT License