gptrpg

A demo of an GPT-based agent existing in an RPG-like environment

Visit WebsiteView on GitHub
990
Stars
+83
Stars/month
0
Releases (6m)

Overview

GPTRPG is a proof-of-concept project that demonstrates an OpenAI GPT-powered agent operating within a 2D RPG-like environment. The system combines a React-based frontend with Phaser game engine and Grid Engine plugin to create a tile-based world where an AI agent can move around, interact with the environment, and make autonomous decisions. The agent communicates with the game world through websockets and uses the OpenAI API (specifically gpt-3.5-turbo) to process its surroundings and decide on actions based on its internal state, such as sleepiness levels. The environment features impassable terrain, plantable tiles, and basic farming mechanics that players can control manually. Built with established tools like Tiled map editor for world creation, this project serves as an educational example of how large language models can be integrated into game-like environments to create autonomous virtual beings. While currently limited in scope, it provides a foundation for exploring AI agent behavior in structured, interactive worlds and demonstrates the potential for more complex agent-driven gameplay systems.

Pros

  • + Complete working demonstration of LLM integration in a game environment with visual interface
  • + Uses well-established tools (React, Phaser, Tiled) making it accessible to developers familiar with these technologies
  • + Open-source proof-of-concept that provides a concrete starting point for AI agent experimentation in gaming contexts

Cons

  • - Limited to local deployment only, requiring manual setup and OpenAI API key configuration
  • - Proof-of-concept stage with minimal agent capabilities (only sleepiness tracking and basic movement)
  • - Currently supports only single agent scenarios with no multi-agent or advanced interaction features

Use Cases

Getting Started

1. Add your OpenAI API key to the agent/env.json configuration file 2. Install dependencies by running 'npm install' in the gptrpg directory 3. Start both the agent and frontend with 'npm start' and access the game at [link]