Skip to content

simtownai/simtown

Repository files navigation

SimTown

Build and Deploy

A multiplayer web-based simulation game built with React, Phaser, Socket.IO, Supabase, and OpenAI. NPCs powered by GPT-4 interact with players in a shared virtual space.

simtown-demo.mp4

Technical Highlights

  • Autonomous AI characters & interactions with them using OpenAI's GPT-4
  • Real-time multiplayer synchronization with Socket.IO
  • Mobile-responsive design with touch controls and virtual joystick
  • Google OAuth integration
  • Persistent player interactions and chat history for authorized players

Project Structure

The project consists of a server and a client. The server manages NPCs, rooms, and inter-player communication, while the client is responsible for the UI and game rendering.

Notable client directories include:

Server directories:

Development

Setup

  1. Install dependencies:
bun install
  1. Configure environment:
cp .env.example .env

Required environment variables:

  • OPENAI_API_KEY: Your OpenAI API key
  • VITE_SUPABASE_URL: Supabase project URL
  • VITE_SUPABASE_ANON_KEY: Supabase anonymous key

Running Locally

Start all services in development mode:

bun dev

Or run services individually:

# Game server
bun dev:server    # Runs on :3000

# Frontend
bun dev:client    # Runs on :3001

Docker Deployment

Build and run the server using Docker Compose:

docker compose up -d --build