Social-Arcade-Universe

A production-ready multiplayer mobile game with social features, built with Unity (C#) and Node.js backend.

Stars
6
Language
C#
Updated

Social Arcade Universe

A production-ready multiplayer mobile game with social features, built with Unity (C#) and Node.js backend.

šŸŽ® Game Overview

Social Arcade Universe is a hybrid arcade game combining:

  • Real-time multiplayer gameplay
  • Social/reel-style content sharing (TikTok-like)
  • Progression and economy systems
  • AI-driven personalization

šŸ—ļø Architecture

Backend (Node.js + PostgreSQL + Socket.io)

  • API Server: Express.js REST API
  • Real-time: Socket.io for multiplayer
  • Database: PostgreSQL with Prisma ORM
  • Cache: Redis for matchmaking and sessions

Frontend (Unity 2023 LTS)

  • Language: C# 11
  • Networking: Socket.io Client
  • Architecture: Event-driven with Clean Architecture

šŸš€ Quick Start

Prerequisites

  • Node.js 20+
  • PostgreSQL 15+
  • Redis 7+
  • Unity 2023.2 LTS

Backend Setup

cd backend

# Install dependencies
npm install

# Copy environment file
cp .env.example .env

# Update .env with your configuration
# DATABASE_URL=postgresql://user:pass@localhost:5432/sau_dev
# REDIS_URL=redis://localhost:6379

# Generate Prisma client
npm run prisma:generate

# Run database migrations
npm run prisma:migrate

# Start development server
npm run dev

Unity Setup

  1. Open Unity Hub and add the Unity folder
  2. Open the project with Unity 2023.2+
  3. Configure ServerUrl in GameManager to point to your backend
  4. Build and run

šŸ“ Project Structure

Social-Arcade-Universe/
ā”œā”€ā”€ SPEC.md                    # Detailed technical specification
ā”œā”€ā”€ backend/
│   ā”œā”€ā”€ src/
│   │   ā”œā”€ā”€ config/            # Configuration files
│   │   ā”œā”€ā”€ modules/           # Feature modules
│   │   │   ā”œā”€ā”€ auth/          # Authentication
│   │   │   ā”œā”€ā”€ user/          # User management
│   │   │   ā”œā”€ā”€ player/        # Player data
│   │   │   ā”œā”€ā”€ game/          # Game sessions
│   │   │   ā”œā”€ā”€ matchmaking/   # Matchmaking
│   │   │   ā”œā”€ā”€ social/        # Friends, Chat, Reels
│   │   │   ā”œā”€ā”€ economy/       # Currency, Shop
│   │   │   └── admin/         # Admin panel
│   │   ā”œā”€ā”€ shared/            # Shared utilities
│   │   ā”œā”€ā”€ websocket/         # Socket.io service
│   │   └── index.ts           # Entry point
│   ā”œā”€ā”€ prisma/
│   │   └── schema.prisma      # Database schema
│   ā”œā”€ā”€ package.json
│   ā”œā”€ā”€ tsconfig.json
│   ā”œā”€ā”€ Dockerfile
│   └── docker-compose.yml
│
ā”œā”€ā”€ Unity/
│   ā”œā”€ā”€ Assets/
│   │   ā”œā”€ā”€ Scripts/
│   │   │   ā”œā”€ā”€ Core/          # GameManager, Events
│   │   │   ā”œā”€ā”€ Networking/    # NetworkManager, Socket
│   │   │   ā”œā”€ā”€ Player/        # PlayerController, Stats
│   │   │   ā”œā”€ā”€ Game/          # Game modes, rules
│   │   │   ā”œā”€ā”€ AI/            # AI behaviors
│   │   │   ā”œā”€ā”€ Social/        # Friends, Reels
│   │   │   ā”œā”€ā”€ Economy/       # Currency, Shop
│   │   │   ā”œā”€ā”€ UI/            # Screens, Components
│   │   │   └── Utils/          # Helpers
│   │   ā”œā”€ā”€ Prefabs/
│   │   ā”œā”€ā”€ Resources/
│   │   └── Scenes/
│   ā”œā”€ā”€ Packages/
│   └── ProjectSettings/
│
└── README.md

šŸ”Œ API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login
  • POST /api/auth/refresh - Refresh token
  • POST /api/auth/logout - Logout

User

  • GET /api/users/me - Get current user
  • PUT /api/users/me - Update profile
  • GET /api/users/:id - Get user by ID

Player

  • GET /api/player/profile - Get player profile
  • GET /api/player/inventory - Get inventory
  • PUT /api/player/progress - Update progress

Game

  • GET /api/games/modes - Get game modes
  • POST /api/games/create - Create game
  • POST /api/games/:id/join - Join game

Social

  • GET /api/social/friends - Get friends
  • GET /api/social/chat/:roomId - Get chat messages
  • GET /api/reels - Get reels feed
  • POST /api/reels - Upload reel

Economy

  • GET /api/economy/balance - Get balance
  • GET /api/shop/items - Get shop items
  • POST /api/shop/purchase - Purchase item

Leaderboard

  • GET /api/leaderboard/global - Global leaderboard
  • GET /api/leaderboard/friends - Friends leaderboard

šŸŽ® WebSocket Events

Client → Server

  • join_matchmaking - Join matchmaking queue
  • join_lobby - Join game lobby
  • player_input - Send input data
  • position_update - Sync position
  • chat_message - Send chat message

Server → Client

  • match_found - Match found
  • game_started - Game starting
  • position_sync - Player position update
  • chat_message - New chat message
  • game_ended - Game over

šŸ”§ Configuration

Environment Variables

VariableDescriptionDefault
NODE_ENVEnvironmentdevelopment
PORTServer port3000
DATABASE_URLPostgreSQL connection-
REDIS_URLRedis connection-
JWT_SECRETJWT signing secret-
CLIENT_URLClient URLhttp://localhost:3001
AWS_S3_BUCKETS3 bucket for media-

🚢 Deployment

cd backend

# Update .env with production values
cp .env.example .env
# Edit .env

# Build and run
docker-compose up -d

Manual

  1. Build the backend:
cd backend
npm run build
  1. Run with PM2:
pm2 start dist/index.js --name sau-backend

Unity Build

  1. Open Unity project
  2. Go to File > Build Settings
  3. Select target platform (iOS/Android)
  4. Click Build

šŸŽØ UI Design System

The UI follows a modern Gen-Z aesthetic:

Colors

  • Primary: #6C5CE7 (Purple)
  • Secondary: #00CEC9 (Teal)
  • Accent: #FD79A8 (Pink)
  • Background: #0D0D1A (Dark)
  • Surface: #1A1A2E

Typography

  • Display: Poppins Bold
  • Headings: Poppins SemiBold
  • Body: Inter Regular

šŸ›”ļø Security

  • JWT-based authentication
  • Password hashing with bcrypt
  • Rate limiting on API endpoints
  • Input validation
  • SQL injection prevention (Prisma)
  • XSS protection

šŸ“Š Analytics

The system tracks:

  • User acquisition
  • Session events
  • Game performance
  • Purchase events
  • Social interactions

šŸ¤ Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

šŸ“„ License

MIT License - see LICENSE for details