Skip to main content

Pyroquad Game Engine


This is a Python game engine based on macroquad.

  • Install via pip install pyroquad (in the browser: micropip.install("pyroquad"))
  • Requires Python >= 3.9
  • Supported Platforms: windows, linux, mac, and WASM via Piodide.

Featuring 2D:

view the demo here

2D Screenshot

and 3D:

3D Screenshot

How to run in the browser:

place this code inside a .html file and open in the browser.

<style>#glcanvas { width: 800px !important; height: 600px !important; display: block; } </style>
<canvas id="glcanvas" width="800" height="600"></canvas>
<pre id="out"></pre>

<script type="module">
import { loadPyodide } from "https://cdn.jsdelivr.net/pyodide/v314.0.3/full/pyodide.mjs";

const out = document.getElementById("out");
const print = t => out.textContent += t + "\n";

const pyodide = await loadPyodide({ stdout: print, stderr: print });
await pyodide.loadPackage("micropip");
const micropip = pyodide.pyimport("micropip");
await micropip.install("pyroquad");

await pyodide.runPythonAsync(`
from pyroquad import *

activate_engine()

while True:
   draw_rectangle(x=100, y=100, w=600, h=300, color=Color.GREEN)
   draw_text(text="Hello rectangle", x=200, y=200, font_size=50, color=Color.RED)
   next_frame()
   examples.limit_fps(60)
`).catch(e => print(e));
</script>

How to build:

  1. Prerequesites:

    • Python >= 3.9 ( python >= 3.14 is recommended)

    • Rust Compiler >= 1.85.0 (Required for the Rust 2024 Edition)

    • System libraries if using Linux (required for X11, OpenGL, and audio bindings):

      Ubuntu / Debian: sudo apt-get install -y libasound2-dev libx11-dev libxi-dev libgl1-mesa-dev libxcursor-dev libxinerama-dev libxrandr-dev

      Fedora: sudo dnf install alsa-lib-devel libX11-devel libXi-devel mesa-libGL-devel libXcursor-devel libXinerama-devel libXrandr-devel

      Arch Linux: sudo pacman -S alsa-lib libx11 libxi mesa libxcursor libxinerama libxrandr

  2. Create and activate a Python virtual environment:

    • macOS / Linux:

      python3 -m venv .venv

      source .venv/bin/activate

    • Windows:

      python -m venv .venv

      .venv\Scripts\activate

  3. Install the maturin build tool using pip install maturin

  4. Compilation:

    run maturin build --release --features abi_39 --generate-stubs for python >= 3.9

    run maturin build --release --features abi_310 --generate-stubs for python >= 3.10

    run maturin build --release --features abi_314 --generate-stubs for python >= 3.14

    (Note: Older ABIs offer better backward compatibility, but newer versions yield performance improvements)

  5. Installation:

    • The generated package can be found at: /target/wheels/
    • Install the package: pip install \path\to\your\file.whl --force-reinstall

How to build for the browser (WebAssembly):

In addition to the prerequisites above:

  • the wasm32-unknown-emscripten target: rustup target add wasm32-unknown-emscripten
  • pip install "pyodide-build>=0.39" "maturin>=1.13.2" — pyodide-build does not run natively on Windows, so build the wheel on Linux, macOS or WSL
  • the Emscripten SDK, at the version pyodide config get emscripten_version reports. No emsdk_env activation needed: emcc is looked up via $EMCC, $EMSDK, the project-local emsdk/, then PATH.
  • a browser with JSPI (JavaScript Promise Integration) — Chrome 137+. That is what lets synchronous Python (while True: ... next_frame()) hand the page back between frames.
pyodide xbuildenv install 314.0.7   # the Pyodide that --features abi_314 targets
python web/get_pyodide.py           # fetch that runtime into web/pyodide/ (once)

CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUSTFLAGS="$(pyodide config get rustflags)" \
MATURIN_PYEMSCRIPTEN_PLATFORM_VERSION="$(pyodide config get pyodide_abi_version)" \
PYO3_CROSS_PYTHON_VERSION=3.14 \
 maturin build --release --target wasm32-unknown-emscripten --out dist --features abi_314

python web/build_web.py   # stage dist/*wasm32.whl for the test page
python web/serve.py       # http://127.0.0.1:8000/web/index.html?script=tests/test_rec.py

The flags go in CARGO_TARGET_<TARGET>_RUSTFLAGS, never a bare RUSTFLAGS: this crate has a build.rs, which is compiled for the host.

For any Agents reading this:

Please refer to AI.md for best practice and an entrypoint into the engine.

Example Code:

Hello rectangle

from pyroquad import *

activate_engine()

while True:
    draw_rectangle(x=100, y=100, w=600, h=300, color=Color.GREEN)
    draw_text(text="Hello rectangle", x=200, y=200, font_size=50, color=Color.RED)
    next_frame()
    examples.limit_fps(60)

Textures

from pyroquad import *

activate_engine()

texture =  Loading.download_file(
    "https://raw.githubusercontent.com/Ludwig-000/pyroquad/main/docs/PyroquadLogo.png"
).to_Texture2D()

while True:
    draw_texture(texture)
    next_frame()
    examples.limit_fps(60)

Cube

from pyroquad import *

activate_engine()

cube = Cube(
    position=Vec3.ZERO,
    rotation=Vec3.ZERO,
    scale=Vec3.ONE,
    color=Color.RED)

cam = Camera3D(position=Vec3.splat(2), target=Vec3.ZERO)

while True:
    cam.set_camera()
    cube.rot += get_delta_time()
    draw_all_objects()
    next_frame()
    examples.limit_fps(60)

Skybox

from pyroquad import *

activate_engine()


skybox_tex = examples.loading_screen_future(
    lambda a: download_file_future(a),
    ["https://raw.githubusercontent.com/Ludwig-000/pyroquad/main/tests/HDR_blue_nebulae_2.png"],
    show_rotating_square=True
)[0].to_Texture2D()

player = examples.PlayerCamera(position=Vec3.ONE)

while True:
    if KeyCode.Escape in get_keys_pressed():
        break

    player.update()
    draw_skybox(skybox_tex)
    draw_grid(
        slices=1_000,
        spacing=1.0,
        axes_color=Color.YELLOW,
        other_color=Color.GREEN)

    next_frame()
    examples.limit_fps(60)

Multiple windows

import multiprocessing
from pyroquad import *

def task(message, color_name):
    activate_engine()
    prevent_quit()
    color = getattr(Color, color_name)
    
    while not is_quit_requested():
        clear_background(color)
        draw_text(message, 200, 200, Color.GREEN, 60)
        next_frame()
        examples.limit_fps(60)

if __name__ == "__main__":
    seq_data = [("multiple", "YELLOW"), ("windows", "BRICK"), ("using", "ORANGE")]
    for msg, color in seq_data:
        p = multiprocessing.Process(target=task, args=(msg, color))
        p.start()
        p.join()

    procs = [multiprocessing.Process(target=task, args=("multiprocessing", "BLUE")) for _ in range(5)]
    for p in procs: p.start()
    for p in procs: p.join()

Rectangle deletes itself (heartbreaking)

from pyroquad import *

activate_engine()

re = Rectangle(Vec2.splat(200), 0, Vec2.splat(100), Color.WHITE)

timer  = 120
def t(rec: Rectangle):
    global timer, re
    timer-= 1
    if timer == 0:
        del(re)
    rec.draw()

re.tick(t)

while True:
    next_frame()
    examples.limit_fps(60)

Metadata

Release files for pyroquad 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pyroquad 0.2.1
File Actions
pyroquad-0.2.1-cp314-abi3-win_amd64.whl CPython 3.14 abi3 Windows x86-64 Details for pyroquad-0.2.1-cp314-abi3-win_amd64.whl
pyroquad-0.2.1-cp314-abi3-pyemscripten_2026_0_wasm32.whl CPython 3.14 abi3 PyEmscripten 2026.0+ WebAssembly Details for pyroquad-0.2.1-cp314-abi3-pyemscripten_2026_0_wasm32.whl
pyroquad-0.2.1-cp314-abi3-manylinux_2_28_x86_64.whl CPython 3.14 abi3 Linux glibc 2.28+ x86-64 Details for pyroquad-0.2.1-cp314-abi3-manylinux_2_28_x86_64.whl
pyroquad-0.2.1-cp314-abi3-macosx_11_0_arm64.whl CPython 3.14 abi3 macOS 11.0+ ARM64 Details for pyroquad-0.2.1-cp314-abi3-macosx_11_0_arm64.whl
pyroquad-0.2.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for pyroquad-0.2.1-cp310-abi3-win_amd64.whl
pyroquad-0.2.1-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for pyroquad-0.2.1-cp310-abi3-manylinux_2_28_x86_64.whl
pyroquad-0.2.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for pyroquad-0.2.1-cp310-abi3-macosx_11_0_arm64.whl
pyroquad-0.2.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for pyroquad-0.2.1-cp39-abi3-win_amd64.whl
pyroquad-0.2.1-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details for pyroquad-0.2.1-cp39-abi3-manylinux_2_28_x86_64.whl
pyroquad-0.2.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for pyroquad-0.2.1-cp39-abi3-macosx_11_0_arm64.whl

Total release size: 52.1 MB

Release files / pyroquad-0.2.1-cp314-abi3-win_amd64.whl

Download URL pyroquad-0.2.1-cp314-abi3-win_amd64.whl
Size 5.1 MB
Tags CPython 3.14 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
584daf99401702c489cbea93aef1facf94be6077cf1e755358093b47c53c1540
BLAKE2b-256 checksum
How to use checksums
1291d6652b5f8494d3d21a77f3fe111bc440658298713608dcef6a326738bae4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

Release files / pyroquad-0.2.1-cp314-abi3-pyemscripten_2026_0_wasm32.whl

Download URL pyroquad-0.2.1-cp314-abi3-pyemscripten_2026_0_wasm32.whl
Size 2.2 MB
Tags CPython 3.14 PyEmscripten 2026.0+ WebAssembly abi3
SHA-256 checksum
How to use checksums
39e3826eb71566b3f0c376d539bd93daa2b8c24c543ae4bed7913c73488888c9
BLAKE2b-256 checksum
How to use checksums
b389e645d4442302c56ce2e17a072af3d9e2bd88767ff80b37ba1bd686a22007
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

Release files / pyroquad-0.2.1-cp314-abi3-manylinux_2_28_x86_64.whl

Download URL pyroquad-0.2.1-cp314-abi3-manylinux_2_28_x86_64.whl
Size 6.3 MB
Tags CPython 3.14 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
36f283084ab5cc439be8989e2b81ff12451bda104a6b7526e62594c7f145d975
BLAKE2b-256 checksum
How to use checksums
3d3f860c0dc7248342ad16762ef4334b1b3d0f9caad0bff705a811034eda522b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

Release files / pyroquad-0.2.1-cp314-abi3-macosx_11_0_arm64.whl

Download URL pyroquad-0.2.1-cp314-abi3-macosx_11_0_arm64.whl
Size 5.2 MB
Tags CPython 3.14 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
42bc803d0ba4ff47dd5d1663eb77b0f6b2b3648c2d4c4a564cd24508e908e169
BLAKE2b-256 checksum
How to use checksums
d58d9ef2d8e14a0947a2ddf48cb50d9467180a00d9e118b24b2e2091e1d67857
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

Release files / pyroquad-0.2.1-cp310-abi3-win_amd64.whl

Download URL pyroquad-0.2.1-cp310-abi3-win_amd64.whl
Size 5.1 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
5b75bfd9e47719a04d9fdf921291e94c87b9096b7847f9a379340004f1e7bb4c
BLAKE2b-256 checksum
How to use checksums
432b0be03cbd9c6464f6929e6cc82aa2c0195b17a8965b1903e5c187826ce3a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

Release files / pyroquad-0.2.1-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL pyroquad-0.2.1-cp310-abi3-manylinux_2_28_x86_64.whl
Size 6.3 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
04e846421b856be3233fce304d78920a9536fe29f9ccd04ad41adfaaf470529b
BLAKE2b-256 checksum
How to use checksums
a5aa82eb650aead427729bccf744308dfbda11e2820943695e8a6d78fe315af9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

Release files / pyroquad-0.2.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL pyroquad-0.2.1-cp310-abi3-macosx_11_0_arm64.whl
Size 5.3 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
eb902d89ba243b2dfeab3ebd9f94dfab9039228e57c099c5204885faf90065e8
BLAKE2b-256 checksum
How to use checksums
3246510c7264234de2f4b0fe9e4d67623370821d194391eb92648488756475ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

Release files / pyroquad-0.2.1-cp39-abi3-win_amd64.whl

Download URL pyroquad-0.2.1-cp39-abi3-win_amd64.whl
Size 5.1 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
c73bee0bc1bd5ddd782eaaf76171e32b9ad277d7e3538e46a3c62fab44bd27ff
BLAKE2b-256 checksum
How to use checksums
48ef7bd15b6564c34e514dc17d36763c65ad27346b53889627ffa5f855adb6d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

Release files / pyroquad-0.2.1-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL pyroquad-0.2.1-cp39-abi3-manylinux_2_28_x86_64.whl
Size 6.3 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
5dbf778978fb5eeede5c7cc81fcd026a95082f85762870ff41faa563d1c9748d
BLAKE2b-256 checksum
How to use checksums
b26c1acdc2736b07654ed3e22e978a79a0d559036fc1849758e6af8421328c46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

Release files / pyroquad-0.2.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL pyroquad-0.2.1-cp39-abi3-macosx_11_0_arm64.whl
Size 5.3 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b7300ee8e49d63499a6713c82f20e0f10957d637b993000aa2c88e43028b9fe3
BLAKE2b-256 checksum
How to use checksums
bdfd52c082d361cc4b6f647bbb68914591863eca80363e883c5973e8e4b4deea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

Security for pyroquad 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page