A Rails application that provides an API for game design and development automation. GameAutoMakeServer is a platform for AI-assisted game creation, compilation, and publishing.
GameAutoMakeServer enables users to:
- Create game projects with AI assistance
- Compile games into different formats (HTML, WebGL)
- Publish games and track scores
The platform serves as the backend for QuickPlayArcade and provides APIs for game design, customization, and score tracking.
The system uses AI to help users create games through:
- Chat conversations with AI consultants
- Game generation with AI developers
Games can be compiled into different formats:
- HTML games (standard, stable, nightly, demo)
- Future support for WebGL games
The platform includes a powerful Game Customization Service that provides AI-powered capabilities to modify existing HTML games or generate new ones based on natural language requests. This service follows a multi-stage pipeline:
- Game Design Document Reconstruction
- HTML5 Game Modification Export
- Theme Design Generation
- Game Icon Prompt Generation
- Game Icon Generation (using DALL-E)
The platform includes a scoring system for published games:
- Tracks scores across different client terminals
- Maintains leaderboards for games
The application is built around several key data models:
- User: Handles authentication, authorization, and manages user profiles
- GameProject: Central entity for game creation, connects to conversations for AI assistance
- GameCompile: Transforms game specifications into playable games
- Conversation/Dialog: Enable AI-assisted game design through structured interactions
- HtmlGameCompile: Specific compilation type for HTML games
- PublishedGame: Manages game publishing
- ScoreBoardScore: Tracks game scores and maintains leaderboards
app/models/
: Contains all data modelsapp/models/concerns/
: Shared model behaviorsapp/models/game_project.rb
: Game project modelapp/models/user.rb
: User modelapp/models/current.rb
: Current user context
app/controllers/
: Contains all controllersapp/controllers/published_games_controller.rb
: Manages published games
app/views/
: Contains all view templatesapp/views/game_projects/
: Game project viewsapp/views/dialogs/
: Dialog views
db/migrate/
: Database migration filesdb/schema.rb
: Database schema
config/
: Application configurationconfig/environments/
: Environment-specific configurations
lib/
: Custom libraries and moduleslib/patch_platform.rb
: Platform-specific patches
The Quick Play Arcade API is built using the Grape framework and is mounted at the root path with /v1
and /v2
prefixes. The API interacts with several key data models including ClientTerminal
, ScoreBoard::Score
, and PublishedGame
.
POST /v2/customize_game
: Modifies an existing game based on uploaded assets and a natural language requestPOST /v2/generate_game
: Creates a new game based on a natural language description
GET /v1/register_device
: Registers a new device and returns a token for subsequent API calls
GET /v1/top_scores/:game_id
: Retrieves the top 10 scores for a specific gamePOST /v1/device/upload_score
: Records a new score for a game from a specific devicePOST /v1/device/scores
: Retrieves a device's personal scores for a specific game
GameAutoMakeServer provides comprehensive Android integration for deploying HTML games to Android devices with features for content management, game patching, score tracking, and customization.
The Android::HotPatchGame model allows HTML games to be packaged and deployed to Android devices with the ability to update them without requiring a full app update through app stores.
- Name: The game's display name
- Icon: The game's app icon (attached file)
- Splash: Optional splash screen image (attached file)
- HTML: The game's HTML content (attached file)
- Groups: Comma-separated list of groups/tags associated with the game
Hot patch games follow a workflow that includes creation, review, and publication:
- Creation: Games can be created by admins or regular users
- Review Status: Non-admin uploads are marked as pending-review
- Approval: Admins can review and approve games by removing the pending-review tag
The Android integration includes a JavaScript API called Platform that is injected into HTML games to provide a bridge between the game and Android-specific functionality:
Method | Return Type | Description |
---|---|---|
majorVersion() | number | Returns the platform API major version (currently 1) |
minorVersion() | number | Returns the platform API minor version |
setHighestScore(score) | void | Saves the highest score for the current game |
getHighestScore() | number | Gets the previously saved highest score |
getSoundVolume() | number | Gets the device sound volume setting (0-100) |
getProferredDifficulty() | number | Gets the player's preferred difficulty (0=easy, 1=medium, 2=hard, 3=no preference) |
The PatchPlatform injects the Platform API into HTML games through these steps:
- Parse HTML with Nokogiri
- Inject Platform API script
- Add version compatibility check
- Return patched HTML file
The system includes a testing interface for Android-specific services:
- Upload an HTML game file
- Provide a natural language request for changes
- Specify a system prompt and AI model
- Submit for processing and receive a customized game
This allows testing how game customization will work in the Android environment without deploying to actual devices.
The PatchPlatform service allows for patching HTML games to include platform-specific functionality:
- Modifies HTML games for compatibility with different platforms
- Includes JavaScript stubs for platform integration (like score tracking)
- Prepares games for deployment to Android devices
- Ruby 3.3.7
- Node.js 22.2.0
- Yarn 1.22.22
- Redis 7.2.5
- PostgreSQL
- Install the gems with
bundle install
- Install the node modules with
yarn install
- Set up the database with
bin/rails db:setup
This project supports development using VS Code Dev Containers, which provides a consistent development environment across different machines.
- Install VS Code and the Dev Containers extension
- Clone this repository to your local machine
- Open the project folder in VS Code
- When prompted to "Reopen in Container", click "Reopen in Container", or use the command palette (F1) and select "Dev Containers: Reopen in Container"
- VS Code will build the development container and configure the environment according to the specifications in
.devcontainer/devcontainer.json
- Once the container is ready, you'll have a full development environment with all dependencies installed
The dev container automatically:
- Installs Ruby 3.3 and required gems
- Sets up Node.js and Yarn
- Configures Redis server
- Forwards port 3000 for web access
Once inside the development container:
-
Start the Rails server:
bin/rails server -b 0.0.0.0
-
Or use the development Procfile to start both the Rails server and any background processes:
bin/dev
The application will be available at http://localhost:3000
You can also run the application using Docker with the included Dockerfile:
-
Build the Docker image:
docker build -t game-auto-make-server .
-
Run the container:
docker run -p 3000:3000 -e POSTGRES_HOST=your_postgres_host -e RAILS_MASTER_KEY=your_master_key game-auto-make-server
For production deployments, make sure to:
- Set appropriate environment variables
- Configure a database
- Set the
RAILS_MASTER_KEY
environment variable
Run the test suite with:
bin/rails test
We welcome contributions to the GameAutoMakeServer project. Please follow these guidelines:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request