arcade-cli
v1.0.5
Published
A cli tool for initializing an arcade.h project
Readme
Arcade CLI
A command-line tool for initializing retro 2D game projects using the ARCADE (Awesome Rendering Control And Dynamics Engine) library, a lightweight, single-header C library for Windows (Win32) and Linux (X11). Compatible with Arcade IDE version 1.1.0 and above.
Features
- Initializes a game project with
arcade.hand STB dependencies (stb_image.h,stb_image_write.h,stb_image_resize2.h). - Creates a
main.cwith a beginner-friendly demo (move a red square with arrow keys, display text, play background music). - Generates a cross-platform
Makefilefor Windows (gdi32,winmm) and Linux (X11,libm) with normalized paths. - Includes a
.gitignorefor clean version control. - Supports a
-b/--blankflag for minimal projects with basic setup (library headers, emptymain.c,Makefile). - Features an interactive UI with ASCII art, colored output, progress spinners, and configuration prompts.
- Automatically downloads
background_music.wavfrom the ARCADE repository for the demo project. - Generates an
arcade.config.jsonfile to store project metadata (game name, version, etc.). - Validates assets and provides clear error messages for network issues or missing dependencies.
Installation
Prerequisites
- Node.js: Version 16+ (recommended for compatibility).
- gcc: Required for compiling game projects.
- Windows: MinGW with
gdi32andwinmmlibraries (e.g., via MSYS2). - Linux: X11 development libraries (
libx11-dev,libm). - Internet Connection: Required to fetch
arcade.h, STB headers, andbackground_music.wavfrom GitHub.
Install Arcade CLI
Install globally via npm:
npm install -g arcade-cliThe CLI is installed to your global npm directory, typically:
- Linux:
~/.npm-global/bin/arcade - Windows:
%APPDATA%\npm\arcade
Verify the installation:
arcade --helpAdditional Setup
Install Build Dependencies:
- Windows: Install MinGW via MSYS2:
Add MinGW’spacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-makebin/to your system PATH. - Linux (Ubuntu/Debian): Install build tools and X11 libraries:
sudo apt-get install build-essential libx11-dev
- Windows: Install MinGW via MSYS2:
Install Node.js Dependencies (if running locally): If you’re running the CLI from source (not globally installed), install dependencies:
npm install commander axios fs-extra chalk ora figlet
Getting Started
Initialize a Project:
- Create a full game project with a demo:
arcade init my-game - Create a blank project (library headers, empty
main.c,Makefile):arcade init my-lib -b
- Create a full game project with a demo:
Answer Configuration Prompts:
- The CLI will prompt for:
- Game Name (default: project name)
- Version (default:
1.0.0) - Binary Name (default:
game) - Main Source File (default:
main.c) - Icon Path (optional)
- Author (optional)
- Description (optional)
- These details are saved in
arcade.config.json.
- The CLI will prompt for:
Build and Run (for full projects):
cd my-game make make runExplore
main.c:- The demo in
main.cincludes:- A red square movable with arrow keys.
- A start screen with "Press Space to Start".
- Background music (
assets/background_music.wav) played during gameplay. - Detailed comments for beginners.
- Modify
main.cto add sprites, logic, or assets. See the ARCADE Wiki for documentation.
- The demo in
Usage
Initialize a new ARCADE project:
arcade init <app-name> [-b, --blank]Options
-b, --blank: Create a minimal project with library headers, an emptymain.c, and a basicMakefile.
Examples
Full game project:
arcade init my-game cd my-game make make runBlank project:
arcade init my-lib -b cd my-lib # Add your own game logic to main.c make
Project Structure
Full Project
my-game/
├── arcade/
│ ├── arcade.h
│ ├── stb_image.h
│ ├── stb_image_write.h
│ ├── stb_image_resize2.h
├── assets/
│ ├── background_music.wav
├── main.c
├── Makefile
├── .gitignore
├── arcade.config.jsonBlank Project (-b)
my-lib/
├── arcade/
│ ├── arcade.h
│ ├── stb_image.h
│ ├── stb_image_write.h
│ ├── stb_image_resize2.h
├── assets
├── main.c
├── Makefile
├── .gitignore
├── arcade.config.jsonRequirements
- Node.js: Version 16+.
- gcc: For compiling game projects.
- Windows: MinGW with
gdi32andwinmmlibraries. - Linux: X11 development libraries (
libx11-dev,libm). - Node.js Dependencies:
commander,axios,fs-extra,chalk,ora,figlet.
Install dependencies if running locally:
npm install commander axios fs-extra chalk ora figletTroubleshooting
- "arcade: command not found":
- Ensure the global npm bin directory is in your PATH:
- Linux:
export PATH=~/.npm-global/bin:$PATH - Windows: Add
%APPDATA%\npmto your system PATH.
- Linux:
- Ensure the global npm bin directory is in your PATH:
- Network Errors:
- Verify your internet connection, as the CLI fetches assets from GitHub.
- Check GitHub status (https://www.githubstatus.com/) for outages.
- Build Errors:
- Ensure
gccand platform-specific libraries (gdi32,winmmfor Windows;libx11-dev,libmfor Linux) are installed.
- Ensure
- Missing
background_music.wav:- The CLI fetches this file from the ARCADE repository. Ensure the repository is accessible.
Contributing
See CONTRIBUTING.md for guidelines on contributing to Arcade CLI.
License
MIT License. See LICENSE for details.
Contact
Have questions or ideas? Open an issue on GitHub, join our GitHub Discussions, or email the maintainer at [email protected].
