Skip to content
rcade-communityPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Horses

horsing around

About RCade

This game is built for RCade, a custom arcade cabinet at The Recurse Center. Learn more about the project at github.com/fcjr/RCade.

Getting Started

Install dependencies:

npm install

Start the development server:

npm run dev

This launches Vite on port 5173 and connects to the RCade cabinet emulator.

Building

npm run build

Output goes to dist/ and is ready for deployment.

Project Structure

├── public/           # Static assets (copied as-is)
├── src/
│   ├── game.py       # Pygame game code
│   ├── main.js       # JavaScript entry point
│   └── style.css     # Styles
├── index.html        # HTML entry
├── vite.config.js    # Vite config with wheel bundling
├── rcade.manifest.json  # RCade game metadata
└── package.json

Adding Assets

Imported assets (recommended) - Place in src/ and import them in src/main.js. Vite bundles these with hashed filenames for cache busting:

import spriteUrl from './sprite.png';
import jumpSound from './jump.wav';

// Pass asset URLs to Python via globalThis
globalThis.assets = { spriteUrl, jumpSound };

Then access them in Python:

from js import assets

sprite = pygame.image.load(assets.spriteUrl)
sound = pygame.mixer.Sound(assets.jumpSound)

Static assets - Place in public/ for files copied as-is. Access via root path (/sprite.png).

Adding Python Dependencies

Add dependencies to the PEP 723 script metadata in src/game.py:

# /// script
# requires-python = ">=3.11"
# dependencies = [
#     "pygame-ce",
#     "numpy",
# ]
# ///

The build system automatically downloads wheels from the Pyodide package index. Only packages available in Pyodide are supported.

Arcade Controls

This template uses @rcade/plugin-input-classic for arcade input:

inputs = _get_input().to_py()

# Player 1
if inputs["p1"]["up"]: ...
if inputs["p1"]["down"]: ...
if inputs["p1"]["left"]: ...
if inputs["p1"]["right"]: ...
if inputs["p1"]["a"]: ...
if inputs["p1"]["b"]: ...

# Player 2
if inputs["p2"]["up"]: ...
if inputs["p2"]["a"]: ...
# ... same structure as p1

# System
if inputs["system"]["start_1p"]: ...
if inputs["system"]["start_2p"]: ...

Arcade Cabinet Controls

The game reads controls from @rcade/plugin-input-classic on the cabinet:

Control Action
1P START Start a one-player game or restart
2P START Start a two-player game or restart
Spinner Select board size before starting, or a legal knight move during play
D-PAD Select board size before starting, or a legal knight move during play
A BUTTON Confirm the selected move
B BUTTON Select the previous legal move

In one-player mode, Player 2 is controlled by the AI. In two-player mode, the second player's D-PAD, A, and B controls are used during Player 2's turn. Each player's spinner selects moves using its signed rotation direction.

Before starting, Player 1 can select a 4x4, 6x6, or 8x8 board. The default is 4x4.

Before starting a one-player game, Player 2's spinner or D-pad selects the AI mode. The default is RANDOM; the other option is SMART, which prefers moves that leave the AI with more future legal moves.

Spinner input comes from @rcade/plugin-input-spinners and is read using its accumulated step-delta API.

When running the Vite server outside the cabinet, keyboard fallback controls are available: 1/2 start games, Player 1 uses WASD + F/G, and Player 2 uses IJKL + ;/'.

Deployment

First, create a new repository on GitHub:

  1. Go to github.com/new
  2. Create a new repository (can be public or private)
  3. Don't initialize it with a README, .gitignore, or license

Then connect your local project and push:

git remote add origin git@github.com:YOUR_USERNAME/YOUR_REPO.git
git push -u origin main

The included GitHub Actions workflow will automatically deploy to RCade.


Made with <3 at The Recurse Center

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages