Skip to main content

A simple game example using Raylib Python bindings

Project description

Player

You can play this game on the web at http://electronstudio.github.io/raylib-example-game . Works on mobile devices!

You can download binary releases for Windows, Macos and Linux from https://github.com/electronstudio/raylib-example-game/releases/latest

You can install this game from pypi:

uv tool install raylib-example-game
raylib-example-game

Developer

Python Implementation

This project defaults to PyPy 3.11 for improved runtime performance. To switch to CPython:

uv sync --python python3.13

Raylib Backend

This project uses raylib_sdl instead of the standard raylib package for enhanced controller and gamepad compatibility.

If you prefer to use the standard Raylib backend, you can switch by updating the dependency:

# Remove raylib_sdl and add standard raylib
uv remove raylib_sdl
uv add raylib

Backend Comparison:

  • raylib_sdl: Better controller/gamepad support, SDL backend
  • raylib: Standard Raylib backend, potentially faster for basic graphics

The API is identical between both packages - no code changes are needed when switching.

Setup

Install uv from https://docs.astral.sh/uv/getting-started/installation/

# Clone the repository
git clone https://github.com/yourusername/raylib-example-game.git
cd raylib-example-game

# Install in development mode
uv sync

# Run the game
uv run raylib-example-game

Building the package

# Build wheel and source distribution
uv build

Binary Compilation with Nuitka

uv run build-binary

Creating Releases:

# Tag and push to create a release with binaries
git tag v1.0.0
git push upstream v1.0.0

Important: The workflow requires contents: write permission to create GitHub releases. If release creation fails with a 403 error, check your repository's Actions permissions under Settings → Actions → General → Workflow permissions.

Web Build with pygbag

Build for web deployment using pygbag:

# Build for web and start local server
uv run build-web

# Build for web only (no server)
uv run build-web --build

Github Actions automatically deploys the game to GitHub Pages on push to master.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raylib_example_game-0.3.0-py3-none-any.whl (80.8 kB view details)

Uploaded Python 3

File details

Details for the file raylib_example_game-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for raylib_example_game-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8007405beeac83463ddfb77885998b7091215c0aeeeb9a6ceca1cb834d651fbf
MD5 8453ff919d75dc90b3684a48a5c99f47
BLAKE2b-256 0d69ec55afd7b629a8c30843b23c1db201ce0bb2c6b7357963e43c80f65da13d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page