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 pyodide/ (once; check_imports.py needs it)

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

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.2

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.2
File Actions
pyroquad-0.2.2-cp314-abi3-win_amd64.whl CPython 3.14 abi3 Windows x86-64 Details for pyroquad-0.2.2-cp314-abi3-win_amd64.whl
pyroquad-0.2.2-cp314-abi3-pyemscripten_2026_0_wasm32.whl CPython 3.14 abi3 PyEmscripten 2026.0+ WebAssembly Details for pyroquad-0.2.2-cp314-abi3-pyemscripten_2026_0_wasm32.whl
pyroquad-0.2.2-cp314-abi3-manylinux_2_28_x86_64.whl CPython 3.14 abi3 Linux glibc 2.28+ x86-64 Details for pyroquad-0.2.2-cp314-abi3-manylinux_2_28_x86_64.whl
pyroquad-0.2.2-cp314-abi3-macosx_11_0_arm64.whl CPython 3.14 abi3 macOS 11.0+ ARM64 Details for pyroquad-0.2.2-cp314-abi3-macosx_11_0_arm64.whl
pyroquad-0.2.2-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for pyroquad-0.2.2-cp310-abi3-win_amd64.whl
pyroquad-0.2.2-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for pyroquad-0.2.2-cp310-abi3-manylinux_2_28_x86_64.whl
pyroquad-0.2.2-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for pyroquad-0.2.2-cp310-abi3-macosx_11_0_arm64.whl
pyroquad-0.2.2-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for pyroquad-0.2.2-cp39-abi3-win_amd64.whl
pyroquad-0.2.2-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details for pyroquad-0.2.2-cp39-abi3-manylinux_2_28_x86_64.whl
pyroquad-0.2.2-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for pyroquad-0.2.2-cp39-abi3-macosx_11_0_arm64.whl

Total release size: 52.4 MB

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

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

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

Download URL pyroquad-0.2.2-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
0002ba88fc9509c5195934189cea90e7dcea44afb303a426de605b8754274b02
BLAKE2b-256 checksum
How to use checksums
48f60aada1bc84139aad7e0b067c879e6bf15cadc7162f5d4b865f8621dc6a59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

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

Download URL pyroquad-0.2.2-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
238f27ed7ee95c2857cb1a8ab9bc86254a7e495ac7e3e38e37edf8a1382f0b96
BLAKE2b-256 checksum
How to use checksums
07f4520a34a9fd804f7f87e8312f676b4c4c569e735008ef5765b87bb1f7647e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

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

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

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

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

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

Download URL pyroquad-0.2.2-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
3078d5193b8489543de1edec6651b4926cdd5b9f403d3807f32cdc48a7592236
BLAKE2b-256 checksum
How to use checksums
1dbd478aa4d5649bd2e6b61fe47aec1fa3223e8433ce8f8dba215e90f1d277d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

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

Download URL pyroquad-0.2.2-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
e266f7267218cbbbd273b3b6fd50347e064ac530205d0b0dac3e556982a50d0a
BLAKE2b-256 checksum
How to use checksums
7f962536f82158a7000f223264db8b12f32561af2e1d47e3612f8bac5abb9acd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

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

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

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

Download URL pyroquad-0.2.2-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
2c0a8d516ffcb853e1e3712ae74015f70dbf6e4dd53d12fae8f66bfd75ad8c4a
BLAKE2b-256 checksum
How to use checksums
4138ecf955d4b5b5636a926ed6be330be8b1ba72c185f4a11fb1447bad9ee69b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

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

Download URL pyroquad-0.2.2-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
1a9ef5d11d39e9d122152d37548091e0748f6ad599ba8065e82c0c5e919cf9b8
BLAKE2b-256 checksum
How to use checksums
207dd2e1e3bd88efea9a795cd822fb3c60999761df52acc28aedf9bd9da6eec3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.16.0

Security for pyroquad 0.2.2

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