Skip to content

Feli87/first-person-room

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minecraft Video Chat Room

A real-time video chat application with a Minecraft-style 3D interface built with WebRTC and React Three Fiber.

Features

  • 🎮 Minecraft-style 3D World: Navigate a voxel-based room in first-person view
  • 📹 WebRTC Video Chat: Peer-to-peer video communication
  • 💬 Real-time Chat: Text messaging with Socket.IO
  • 👥 Multiplayer: See other users as 3D avatars
  • 🎨 Customizable Avatars: Each user gets unique colors based on their ID

Tech Stack

Backend

  • NestJS - Node.js framework
  • Socket.IO - Real-time communication
  • JWT - Authentication

Frontend

  • React - UI framework
  • Vite - Build tool
  • React Three Fiber - 3D rendering
  • Drei - Three.js helpers
  • Zustand - State management
  • TailwindCSS - Styling

Project Structure

first-person-room/
├── server/                 # NestJS backend
│   ├── src/
│   │   ├── modules/
│   │   │   ├── auth/      # Authentication module
│   │   │   └── chat/      # Chat & WebRTC signaling
│   │   ├── app.module.ts
│   │   └── main.ts
│   └── package.json
│
├── client/                 # React frontend
│   ├── src/
│   │   ├── components/
│   │   │   ├── 3d/        # Three.js components
│   │   │   └── ui/        # UI components
│   │   ├── hooks/         # Custom hooks
│   │   ├── stores/        # Zustand stores
│   │   ├── pages/         # Page components
│   │   └── layouts/       # Layout components
│   └── package.json
│
└── package.json           # Root package.json

Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

  1. Install dependencies:
npm install
  1. Start the development servers:
npm run dev

This will start:

  • Backend server on http://localhost:3001
  • Frontend on http://localhost:5173

Running Individually

# Backend only
npm run dev:server

# Frontend only
npm run dev:client

Controls

Key Action
W/A/S/D Move
Mouse Look around
Space Jump
Enter/T Open chat
Escape Pause menu

Environment Variables

Server

  • PORT - Server port (default: 3001)
  • JWT_SECRET - JWT secret key
  • CLIENT_URL - Frontend URL for CORS

Client

  • Configure in vite.config.ts for proxy settings

Architecture

Authentication Flow

  1. User registers/logs in via REST API
  2. Server returns JWT token
  3. Token used for Socket.IO authentication

WebRTC Flow

  1. User joins room via Socket.IO
  2. Server notifies existing users
  3. New user initiates WebRTC offers to all users
  4. ICE candidates exchanged through server
  5. Direct peer-to-peer video streams established

Real-time Updates

  • Position/rotation synced via Socket.IO
  • Throttled to reduce bandwidth
  • Smooth interpolation on receiving end

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published