A complete RuneScape-inspired MMORPG where everything is AI-generated: items, mobs, lore, and world content. Based on a heavily modified version of [Hyperfy] (https://hyperfy.xyz/), a real-time 3D metaverse engine, with full multiplayer support and AI agent integration.
# Quick start - get playing in 3 steps:
npm install
npm run build
npm startThen open your browser to: http://localhost:5555
This is a real, playable RPG with:
- Complete RuneScape-style mechanics: Combat, skills, equipment, progression
- Real-time multiplayer: Multiple players in the same persistent world
- AI-powered content: Everything generated with GPT-4 and MeshyAI
- Human + AI agents: Both humans and AI can play together
- Full 3D world: Physics, collision detection, real-time networking
- No mocks or simulations: Real game code, real Hyperscape engine, real multiplayer
🗡️ Combat System
- Real-time auto-combat with RuneScape formulas
- Attack, Strength, Defense, Constitution skills
- Equipment requirements and damage calculations
- Ranged combat with arrows and bows
⛏️ Skills & Progression
- 9 skills total: Combat skills + Woodcutting + Fishing + Firemaking + Cooking
- RuneScape XP table and level progression
- Tool requirements and success rates
- Resource gathering and processing
🎒 Equipment & Items
- 3 tiers: Bronze → Steel → Mithril
- Weapons: Swords, Bows, Shields
- Armor: Leather to Mithril sets
- Tools: Hatchet, Fishing rod, Tinderbox
- Ammunition: Arrows required for ranged combat
🏰 World & Economy
- Persistent 3D world with starter towns
- Banking system with unlimited storage
- General stores selling tools and arrows
- Loot drops from defeated mobs
- Coins as universal currency
👥 Multiplayer & AI
- See other players moving and fighting in real-time
- ElizaOS AI agents can join and play alongside humans
- Shared world state with physics and collision
- Voice chat support via LiveKit
npm install # Install dependencies
npm run build # Build all packages
npm start # Start the RPG server- Open browser to
http://localhost:5555 - Your character spawns in a random starter town
- You start with a bronze sword and basic stats
🔰 Early Game (Levels 1-10)
- Find goblins (green cubes) near starter towns
- Click to attack - auto-combat begins
- Gain XP in Attack, Strength, Defense, Constitution
- Collect loot - coins and occasional equipment drops
- Visit general store - buy tools (hatchet, fishing rod, tinderbox)
⚔️ Mid Game (Levels 10-20)
- Chop trees with hatchet for Woodcutting XP and logs
- Fish at lakes with fishing rod for Fishing XP and raw fish
- Make fires with tinderbox and logs for Firemaking XP
- Cook fish on fires for Cooking XP and food (heals health)
- Fight stronger mobs - guards, barbarians, hobgoblins
🏆 Late Game (Level 20+)
- Steel equipment becomes available (level 10+ requirement)
- Venture to dangerous zones - fight dark warriors, black knights
- Mithril equipment from high-level areas (level 20+ requirement)
- Ranged combat - buy bows and arrows, requires arrows to attack
- Banking - store valuable items in town banks
- Movement: WASD keys or click-to-move
- Combat: Click on enemies to start auto-attack
- Interaction: Click on objects (trees, fish spots, banks, stores)
- Inventory: Drag and drop items, 28 slots total
- Equipment: Wear armor and weapons for stat bonuses
- Banking: Unlimited storage, separate bank per town
- Death: Drop all items at death location (headstone)
- Respawn: Appear at nearest starter town
- Item retrieval: Return to death location to collect items
- Strategy: Bank valuable items regularly!
This is a real monorepo with 5 packages:
hyperscape/
├── packages/hyperscape/ # 3D World Engine
│ ├── Core Hyperscape engine with physics, networking, scripting
│ ├── Entity Component System for game objects
│ └── Real-time multiplayer with WebSocket + LiveKit
├── packages/rpg/ # RuneScape-Style RPG
│ ├── Complete RPG system built as Hyperscape apps
│ ├── Player.hyp - Player character with stats/inventory
│ ├── RPGGoblin.hyp - AI-driven mobs with combat/loot
│ └── world/ - Configured world with terrain and entities
├── packages/generation/ # AI Content Creation
│ ├── GPT-4 for lore, descriptions, game content
│ ├── MeshyAI for 3D model generation and texturing
│ └── Automated asset pipeline for items/creatures
├── packages/test-framework/ # Visual Testing System
│ ├── Playwright browser automation for gameplay tests
│ ├── Screenshot analysis and pixel detection
│ └── No mocks - tests real game instances
└── packages/plugin-hyperscape/ # AI Agent Integration
├── ElizaOS plugin for AI agents to join game
├── All player actions available to AI
└── Agents can fight, gather, level, interact
- Hyperscape - Real-time 3D metaverse engine (Three.js + PhysX)
- ElizaOS - AI agent framework for autonomous players
- TypeScript - Type-safe development across all packages
- Three.js - 3D graphics and rendering
- PhysX - Physics simulation and collision detection
- LiveKit - Voice chat and WebRTC networking
- Playwright - Browser automation for comprehensive testing
- SQLite - Persistent database for player data and world state
npm testThis project uses real gameplay testing - no mocks, no simulations:
- Visual Testing: Screenshots verify entities render correctly
- Browser Automation: Playwright controls real game instances
- Pixel Analysis: Color detection confirms object positions
- System Integration: Tests real combat, skills, inventory, banking
- Multi-modal Verification: Data queries + visual confirmation
- ✅ Player spawning and character initialization
- ✅ Combat system (melee and ranged with arrows)
- ✅ Skill progression and XP calculations
- ✅ Inventory management and item pickup
- ✅ Equipment system and stat bonuses
- ✅ Resource gathering (woodcutting, fishing)
- ✅ Banking and storage systems
- ✅ Mob AI, aggression, and loot drops
- ✅ Death, respawning, and item retrieval
- ✅ Multiplayer synchronization
Both humans and AI agents can play together in the same world:
- Use web browser at
http://localhost:5555 - Standard WASD movement and mouse interaction
- Full UI with inventory, equipment, skills display
- Connect via ElizaOS with the Hyperscape plugin
- Same WebSocket connection as human players
- All player actions available: combat, gathering, trading, movement
- Agents can see world state and make autonomous decisions
- Combat: Attack mobs, use weapons, manage health
- Skills: Woodcutting, fishing, cooking, firemaking
- Navigation: Move to positions, follow entities
- Inventory: Pick up items, manage equipment, bank storage
- Social: Chat with other players, interact with NPCs
- Core RPG Systems: Combat, skills, inventory, equipment
- Real Hyperscape Integration: Actual .hyp apps, no mocks
- Multiplayer Support: Multiple players in shared world
- Visual Testing Framework: Comprehensive browser automation
- AI Agent Compatibility: ElizaOS integration working
- Performance Optimization: Build system, linting, TypeScript
This implementation strictly follows the Game Design Document:
- Exact 9 skills: Attack, Strength, Defense, Constitution, Ranged, Woodcutting, Fishing, Firemaking, Cooking
- 3 equipment tiers: Bronze (level 1+), Steel (level 10+), Mithril (level 20+)
- Arrow system: Arrows required and consumed for ranged combat
- Banking system: Unlimited storage per bank location
- MVP scope: Core mechanics without advanced features
- No player trading: Maintains MVP scope boundaries
- Complete skill set (20+ skills like RuneScape)
- Player trading and Grand Exchange economy
- Quest system with NPCs and storylines
- Player vs Player combat
- Clans, guilds, and social systems
- Dungeons and instanced content
- Advanced crafting and enchanting
npm install # Install all dependencies
npm run build # Build all packages
npm start # Start the RPG game server
npm test # Run comprehensive test suite
npm run lint # Code quality and style checks
npm run dev # Development mode with hot reloadbun run docs:generate # Generate API docs from TypeScript source
bun run docs:dev # Start documentation dev server (localhost:3000)
bun run docs:build # Build static documentation site
bun run docs:serve # Serve production docs build locally# Work with individual packages
npm run build --workspace=packages/hyperscape
npm run test --workspace=packages/rpg
npm run dev --workspace=packages/generationnpm test # All tests across packages
npm run test:rpg # RPG-specific tests
npm run test:visual # Visual/screenshot tests
npm run test:integration # End-to-end gameplay tests# Start development server with hot-reload
npm run dev
# OR
bun run dev
# This starts:
# - Shared package: Rebuilds automatically on changes (watch mode)
# - Server: ws://localhost:5555/ws (Auto-rebuilds on TS changes)
# - Client: http://localhost:3333 (Vite with HMR)
# The dev server will:
# ✅ Watch and rebuild shared package when files change
# ✅ Automatically rebuild when you change TypeScript files
# ✅ Restart the server after each rebuild
# ✅ Hot-reload client changes instantly via Vite
# ✅ Show colored logs for easy debugging
# Run specific packages in dev mode:
npm run dev:shared # Watch and rebuild shared package only
npm run dev:client # Client with Vite HMR
npm run dev:server # Server with auto-restart
npm run dev:all # All packages in watch modePort conflicts (3000/3000 in use):
lsof -ti:5555 | xargs kill -9
lsof -ti:5555 | xargs kill -9
npm startTests failing with connection errors:
pkill -f "hyperscape" # Kill any existing Hyperscape processes
npm testBuild errors after updates:
rm -rf packages/*/build packages/*/dist node_modules
npm install
npm run buildCharacter data reset:
# Remove world database to reset all player progress
rm packages/rpg/world/db.sqlite
npm start- Lower graphics: Use "Performance" mode in browser settings
- Close other tabs: Reduces memory usage for better framerate
- Restart server: If world becomes laggy, restart with
npm start - Clear browser cache: May help with asset loading issues
- API Documentation - Auto-generated TypeScript API docs (hosted on GitHub Pages)
- Documentation Setup Guide - How to generate and deploy documentation
- Game Design Document - Complete game mechanics and lore
- Hyperscape Documentation - Engine API reference
- RPG Package README - Implementation details
- Testing Guide - How testing works
- Entity Component System: How game objects are structured
- Real-time Networking: Multiplayer synchronization approach
- Visual Testing: Why we test with real gameplay, not mocks
- AI Agent Integration: How ElizaOS agents play alongside humans
git clone [repository-url]
cd hyperscape
npm install
npm run build
npm start
# Open browser to http://localhost:5555
# Click on green cubes (goblins) to fight and gain XP!This comprehensive guide covers production deployment to Cloudflare, database setup with Neon, authentication with Privy, Farcaster miniapp configuration, and mobile app deployment for iOS and Android.
- 1. Cloudflare CI/CD Setup
- 2. Neon PostgreSQL Database Setup
- 3. Privy Authentication Setup
- 4. Farcaster Miniapp Configuration
- 5. iOS App Deployment
- 6. Android App Deployment
- 7. Additional Secrets & Configuration
The project deploys two services to Cloudflare:
- Client: Cloudflare Pages (static frontend)
- Server: Cloudflare Workers/Containers (game server)
- Cloudflare account with Pages and Workers enabled
- GitHub repository connected to Cloudflare
- Wrangler CLI installed:
npm install -g wrangler
-
Create Cloudflare Account (if needed)
- Visit https://dash.cloudflare.com/sign-up
- Verify your email address
-
Get API Credentials
# Login to Cloudflare wrangler login # Get your Account ID wrangler whoami
- Copy your Account ID (displayed after login)
-
Generate API Token
- Go to https://dash.cloudflare.com/profile/api-tokens
- Click Create Token
- Use template: Edit Cloudflare Workers
- Permissions needed:
- Account → Workers Scripts → Edit
- Account → Pages → Edit
- Account → R2 → Edit (for assets)
- Create token and save it securely (shown only once)
Add the following secrets to your GitHub repository:
-
Navigate to Repository Settings
- Go to
https://github.com/YOUR_USERNAME/YOUR_REPO/settings/secrets/actions
- Go to
-
Add Required Secrets
# Cloudflare Credentials CLOUDFLARE_API_TOKEN=your_api_token_here CLOUDFLARE_ACCOUNT_ID=your_account_id_here # Cloudflare Projects CLOUDFLARE_PROJECT_NAME=hyperscape-client CLOUDFLARE_SERVER_NAME=hyperscape-server # Production URLs (set after first deploy) PRODUCTION_URL=https://hyperscape-client.pages.dev
The client already has packages/client/wrangler.toml. Update if needed:
name = "hyperscape-client"
compatibility_date = "2024-10-01"
pages_build_output_dir = "dist"
[env.production]
vars = { }Test deployment locally before using CI/CD:
# From packages/client
bun run build
wrangler pages deploy dist --project-name=hyperscape-client
# From packages/server
bun run build
wrangler deployThe project includes GitHub Actions workflows:
.github/workflows/ci.yml - Runs on every push/PR:
- Linting
- Testing
- Building all packages
- Docker image build
.github/workflows/deploy.yml - Manual deployment:
- Trigger via GitHub Actions UI
- Choose environment (staging/production)
- Deploys client and server to Cloudflare
To deploy:
- Go to Actions tab in GitHub
- Select "Deploy to Cloudflare"
- Click "Run workflow"
- Choose
stagingorproduction - Monitor deployment progress
After first deployment, configure environment variables:
For Client (Cloudflare Pages):
- Go to Cloudflare Dashboard → Pages → hyperscape-client
- Settings → Environment Variables
- Add for Production:
PUBLIC_WS_URL=wss://hyperscape-server.your-domain.workers.dev/ws PUBLIC_CDN_URL=https://pub-your-id.r2.dev PUBLIC_PRIVY_APP_ID=your-privy-app-id PUBLIC_ENABLE_FARCASTER=true PUBLIC_APP_URL=https://hyperscape-client.pages.dev
For Server (Cloudflare Workers):
- Use Wrangler CLI to set secrets:
cd packages/server # Database wrangler secret put DATABASE_URL # Enter: postgresql://username:password@host/database # Privy Auth wrangler secret put PRIVY_APP_SECRET wrangler secret put PRIVY_APP_ID # LiveKit (if using voice) wrangler secret put LIVEKIT_API_KEY wrangler secret put LIVEKIT_API_SECRET wrangler secret put LIVEKIT_URL # JWT Secret wrangler secret put JWT_SECRET
Neon provides serverless PostgreSQL perfect for Cloudflare Workers with its global edge network and auto-scaling.
-
Sign Up
- Visit https://console.neon.tech/signup
- Sign up with GitHub (recommended) or email
-
Create Project
- Click New Project
- Name:
hyperscape-production - Region: Choose closest to your users (US East, EU West, Asia)
- PostgreSQL version: 16 (latest)
- Click Create Project
-
Copy Connection String
- In Neon Console, go to your project
- Dashboard → Connection Details
- Copy the Connection String (pooled)
- Format:
postgresql://username:password@host.pooler.neon.tech/dbname?sslmode=require
-
Create Database Branches (Optional but recommended)
- Production Branch:
main(default) - Staging Branch: Create new branch for testing
- Each branch has its own connection string
- Production Branch:
Local Development (.env):
# packages/server/.env
DATABASE_URL=postgresql://user:pass@ep-xxx.us-east-2.aws.neon.tech/neondb?sslmode=require
USE_LOCAL_POSTGRES=falseGitHub Secrets:
# Production database
NEON_DATABASE_URL=postgresql://user:pass@host.neon.tech/neondb?sslmode=require
# Staging database (optional)
NEON_STAGING_URL=postgresql://user:pass@host-staging.neon.tech/neondb?sslmode=requireCloudflare Workers:
cd packages/server
# Production
wrangler secret put DATABASE_URL
# Paste Neon connection string
# Or via dashboard:
# Workers & Pages → hyperscape-server → Settings → VariablesThe server automatically runs migrations on startup, but you can run them manually:
cd packages/server
# Install Drizzle CLI globally (if needed)
npm install -g drizzle-kit
# Generate migrations from schema
bun run drizzle-kit generate
# Push schema directly to database
bun run drizzle-kit push
# Or use the built-in migration on server start
bun run start# Test connection
cd packages/server
bun run build
bun run start
# You should see:
# [DB] Initializing PostgreSQL with Drizzle...
# [DB] Connected to PostgreSQL
# [DB] Running migrations...
# [DB] Migrations completeRecommended Settings:
- Connection Pooling: Already included in pooled connection string
- Autoscaling: Enable in Project Settings → Compute
- Backups: Automatic, check Settings → Backups
- Monitoring: Enable in Settings → Integrations
- IP Allowlist: Not needed for Cloudflare Workers (they use connection pooler)
Privy provides embedded wallets and social login, including Farcaster authentication for the miniapp.
-
Sign Up
- Visit https://dashboard.privy.io/
- Sign up with email or GitHub
-
Create New App
- Click Create App
- App Name:
Hyperscape - Environment: Start with
Development
-
Enable Login Methods
- Dashboard → Configuration → Login Methods
- Enable:
- ✅ Email (basic auth)
- ✅ Wallet (Web3 auth)
- ✅ Farcaster (for miniapp) ⭐
- Save changes
-
Configure Farcaster
- Click Farcaster settings
- Enable Farcaster Miniapp SDK support
- Note: You'll need a Farcaster app registration (see Section 4)
-
Copy App ID
- Dashboard → Settings → App ID
- Format:
clxxxxxxxxxxxxxxxxxxxxxx - This is PUBLIC - safe to expose in client
-
Copy App Secret
- Dashboard → Settings → API Secrets
- Click Create Secret
- Copy and save securely (shown only once)
- This is PRIVATE - never expose in client
-
Add Allowed Origins
- Settings → Allowed Origins
- Add:
http://localhost:3333 http://localhost:5555 https://hyperscape-client.pages.dev https://your-custom-domain.com
-
Add Redirect URIs
- Settings → Redirect URIs
- Add:
http://localhost:3333/ http://localhost:5555/ https://hyperscape-client.pages.dev/ # For mobile apps hyperscape://oauth-callback
Client (packages/client/.env):
PUBLIC_PRIVY_APP_ID=clxxxxxxxxxxxxxxxxxxxxxxServer (packages/server/.env):
PRIVY_APP_ID=clxxxxxxxxxxxxxxxxxxxxxx
PRIVY_APP_SECRET=your_secret_hereGitHub Secrets:
PRIVY_APP_ID=clxxxxxxxxxxxxxxxxxxxxxx
PRIVY_APP_SECRET=your_secret_hereCloudflare:
# Client (Pages Environment Variables)
PUBLIC_PRIVY_APP_ID=clxxxxxxxxxxxxxxxxxxxxxx
# Server (Workers Secrets)
wrangler secret put PRIVY_APP_ID
wrangler secret put PRIVY_APP_SECRET-
Local Testing
bun run dev # Visit http://localhost:3333 # Try logging in with email or wallet
-
Verify Token
- Check browser DevTools → Application → Local Storage
- Look for
privy:tokenandprivy:session
Deploy Hyperscape as a Farcaster Frame v2 miniapp that runs inside the Warpcast client.
- Get Farcaster Account
- Download Warpcast app (iOS/Android)
- Create account or sign in
- You need at least 1 storage unit (~$7 worth of ETH on OP Mainnet)
-
Visit Farcaster Developer Console
-
Create New App
- Click Create App
- Fill in details:
Name: Hyperscape Description: AI-Generated RuneScape-Style MMORPG Icon: Upload your app icon (512x512 PNG) Website: https://hyperscape-client.pages.dev
-
Configure App Permissions
- Request permissions:
- ✅ Read user profile
- ✅ Post casts on behalf of user (optional)
- ✅ Read user's social graph (optional)
- Request permissions:
After registration, you'll receive:
# Farcaster App Keys
FC_APP_ID=your-farcaster-app-id
FC_APP_SECRET=your-farcaster-app-secret
FC_SIGNER_UUID=your-signer-uuidCreate or update frame manifest:
packages/client/public/frame-manifest.json:
{
"name": "Hyperscape",
"version": "1.0.0",
"iconUrl": "https://hyperscape-client.pages.dev/icon.png",
"splashImageUrl": "https://hyperscape-client.pages.dev/splash.png",
"splashBackgroundColor": "#000000",
"homeUrl": "https://hyperscape-client.pages.dev",
"frameUrl": "https://hyperscape-client.pages.dev",
"webhookUrl": "https://hyperscape-server.workers.dev/webhooks/farcaster"
}Client (.env):
PUBLIC_ENABLE_FARCASTER=true
PUBLIC_APP_URL=https://hyperscape-client.pages.dev
PUBLIC_FC_APP_ID=your-farcaster-app-idServer (.env):
FC_APP_SECRET=your-farcaster-app-secret
FC_SIGNER_UUID=your-signer-uuidGitHub Secrets:
FC_APP_ID=your-farcaster-app-id
FC_APP_SECRET=your-farcaster-app-secret
FC_SIGNER_UUID=your-signer-uuidCloudflare:
# Client environment variables
PUBLIC_ENABLE_FARCASTER=true
PUBLIC_FC_APP_ID=your-farcaster-app-id
# Server secrets
wrangler secret put FC_APP_SECRET
wrangler secret put FC_SIGNER_UUID-
Build and Deploy
# Ensure manifest is in public/ bun run build bun run deploy:prod -
Submit Frame to Farcaster
- Go back to Farcaster Developer Console
- Update app settings with deployed URL
- Submit for review
-
Test in Warpcast
- Open Warpcast app
- Search for your frame or use direct link
- Test all functionality
Configure deep links for sharing:
# Format
https://warpcast.com/~/add-frame-action?url=https://hyperscape-client.pages.dev/frame-manifest.json
# Share link
https://warpcast.com/~/hyperscapeBuild and deploy the iOS app using Capacitor for native iOS deployment via TestFlight and App Store.
- macOS computer (required for iOS development)
- Xcode 15+ installed
- Apple Developer Account ($99/year)
- Physical iOS device (for testing) or simulator
-
Enroll in Apple Developer Program
- Visit https://developer.apple.com/programs/
- Enroll ($99/year)
- Wait for approval (usually 24-48 hours)
-
Create App ID
- Go to https://developer.apple.com/account/
- Certificates, Identifiers & Profiles → Identifiers
- Click + → App IDs → Continue
- Fill in:
Description: Hyperscape Bundle ID: com.hyperscape.app (must match capacitor.config.ts) Capabilities: Enable Push Notifications, Associated Domains - Register
-
Create Provisioning Profiles
Development Profile:
- Profiles → + → Development
- Select App ID:
com.hyperscape.app - Select Certificates: Your development certificate
- Select Devices: Add your test devices
- Name:
Hyperscape Development - Download and install
Distribution Profile:
- Profiles → + → Distribution → App Store
- Select App ID:
com.hyperscape.app - Select Certificate: Your distribution certificate
- Name:
Hyperscape Distribution - Download and install
-
Open Project
cd packages/client bun run ios # This opens Xcode automatically
-
Configure Signing
- Select
Apptarget in Xcode - Signing & Capabilities tab
- Team: Select your Apple Developer team
- Bundle Identifier:
com.hyperscape.app(should match) - Automatically manage signing: ✅ Enabled
- Select
-
Update App Info
- Edit
ios/App/App/Info.plist:
<key>CFBundleDisplayName</key> <string>Hyperscape</string> <key>CFBundleShortVersionString</key> <string>1.0.0</string> <key>CFBundleVersion</key> <string>1</string>
- Edit
-
Configure Assets
- App Icon:
ios/App/App/Assets.xcassets/AppIcon.appiconset/ - Add 1024x1024 PNG icon
- Xcode will generate all sizes
- App Icon:
# Build and test on simulator
cd packages/client
bun run build
bun run cap:sync:ios
bun run ios
# In Xcode: Product → Run (Cmd+R)
# Choose device or simulator-
Archive Build
- In Xcode: Product → Archive
- Wait for build to complete
- Organizer window appears
-
Upload to App Store Connect
- Click Distribute App
- Select: App Store Connect
- Upload → Automatic signing
- Wait for upload (5-10 minutes)
-
Configure in App Store Connect
- Go to https://appstoreconnect.apple.com/
- My Apps → + → New App
- Fill in:
Platform: iOS Name: Hyperscape Primary Language: English Bundle ID: com.hyperscape.app SKU: hyperscape-ios-1 User Access: Full Access
-
Add to TestFlight
- App Store Connect → TestFlight
- Select your build (wait for processing, ~15 minutes)
- Add test information and review notes
- Submit for Beta Review
- Add Internal/External Testers
Create GitHub Action (.github/workflows/ios.yml):
name: iOS Build
on:
workflow_dispatch:
inputs:
environment:
description: 'Build environment'
required: true
type: choice
options:
- development
- production
jobs:
build:
name: Build iOS App
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build client
working-directory: packages/client
run: bun run build
env:
PUBLIC_WS_URL: ${{ secrets.PRODUCTION_WS_URL }}
PUBLIC_CDN_URL: ${{ secrets.PRODUCTION_CDN_URL }}
PUBLIC_PRIVY_APP_ID: ${{ secrets.PRIVY_APP_ID }}
- name: Sync Capacitor
working-directory: packages/client
run: bunx cap sync ios
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install certificates
env:
CERTIFICATE_BASE64: ${{ secrets.IOS_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.IOS_CERTIFICATE_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# Create keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
# Import certificate
echo "$CERTIFICATE_BASE64" | base64 --decode > certificate.p12
security import certificate.p12 -k build.keychain -P "$P12_PASSWORD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain
- name: Build iOS App
working-directory: packages/client/ios/App
run: |
xcodebuild -workspace App.xcworkspace \
-scheme App \
-configuration Release \
-archivePath App.xcarchive \
archive
- name: Export IPA
working-directory: packages/client/ios/App
run: |
xcodebuild -exportArchive \
-archivePath App.xcarchive \
-exportPath . \
-exportOptionsPlist ExportOptions.plist
- name: Upload to TestFlight
env:
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER_ID: ${{ secrets.APPLE_API_ISSUER_ID }}
APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
run: |
echo "$APPLE_API_KEY_BASE64" | base64 --decode > AuthKey.p8
xcrun altool --upload-app \
--type ios \
--file packages/client/ios/App/App.ipa \
--apiKey $APPLE_API_KEY_ID \
--apiIssuer $APPLE_API_ISSUER_IDRequired GitHub Secrets for iOS:
IOS_CERTIFICATE_BASE64 # Export .p12 cert as base64
IOS_CERTIFICATE_PASSWORD # Password for .p12
KEYCHAIN_PASSWORD # Temp keychain password
APPLE_API_KEY_ID # From App Store Connect
APPLE_API_ISSUER_ID # From App Store Connect
APPLE_API_KEY_BASE64 # API key .p8 as base64-
Prepare App Store Listing
- App Store Connect → My Apps → Hyperscape
- Version Information
- Screenshots (6.5", 6.7", 12.9" required)
- App Preview videos (optional)
- Description, keywords, support URL
-
Submit for Review
- Select build from TestFlight
- Fill in review information
- Submit for Review
- Wait for approval (1-3 days)
Build and deploy the Android app using Capacitor for Google Play Store distribution.
- Android Studio installed
- Google Play Developer Account ($25 one-time)
- Java JDK 17+ installed
-
Create Google Play Developer Account
- Visit https://play.google.com/console/signup
- Pay $25 one-time registration fee
- Fill in account details
- Wait for verification (24-48 hours)
-
Create New App
- Play Console → All apps → Create app
- Fill in:
App name: Hyperscape Default language: English (United States) App or game: Game Free or paid: Free - Accept declarations
- Create app
-
Update Build Configuration
packages/client/android/app/build.gradle:
android { namespace "com.hyperscape.app" compileSdkVersion 34 defaultConfig { applicationId "com.hyperscape.app" minSdkVersion 24 targetSdkVersion 34 versionCode 1 versionName "1.0.0" } signingConfigs { release { if (project.hasProperty('HYPERSCAPE_KEYSTORE_FILE')) { storeFile file(HYPERSCAPE_KEYSTORE_FILE) storePassword HYPERSCAPE_KEYSTORE_PASSWORD keyAlias HYPERSCAPE_KEY_ALIAS keyPassword HYPERSCAPE_KEY_PASSWORD } } } buildTypes { release { signingConfig signingConfigs.release minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } }
-
Create Signing Key
cd packages/client/android/app # Generate keystore keytool -genkey -v \ -keystore hyperscape-release-key.jks \ -alias hyperscape \ -keyalg RSA \ -keysize 2048 \ -validity 10000 # Enter details when prompted # SAVE THE PASSWORDS SECURELY!
-
Configure Gradle Properties
packages/client/android/gradle.properties:
HYPERSCAPE_KEYSTORE_FILE=./app/hyperscape-release-key.jks HYPERSCAPE_KEYSTORE_PASSWORD=your_keystore_password HYPERSCAPE_KEY_ALIAS=hyperscape HYPERSCAPE_KEY_PASSWORD=your_key_password
⚠️ Add to .gitignore:android/gradle.properties android/app/*.jks
cd packages/client
# Build
bun run build
# Sync to Android
bun run cap:sync:android
# Open Android Studio
bun run android
# In Android Studio:
# Build → Build Bundle(s) / APK(s) → Build APK
# Run on emulator or devicecd packages/client
# Build client
bun run build
# Sync Capacitor
bun run cap:sync:android
# Build release AAB
cd android
./gradlew bundleRelease
# Output: android/app/build/outputs/bundle/release/app-release.aab-
Create Release
- Play Console → Hyperscape → Testing → Internal testing
- Create new release
- Upload
app-release.aab - Release name:
1.0.0 (1) - Release notes:
Initial release: - Complete RuneScape-style gameplay - Real-time multiplayer - AI-generated content
-
Add Testers
- Create email list for internal testers
- Save and review release
- Start rollout to internal testing
-
Test Internal Build
- Testers receive email with opt-in link
- Download via Play Store
- Test thoroughly
Create GitHub Action (.github/workflows/android.yml):
name: Android Build
on:
workflow_dispatch:
inputs:
track:
description: 'Play Store track'
required: true
type: choice
options:
- internal
- alpha
- beta
- production
jobs:
build:
name: Build Android App
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build client
working-directory: packages/client
run: bun run build
env:
PUBLIC_WS_URL: ${{ secrets.PRODUCTION_WS_URL }}
PUBLIC_CDN_URL: ${{ secrets.PRODUCTION_CDN_URL }}
PUBLIC_PRIVY_APP_ID: ${{ secrets.PRIVY_APP_ID }}
- name: Sync Capacitor
working-directory: packages/client
run: bunx cap sync android
- name: Decode keystore
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
run: |
echo "$ANDROID_KEYSTORE_BASE64" | base64 --decode > packages/client/android/app/release-key.jks
- name: Build AAB
working-directory: packages/client/android
env:
HYPERSCAPE_KEYSTORE_FILE: ./app/release-key.jks
HYPERSCAPE_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
HYPERSCAPE_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
HYPERSCAPE_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: ./gradlew bundleRelease
- name: Upload to Play Store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
packageName: com.hyperscape.app
releaseFiles: packages/client/android/app/build/outputs/bundle/release/app-release.aab
track: ${{ inputs.track }}
status: completedRequired GitHub Secrets for Android:
ANDROID_KEYSTORE_BASE64 # Base64 encoded .jks file
ANDROID_KEYSTORE_PASSWORD # Keystore password
ANDROID_KEY_ALIAS # Key alias (hyperscape)
ANDROID_KEY_PASSWORD # Key password
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON # Service account JSON for Play Store API-
Store Listing
- App details
- Short description (80 chars)
- Full description (4000 chars)
- Screenshots (minimum 2, up to 8)
- Feature graphic (1024x500)
- App icon (512x512)
-
Content Rating
- Complete questionnaire
- Select: Game → Fantasy Violence
- Get ESRB/PEGI ratings
-
App Category
- Category: Games → Role Playing
- Tags: RPG, Multiplayer, Adventure
-
Pricing & Distribution
- Free app
- Select countries
- Content guidelines: Accept
-
Create Production Release
- Testing → Promote release to Production
- Or create new production release
- Upload AAB
- Roll out to 100%
-
Submit for Review
- Review summary
- Submit for review
- Wait for approval (1-7 days)
Add all these to https://github.com/YOUR_USERNAME/YOUR_REPO/settings/secrets/actions:
Cloudflare:
CLOUDFLARE_API_TOKEN
CLOUDFLARE_ACCOUNT_ID
CLOUDFLARE_PROJECT_NAME
CLOUDFLARE_SERVER_NAME
PRODUCTION_URLDatabase (Neon):
NEON_DATABASE_URL
NEON_STAGING_URL
DATABASE_URL # For CI testsAuthentication (Privy):
PRIVY_APP_ID
PRIVY_APP_SECRETFarcaster:
FC_APP_ID
FC_APP_SECRET
FC_SIGNER_UUIDiOS Deployment:
IOS_CERTIFICATE_BASE64
IOS_CERTIFICATE_PASSWORD
KEYCHAIN_PASSWORD
APPLE_API_KEY_ID
APPLE_API_ISSUER_ID
APPLE_API_KEY_BASE64Android Deployment:
ANDROID_KEYSTORE_BASE64
ANDROID_KEYSTORE_PASSWORD
ANDROID_KEY_ALIAS
ANDROID_KEY_PASSWORD
GOOGLE_PLAY_SERVICE_ACCOUNT_JSONOptional Services:
LIVEKIT_API_KEY # Voice chat
LIVEKIT_API_SECRET
LIVEKIT_URL
OPENAI_API_KEY # AI generation (if using)
MESHY_API_KEY # 3D model generation-
Create R2 Bucket
wrangler r2 bucket create hyperscape-assets
-
Enable Public Access
- Cloudflare Dashboard → R2 → hyperscape-assets
- Settings → Public Access → Allow
- Copy Public Bucket URL:
https://pub-xxxxx.r2.dev
-
Upload Assets
cd packages/server bun run assets:deploy # Or manually with Wrangler wrangler r2 object put hyperscape-assets/models/sword.glb --file=./assets/models/sword.glb
-
Update CDN URLs
# Client environment PUBLIC_CDN_URL=https://pub-xxxxx.r2.dev # Server environment PUBLIC_CDN_URL=https://pub-xxxxx.r2.dev
For Cloudflare Pages (Client):
- Dashboard → Pages → hyperscape-client → Custom domains
- Add domain:
play.yourgame.com - Add DNS records (automatic)
- Wait for SSL certificate (5-10 minutes)
For Cloudflare Workers (Server):
- Dashboard → Workers & Pages → hyperscape-server → Settings → Domains & Routes
- Add custom domain:
api.yourgame.com - Update DNS
- Update WebSocket URL in client:
wss://api.yourgame.com/ws
Add to Cloudflare:
- Enable Web Analytics for Pages
- Enable Workers Analytics
- Set up Logpush for debugging
- Configure alerts for errors
Add to GitHub:
- Enable Dependabot for security updates
- Enable CodeQL for code scanning
- Configure branch protection rules
Development:
NODE_ENV=development
PUBLIC_WS_URL=ws://localhost:5555/ws
PUBLIC_CDN_URL=http://localhost:8080
DATABASE_URL=postgresql://localhost/hyperscape_devStaging:
NODE_ENV=staging
PUBLIC_WS_URL=wss://staging-api.yourgame.com/ws
PUBLIC_CDN_URL=https://staging-cdn.yourgame.com
DATABASE_URL=postgresql://staging.neon.tech/hyperscape_stagingProduction:
NODE_ENV=production
PUBLIC_WS_URL=wss://api.yourgame.com/ws
PUBLIC_CDN_URL=https://cdn.yourgame.com
DATABASE_URL=postgresql://prod.neon.tech/hyperscape- Never commit secrets to git
- Rotate secrets regularly (quarterly)
- Use different secrets for dev/staging/prod
- Enable 2FA on all service accounts
- Review access logs monthly
- Keep dependencies updated with Dependabot
- Use environment-specific API keys
- Limit secret access to necessary team members only
MIT License - Feel free to use this project as inspiration for your own AI-powered games.
🎮 Ready to explore the AI-generated world of Hyperscape?
Run npm start and open http://localhost:5555 to begin your adventure!
Fight goblins, master skills, discover an AI-crafted world, and play alongside autonomous AI agents in this unique take on classic RuneScape gameplay.