Introduction

About ARCADE

ARCADE is a comprehensive gaming platform designed for entrepreneurs who want to launch their own profitable gaming website. Built with modern web technologies, ARCADE provides everything you need to create an engaging gaming community with advanced social features.

The platform combines traditional gaming functionality with innovative features like a virtual chatroom, real-time social interactions, and comprehensive admin tools to help you manage and grow your gaming business.

Key Highlights

🎯

Virtual Environment

Revolutionary virtual chatroom with animated characters and real-time interactions

🎮

Multi-Format Games

Support for HTML5 games, Flash games and Roms with built-in emulation

👥

User Community

Complete user management with social login, rankings, and achievements

📊

Admin Dashboard

Professional admin interface with analytics and content management

High Performance

Optimized caching and image processing for fast loading times

🔒

Secure & Scalable

Built-in security features and scalable architecture

Requirements

⚠️ Important Note

A VPS or dedicated server is highly recommended. Shared hosting might work but will be severely limited due to the real-time features.

Required Software

The following software components must be installed on your server:

  • Node.js - Version 20.19 LTS or higher
  • MySQL - Version 5.7 or higher
  • Nginx - For reverse proxy and static file serving
  • PM2 - For process management (optional but highly recommended)

Upload Requirements

To upload the ARCADE platform files to your server, you'll need:

  • FTP/SFTP Client - FileZilla, WinSCP, or similar
  • SSH Access - For command line operations
  • Root/Sudo Access - For installing dependencies

⚠️ Important Security Note

Ensure your server has proper firewall configuration and only necessary ports are open.

Installation

Step 1: Upload Files

Upload the ARCADE files to your server using FTP/SFTP:

  1. Connect to your server via FTP/SFTP
  2. Navigate to your web root directory (usually /var/www/html)
  3. Upload all the contents of Install folder to the server

Step 2: Set File Permissions

Connect to your server via SSH and set proper file permissions:

# Navigate to your ARCADE directory
cd /path/to/arcade

# Set proper permissions
chmod -R 777 .
                    

Step 3: Install Dependencies

Install all required Node.js modules:

# Install all dependencies from package.json
npm install

# If you encounter permission issues, use:
sudo npm install
                    

Step 4: Database Setup

Create your MySQL database through cPanel:

  1. Log into your hosting control panel (cPanel)
  2. Navigate to MySQL Databases section
  3. Create a new database (e.g., arcade_db)
  4. Create a database user with a secure password
  5. Assign the user to the database with ALL PRIVILEGES
  6. Note down your database name, username, and password for the .env file

📝 Important Note

The database schema will be automatically imported when you run npm run deploy

Step 5: Run Deployment Setup

ARCADE provides two deployment options for your convenience:

🧪 Recommended: Test First with Simulation

Before running the actual deployment, we strongly recommend testing your configuration with the deployment simulation:

# Test your deployment configuration safely
npm run deploy:simulate

This simulation will validate your inputs and show you exactly what the deployment will do without making any actual changes to your system.

# After testing with simulation, run the actual deployment
npm run deploy

📝 Have Ready

Before running the deployment, make sure you have ready:

  • Site name and description for your platform
  • Admin account details (username, name, email, password)
  • Database credentials from Step 4 (host, name, username, password)
  • Server port (default: 3000)

Step 6: Start the Application

Start ARCADE using one of these methods:

# Method 1: Direct start (for testing)
npm start

# Method 2: Using PM2 (recommended for production)
npm install -g pm2
pm2 start app.js --name "Arcade"
pm2 save
pm2 startup
                    

🎉 Installation Complete!

Your ARCADE platform is now ready for use! The system has been fully configured and is operational.

Security & Performance Configuration

ARCADE includes comprehensive security and performance settings that can be customized in your .env file:

🛡️ Rate Limiting Configuration

Protect your platform from abuse with configurable rate limiting:

# General API rate limiting (for /requests/ endpoints)
RATE_LIMIT_WINDOW_MS=900000          # 15 minutes window
RATE_LIMIT_MAX_REQUESTS=1000         # 1000 requests per window

# Authentication rate limiting (for login, register, password reset)
AUTH_RATE_LIMIT_WINDOW_MS=900000     # 15 minutes window
AUTH_RATE_LIMIT_MAX=5                # 5 attempts per window
  • General Rate Limiting: Protects API endpoints from spam and abuse
  • Authentication Rate Limiting: Prevents brute force attacks on login forms
  • Window Duration: Time window in milliseconds (900000 = 15 minutes)

📦 Body Size Limits

Configure upload limits for optimal performance and security:

# Body Size Limits
BODY_SIZE_LIMIT=100mb                # Form data upload limit
JSON_SIZE_LIMIT=10mb                 # JSON payload limit
  • Body Size Limit: Maximum size for file uploads (games, images, etc.)
  • JSON Size Limit: Maximum size for API JSON requests
  • Gaming Platform Optimized: 100MB limit supports large game files

⚙️ Configuration Tips

  • • Adjust rate limits based on your expected traffic volume
  • • Lower authentication limits for better security
  • • Increase body size limits if you need to support larger game files
  • • Restart the application after changing .env configuration

Automatic Setup

⚠️ WARNING!

This automatic setup guide is completely optional. Only follow this guide at your own risk! We will not provide support regarding this automatic setup!

The autosetup.sh script provides complete automation for Ubuntu 24.04 VPS deployment. This fully automated script handles MySQL 8.0, Node.js 20 LTS, Nginx with SSL, database creation, and Arcade platform deployment with zero manual configuration required.

Requirements

  • Ubuntu 24.04 LTS - Fresh VPS installation without any pre-installed software
  • Root or Sudo Access - Required for system package installation
  • Domain Name - For SSL certificate generation via Let's Encrypt

Installation Steps

Follow these steps to deploy Arcade with full automation:

  1. Configure DNS Records

    Point your domain to your VPS IP address using A records:

    A | @ | YOUR_SERVER_IP
    A | www | YOUR_SERVER_IP
  2. Upload Arcade Files

    Use FTP client (like Filezilla) to upload all Arcade installation files to the /home directory on your VPS.

  3. Connect via SSH

    Login to your VPS using SSH with root or sudo privileges.

  4. Update System Packages

    Update the system to ensure all packages are current:

    sudo apt -y update && sudo apt -y upgrade
  5. Run Auto Setup Script

    Execute the automated installation script:

    cd /home && ./autosetup.sh
  6. Follow Interactive Prompts

    The script will prompt for your domain name. All passwords and database credentials are auto-generated securely. Installation typically completes in 10-15 minutes.

🚀 What Gets Automatically Installed?

  • MySQL 8.0: Complete installation with secure configuration
  • Node.js 20 LTS: Latest stable runtime with PM2 process manager
  • Nginx: Reverse proxy with security headers and optimization
  • SSL Certificate: Let's Encrypt with auto-renewal setup
  • Database: Arcade database and user creation with secure credentials
  • Application: Full deployment with migrations and asset compilation
  • Firewall: UFW configuration for production security

Updates

Update Process

Updating your ARCADE platform to the latest version is simple and preserves all your data:

  1. Create a backup of your existing installation
  2. Upload and replace all files (except .env file)
  3. Install dependencies: npm install
  4. Build assets: npm run build
  5. Run migration command: npm run migrate:up
  6. Restart the application

🔄 Smart Migration System

The migration system automatically detects your current version and applies only the necessary database updates while preserving all existing data, settings, and user accounts.

⚠️ Important Notes

  • • Never replace the .env file - it contains your unique configuration
  • • The migration system is backward compatible with all versions
  • • All existing games, users, and settings remain intact
  • • New features are automatically enabled after update

Backup Considerations

Before updating, create backups of:

  • Database (MySQL dump)
  • .env configuration file
  • uploads/ directory (user content and games)
  • cache/ directory (optional, can be regenerated)
# Create database backup
mysqldump -u username -p database_name > backup_$(date +%Y%m%d).sql

# Create file backups
cp .env .env.backup
tar -czf uploads_backup_$(date +%Y%m%d).tar.gz uploads/

Troubleshooting Updates

If you encounter issues during updates:

# Check migration status
npm run migrate:status

# View detailed migration information
npm run migrate

🚨 Common Issues

  • Permission errors: Ensure proper file permissions (chmod -R 777)
  • Migration failures: Check database connection in .env file
  • Application won't start: Verify Node.js dependencies with npm install
  • Missing features: Ensure all migrations completed successfully

User Management System

User Registration & Authentication

ARCADE provides multiple ways for users to register and authenticate:

📧

Email Registration

Traditional email/password registration with email verification

📘

Facebook Login

OAuth integration with Facebook for quick registration

🔍

Google Login

OAuth integration with Google for seamless login

User Profiles & Social Features

Each user gets a comprehensive profile with social features:

  • Profile Customization - Avatar, bio, and personal information
  • Game Statistics - Playing history, favorite games, and achievements
  • Social Connections - Follow other players and build friendships
  • Privacy Settings - Control profile visibility and data sharing

Experience Points & Ranking System

Keep players engaged with a comprehensive progression system:

🎮 XP Earning Activities

  • • Daily login bonuses
  • • Playing games and achieving scores
  • • Social interactions (comments, ratings)
  • • Completing challenges and achievements
  • • Weekend multiplier events

Admin User Management

Comprehensive admin tools for managing your user base:

Feature Description Admin Control
User Accounts View and manage all user accounts Edit, suspend, delete
User Roles Assign different permission levels Admin, moderator, user
Activity Monitoring Track user engagement and behavior View logs, statistics

Game Management System

Multi-Format Game Support

ARCADE supports multiple game formats to maximize your content library:

🌐

HTML5 Games

Upload ZIP files containing HTML5 games with automatic extraction

Flash Games

Built-in emulator for legacy Flash (SWF) games

🎮

ROM Games

Retro gaming with built-in emulators for classic console systems

🔗

External Games

Link to games hosted on external websites

Game Upload Process

Simple and intuitive game upload workflow:

  1. Access the admin dashboard and navigate to Games section
  2. Choose upload method (ZIP file, SWF file, ROM file, or external URL)
  3. Fill in game details (title, description, category, tags)
  4. Upload game thumbnail (automatically optimized)
  5. System processes and publishes the game automatically

Game Categories & Organization

Organize your games effectively with a robust categorization system:

  • Custom Categories - Create unlimited game categories
  • Tag System - Flexible tagging for detailed organization
  • Search & Filter - Advanced search capabilities
  • Featured Games - Highlight popular or new games

Virtual Chatroom System

Revolutionary Social Experience

ARCADE's most unique feature is its groundbreaking chatroom system that sets it apart from traditional gaming platforms. Players can interact in a fully immersive virtual environment with animated characters.

🥷

Character Selection

Choose from Fighter, Ninja, or Samurai characters with unique animations. More characters to be added in the future!

🎭

Live Animations

Real-time character animations including attacks, movements, and idle states

💬

Real-time Chat

Instant messaging system with emoji support and moderation tools

Character Animation System

Each character comes with a complete set of animations:

  • Idle State - Breathing and subtle movements when standing
  • Walking & Running - Smooth movement animations
  • Combat Moves - Multiple attack animations and defense poses
  • Directional Support - Left and right facing animations

Real-time Communication

Advance communication system:

💬 Chat Features

  • • Instant message delivery
  • • User presence indicators
  • • Message history and persistence
  • • Emoji and reaction support

Admin Dashboard

Dashboard Overview

The ARCADE admin dashboard is a comprehensive control center built with Node.js, Express, and EJS templating. It provides complete administrative control over your gaming platform with role-based access control, real-time analytics, and advanced content management capabilities.

📈

Real-time Analytics

Live statistics with 5-minute caching and performance metrics

🎮

Game Management

Upload, organize, and manage HTML5/Flash games

👥

User Administration

Complete user management with roles and permissions

📝

Content Management

Create pages, manage categories, and moderate content

⚙️

System Configuration

Site branding, feature toggles, and system settings

📧

Communication Hub

Email logs, notifications, and user engagement

🏠 Main Dashboard (Overview)

The main dashboard provides a comprehensive overview of your platform's performance:

📊 Key Statistics (Real-time)

  • Total Users - Active user count with growth indicators
  • Game Library - Total games and category distribution
  • Total Plays - Platform-wide game play statistics
  • Community Activity - Comments, follows, and social interactions
  • Category Performance - Most popular game categories
  • Top Games - Most played and highest rated games
  • Recent Activity - New users and game comments
  • Search Analytics - Popular search queries and trends

👥 User Management System

Comprehensive user administration with advanced controls:

Feature Location Capabilities
User Accounts /dashboard/users View, edit, activate/deactivate user accounts
Role Management User Profile Modal Assign admin/user roles and permissions
User Analytics Dashboard Overview Registration trends, country distribution, activity
Verification Status User Management Email verification and account status tracking

🎮 Advanced Game Management

Professional game library administration with multi-format support:

📁

Game Library

Complete game management with activation controls

📂

Category System

Organize games with custom categories and icons

🖼️

Media Processing

Automatic thumbnail optimization and WebP conversion

📊

Performance Analytics

Play counts, ratings, and engagement metrics

Game Upload Process:
1. Access: /dashboard/games
2. Upload Methods:
   • HTML5 Games: ZIP file upload with automatic extraction
   • Flash Games: .SWF file upload with Ruffle emulator
   • ROM Games: Retro console ROMs with built-in emulators
   • External Games: URL linking with iframe support
3. Automatic Processing:
   • Thumbnail generation and optimization
   • WebP conversion for faster loading
   • Metadata extraction and validation
   • Game slug generation for SEO
4. Configuration:
   • Game details (title, description, tags)
   • Category assignment
   • Activation status
   • Featured game settings
                    

🎯 Game Importer

The platform includes a powerful game importer system that allows import of games with automatic processing and categorization. This feature streamlines the process of adding large game libraries to your platform.

Key Features:

  • Automatic detection and identification
  • Upload processing with ZIP file extraction
  • Automatic thumbnail generation and image optimization
  • Smart category assignmente

🔑 Purchase Code Required

Important: The Game Importer feature requires a valid purchase code to unlock and use!

  • Navigate to Dashboard → System Settings
  • Enter your purchase code in the designated field
  • Save the settings to activate the importer functionality

The Game Importer will always be visible in the dashboard navigation, but attempting to use it without a valid purchase code will display an error message and prevent access to the import functionality.

📝 Content Management Suite

Professional content management with moderation tools:

  • Custom Pages - Create and manage custom pages with SEO optimization
  • Comment Moderation - Approve, edit, or remove user comments
  • Category Management - Create categories with Heroicons and custom colors
  • Media Library - Organize and optimize images and game assets

🏆 Experience & Gamification System

Advanced user engagement and progression system:

🎯

EXP Events

Configure experience point awards for user actions

🏅

Rank System

Create and manage user levels and requirements

🏆

Game Scores

Track and validate individual game scores

📊

Leaderboards

Manage global and per-game leaderboards

⚡ EXP System Configuration

  • Daily Login Bonus - Configurable XP rewards
  • Game Play Rewards - Points for playing games
  • Social Actions - XP for comments, follows, ratings
  • Achievement Unlocks - Bonus XP for milestones
  • Weekend Multipliers - Special event bonuses
  • Level Progression - Custom requirements and rewards

📊 Analytics & Reporting Dashboard

Comprehensive analytics with real-time data and historical trends:

Analytics Feature Data Tracked Business Value
User Growth New registrations, active users, retention rates Measure platform growth and user engagement
Game Performance Play counts, ratings, time spent, completion rates Identify popular content and optimize game library
Search Analytics Popular search terms, query trends, result clicks Understand user intent and content gaps
Social Engagement Comments, follows, ratings, shares Track community health and user interactions
Category Performance Category popularity, game distribution, trends Optimize content organization and discovery

🔍 Advanced Search & Filter System

Powerful search capabilities throughout the dashboard:

  • Search Query Analytics - Track what users are searching for
  • Dashboard Search - Quick search across all dashboard tables
  • Advanced Filters - Filter by date, status, category, user type
  • Export Capabilities - Export filtered data to CSV/Excel

📧 Communication & Monitoring

Comprehensive monitoring and communication tools:

📧

Email Logs

Track all email delivery and notification status

Cron Job Monitoring

Monitor scheduled tasks and system maintenance

❤️

User Favorites

Track user game preferences and recommendations

👥

Social Follows

Monitor user connections and social network

⚠️ Dashboard Access Requirements

Dashboard access requires admin-level permissions. Only users with admin role can access the dashboard. All dashboard operations are logged and monitored for security purposes.

Game API

Important Notice

HTML5 Only

This API exclusively supports uploaded HTML5 games. External embed URLs will not function due to cross-origin security restrictions and will result in errors.

Please upload your HTML5 games directly to ensure compatibility

Game API Overview

ARCADE provides a comprehensive JavaScript API that allows HTML5 and embed games to interact with the platform. Since games are loaded through iframes on the ARCADE platform, the API uses the parent object to communicate between the game (child iframe) and the main platform (parent window). Game developers should include these API calls directly in their game's index.html file.

API Availability Requirements

The Game API is only available for HTML5 game type. Additionally, the game must have the API enabled flag set in the admin dashboard. Flash games and ROMs do not support the API.

🖼️ Iframe Architecture

Games run inside secure iframes on the ARCADE platform. This architecture provides security isolation while allowing controlled communication through the parent object. All API functions are available on the parent window and can be called from within your game's JavaScript code.

🏆

Score Submission

Submit scores with automatic personal best detection and notifications

📊

Leaderboard Access

Retrieve real-time leaderboard data and user rankings

👤

User Information

Access current user data and authentication status

🎯

Personal Records

Fetch user's best scores and track improvement

📢

Advertisement API

Display targeted ads with automatic placement optimization

🏆

Score Submission API

Submit player scores with automatic validation and leaderboard integration

// Submit a score for the current game
parent.__arcadeSubmitScore(score, scoreData)

Parameters:
• score (number, required): The player's score (must be positive)
• scoreData (object, optional): Additional score metadata

Example Usage:
// Basic score submission
await parent.__arcadeSubmitScore(1500);

// Score with additional data
await parent.__arcadeSubmitScore(2300, {
    level: 5,
    difficulty: "hard",
    playTime: 120
});

Response Format:
{
    status: 200/401/500,
    message: "Success message or error description",
    data: {
        scoreId: number,
        isPersonalBest: true/false,
        previousBest: number,
        expAwarded: number
    }
}

// Status Codes:
// 200: Score submitted successfully
// 401: Authentication required (triggers login popup)
// 500: Server error or validation failed
                    

✨ Automatic Features

  • • Personal best detection
  • • Experience points (EXP) awarded based on score
  • • Leaderboard refresh if available
  • • Real-time notifications to followers
  • • Score popup for unauthenticated users

⚠️ API Restrictions

  • • Only works for HTML5 game type
  • • Game must have API enabled in admin settings
  • • Authentication required for score submission
  • • Score must be a positive number
📊

Leaderboard Access API

Retrieve leaderboard data for displaying rankings within your game

// Get leaderboard for a game
parent.__arcadeGetLeaderboard(gameId, limit)

Parameters:
• gameId (number, optional): Game ID (auto-detected if not provided)
• limit (number, optional): Number of entries to return (default: 10)

Example Usage:
// Get top 10 scores for current game
const leaderboard = await parent.__arcadeGetLeaderboard();

// Get top 20 scores for specific game
const leaderboard = await parent.__arcadeGetLeaderboard(123, 20);

Response Format:
{
    success: true/false,
    data: {
        leaderboard: [
            {
                user_id: 1,
                username: "PlayerName",
                high_score: 5000,
                rank_position: 1,
                submitted_at: "2024-01-15T10:30:00Z",
                avatar_url: "avatar_url"
            },
            // ... more entries
        ],
        count: 10
    },
    error: "Error message if failed"
}
                    

🚀 Features

  • • Real-time leaderboard data
  • • User avatars and profiles
  • • Current user highlighting
  • • Automatic caching for performance
  • • Pagination support
🎯

Personal Best API

Access user's personal best scores for progress tracking

// Get user's best score for a game
parent.__arcadeGetUserBest(gameId)

Parameters:
• gameId (number, optional): Game ID (auto-detected if not provided)

Example Usage:
// Get user's best score for current game
const userBest = await parent.__arcadeGetUserBest();

// Get user's best score for specific game
const userBest = await parent.__arcadeGetUserBest(123);

Response Format:
{
    success: true/false,
    data: {
        bestScore: 2500,
        totalScores: 12,
        rank: 15,
        totalPlayers: 156
    },
    error: "Error message if failed"
}

// Authentication required (401 if not logged in)
                    

🎯 Use Cases

  • • Display personal best on game start
  • • Show user's ranking among all players
  • • Track total number of score submissions
  • • Compare with other players (totalPlayers)
  • • Historical performance analysis

📝 API Requirements

  • • User must be authenticated
  • • Game must support API (HTML5/embed only)
  • • Returns null/0 values if no scores submitted
👤

User Information API

Access current user data and authentication status

// Get current user information
parent.__arcadeGetUser()

Parameters: None

Example Usage:
const userInfo = parent.__arcadeGetUser();

if (userInfo.success) {
    console.log('User is logged in:', userInfo.user.username);
} else {
    console.log('User not authenticated');
}

Response Format:
{
    success: true/false,
    user: {
        id: 123,
        username: "PlayerName",
        email: "player@example.com",
        avatar: "avatar_url",
        level: 5,
        experience: 1250,
        rank: "Bronze",
        joinDate: "2024-01-01T00:00:00Z",
        isAdmin: false,
        preferences: {
            notifications: true,
            publicProfile: true
        }
    },
    error: "User not authenticated"
}
                    

🎯 Use Cases

  • • Personalize game experience
  • • Check authentication status
  • • Display user avatar and name
  • • Customize difficulty based on level
  • • Show appropriate UI elements
🖼️

Iframe Integration Setup

How to integrate the Game API into your HTML5 game's code

Why use `parent.` prefix?

Your game runs inside an iframe on the ARCADE platform. To access the platform's API functions, you must use parent.__arcadeSubmitScore() instead of calling functions directly.

// 1. BASIC SCORE SUBMISSION
// Call this when your game ends to save the player's score
function gameEnded(playerScore) {
    parent.__arcadeSubmitScore(playerScore)
        .then(result => {
            if (result.success) {
                console.log('Score saved successfully!');
                
                // Check if this was a new personal best
                if (result.data.isPersonalBest) {
                    alert('New Personal Best: ' + playerScore);
                }
                
                // Show EXP earned
                console.log('EXP earned:', result.data.expAwarded);
            }
        })
        .catch(error => {
            console.error('Failed to save score:', error);
            // Game should still work even if score saving fails
        });
}

// 2. GET PLAYER'S BEST SCORE
// Call this when your game starts to show previous best score
async function loadPlayerData() {
    try {
        const userBest = await parent.__arcadeGetUserBest();
        
        if (userBest.success && userBest.data.bestScore > 0) {
            // Display the player's previous best score
            document.getElementById('best-score-display').textContent = 
                'Your Best: ' + userBest.data.bestScore;
                
            console.log('Player rank:', userBest.data.rank);
            console.log('Total players:', userBest.data.totalPlayers);
        } else {
            // First time playing this game
            document.getElementById('best-score-display').textContent = 
                'First time playing!';
        }
    } catch (error) {
        console.error('Could not load player data:', error);
        // Continue without showing best score
    }
}

// 3. GET CURRENT USER INFO
// Check if someone is logged in and get their info
function checkUserStatus() {
    const userInfo = parent.__arcadeGetUser();
    
    if (userInfo.success) {
        // User is logged in
        console.log('Logged in as:', userInfo.user.username);
        document.getElementById('welcome-message').textContent = 
            'Welcome back, ' + userInfo.user.username + '!';
    } else {
        // User is not logged in (guest)
        console.log('Playing as guest');
        document.getElementById('welcome-message').textContent = 
            'Playing as Guest - Login to save scores!';
    }
}

// 4. COMPLETE GAME FLOW EXAMPLE
function startGame() {
    // Check user status when game starts
    checkUserStatus();
    
    // Load their previous best score
    loadPlayerData();
    
    // Your game logic here...
    console.log('Game started!');
}

// When your game ends, save the score
function endGame(finalScore) {
    console.log('Game ended with score:', finalScore);
    
    // Only try to save score if it's a valid number
    if (typeof finalScore === 'number' && finalScore >= 0) {
        gameEnded(finalScore);
    }
}

// Start your game
startGame();
                    

📝 Implementation Checklist

  • Always use `parent.` - API functions are on the parent window, not your game window
  • Handle errors gracefully - Use try/catch blocks so your game works even if API fails
  • Validate scores - Only submit positive numbers as scores
  • Call at the right time - Submit scores when game actually ends, not during gameplay
  • Test with guests - Make sure your game works for non-logged-in users
🎮

Complete Implementation Examples

Real-world examples showing how to integrate the API in your game's index.html

// Example 1: Basic Score Submission (in your game's index.html)
function gameOver(finalScore) {
    // Call through parent because game runs in iframe
    parent.__arcadeSubmitScore(finalScore)
        .then(result => {
            if (result.success) {
                if (result.data.isPersonalBest) {
                    showCelebration("New Personal Best!");
                } else {
                    showMessage("Score Saved!");
                }
            }
        })
        .catch(error => {
            console.error("Score submission failed:", error);
            // Game should still work if API is unavailable
        });
}

// Example 2: Display Leaderboard in Game UI
async function showLeaderboard() {
    try {
        // Access parent window API from iframe
        const leaderboard = await parent.__arcadeGetLeaderboard(null, 10);
        
        if (leaderboard.success) {
            const html = leaderboard.data.map((entry, index) => `
                
#${entry.rank} ${entry.username} ${entry.score.toLocaleString()}
`).join(''); document.getElementById('leaderboard').innerHTML = html; } } catch (error) { console.error("Failed to load leaderboard:", error); // Show fallback message or hide leaderboard } } // Example 3: Game Initialization with User Data async function initializeGame() { try { // Get user info from parent window (iframe -> parent communication) const userInfo = parent.__arcadeGetUser(); const userBest = await parent.__arcadeGetUserBest(); if (userInfo.success) { document.getElementById('welcome').textContent = `Welcome back, ${userInfo.user.username}!`; if (userBest.success && userBest.data.score > 0) { document.getElementById('best-score').textContent = `Your Best: ${userBest.data.score.toLocaleString()}`; } } else { document.getElementById('welcome').textContent = "Play as Guest (Login to save scores)"; } } catch (error) { console.error("Failed to initialize user data:", error); // Game should work without user data } } // Example 4: Safe API Check (recommended pattern) function safeAPICall(apiFunction, ...args) { try { // Check if parent window and API function exist if (parent && parent[apiFunction]) { return parent[apiFunction](...args); } else { console.warn(`API function ${apiFunction} not available`); return Promise.resolve({ success: false, error: 'API not available' }); } } catch (error) { console.error(`Error calling ${apiFunction}:`, error); return Promise.resolve({ success: false, error: error.message }); } } // Usage of safe API call async function submitScoreSafely(score) { const result = await safeAPICall('__arcadeSubmitScore', score); if (result.success) { console.log('Score submitted successfully'); } }
⚠️

API Restrictions & Requirements

Important limitations and requirements for using the Game API

🚫

Game Type Restrictions

  • HTML5 Games Only - API only works with HTML5 (.zip) games
  • Flash Games Not Supported - SWF files cannot use the API
  • ROM Games Not Supported - Emulated games cannot use the API
  • API Must Be Enabled - Admin must enable API for each game

Support & Maintenance

Getting Help

Multiple support channels are available for ARCADE users:

💬

Community Forum

User community and peer support

Visit Forum →
🎫

Support Tickets

Direct technical support

Get Support →