Skip to main content

2D pixel-art game engine with optional 3D layers, Rust backends, and wgpu rendering

Project description

SlapPyEngine

2D pixel-art game engine with optional 3D layers, Rust backends, and wgpu rendering.

Build fast, expressive games in Python — from classic pixel-art shooters to hybrid 2D/3D worlds — backed by a high-performance Rust core and cross-platform GPU rendering via wgpu.


Features

  • 2D pixel-art pipeline — per-tile compute shaders, sprite batching, palette swapping, and atlas packing
  • Optional 3D layers — PBR mesh rendering composited over the 2D scene (pip install slappy-engine[3d])
  • Per-layer lighting — independent ambient, point, and directional lights on each scene layer
  • Cross-platform GPU — wgpu backend targets Vulkan, Metal, and DirectX 12 from a single code path
  • Rust _core backend — performance-critical subsystems (asset I/O, LZ4 compression, physics) compiled via PyO3/maturin
  • DearPyGui editor — Nova3D dark-themed in-engine editor with toolbar, gizmos, and Code Mode (pip install slappy-engine[editor])
  • P2P networking — Kademlia DHT + ICE hole-punching for low-latency peer-to-peer multiplayer (pip install slappy-engine[network])
  • Spatial audio — positional audio with rolloff curves (pip install slappy-engine[audio])

Install

# Core engine (2D only)
pip install slappy-engine

# With 3D layer support
pip install slappy-engine[3d]

# Full stack: editor, networking, audio, video
pip install slappy-engine[editor,network,audio,video]

Requires Python 3.11+ and a GPU driver that supports Vulkan, Metal, or DirectX 12.


Quick Start

import slappyengine as sle

engine = sle.Engine(title="My Game", width=640, height=360)

# Create a blank 2D pixel layer
layer = engine.add_layer("world", sle.Layer2D(tile_size=16))

# Load a sprite sheet and place a sprite
sheet = engine.assets.load_sprite_sheet("player.png", tile_w=16, tile_h=16)
player = layer.spawn_sprite(sheet, tile=0, x=160, y=90)

engine.run()

Architecture

2D Pipeline

Each Layer2D is a WGSL compute pass. Tiles are packed into a GPU buffer; per-frame dispatch updates transforms, palette swaps, and lighting before a single textured quad draw call flattens the layer to a render texture.

3D Pipeline (optional)

Layer3D instances sit above or below 2D layers in the compositor stack. PBR meshes are rendered to their own MSAA texture, then alpha-composited with the 2D render texture during the final blit pass. Enable at build time with maturin build --features 3d.

Cross-Layer Baking

The compositor (slappyengine.compose) resolves layer order, blending modes, and shared lighting probes into a single swap-chain frame. Baked lightmaps are stored in .slap asset bundles (LZ4-compressed, built by the Rust core).

Rust _core

The slappyengine._core extension module (compiled via PyO3 + maturin) provides:

Module Responsibility
_core.assets LZ4 asset bundle read/write
_core.physics Broad-phase collision (rayon parallel)
_core.audio Spatial audio mixer
_core.net ICE/STUN hole-punching helpers

Making Your Game

1 — Scaffold a new project

slap new MyGame
cd MyGame
slap run

This creates a ready-to-run project with Content/, Source/, Config/, and Builds/ folders plus platform build scripts (Build_EXE.bat, Build_Web.bat, Build_APK.bat).

2 — Add a scene

# Source/scenes/level1.py
import slappyengine as se

class Level1(se.Scene):
    def on_create(self):
        hero = se.Asset.from_image("Content/Assets/sprites/hero.png", name="Hero")
        hero.position = (400.0, 300.0)
        self.add(hero)

        self.lighting.add(se.DirectionalLight(direction=(0.707, 0.707), intensity=1.2))

3 — Wire player input

from slappyengine.input import ActionMap

engine.add_player(ActionMap.wasd(player_id=0))
# Scripts receive on_action(action, player_id, pressed) calls automatically

4 — Add physics

from slappyengine import PhysicsComponent, CollisionComponent, AABBShape

hero.add_component(PhysicsComponent(gravity_scale=1.0))
hero.add_component(CollisionComponent(shape=AABBShape(32, 48)))

5 — Script behaviour

from slappyengine.script import Script

class EnemyAI(Script):
    def on_update(self, entity, dt):
        entity.position = (entity.position[0] - 60 * dt, entity.position[1])

enemy.attach_script(EnemyAI())

6 — Build and ship

slap build --target=exe      # Windows EXE via PyInstaller
slap build --target=web      # Browser (Pyodide + WebGPU)
slap build --target=apk      # Android APK via Buildozer

Build from Source

Requires: Rust toolchain (stable), Python 3.11+, maturin

# Clone
git clone https://github.com/andrewkwatts-maker/SlapPyEngine
cd SlapPyEngine

# Install maturin
pip install maturin

# Editable dev install (debug Rust build)
maturin develop --extras dev

# Run tests
pytest tests/

# Release wheel
maturin build --release

# Release wheel with 3D support
maturin build --release --features 3d

Windows note: If maturin fails to locate Python, set PYO3_PYTHON explicitly:

$env:PYO3_PYTHON = "C:\Users\<you>\AppData\Local\Programs\Python\Python313\python.exe"
maturin develop --extras dev

License

MIT — see LICENSE for details.

Project details


Download files

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

Source Distribution

slappy_engine-0.2.0a0.tar.gz (405.2 kB view details)

Uploaded Source

Built Distributions

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

slappy_engine-0.2.0a0-cp313-cp313-win_amd64.whl (656.1 kB view details)

Uploaded CPython 3.13Windows x86-64

slappy_engine-0.2.0a0-cp313-cp313-manylinux_2_34_x86_64.whl (738.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

slappy_engine-0.2.0a0-cp313-cp313-macosx_11_0_arm64.whl (681.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

slappy_engine-0.2.0a0-cp312-cp312-win_amd64.whl (656.2 kB view details)

Uploaded CPython 3.12Windows x86-64

slappy_engine-0.2.0a0-cp312-cp312-manylinux_2_34_x86_64.whl (738.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

slappy_engine-0.2.0a0-cp312-cp312-macosx_11_0_arm64.whl (681.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

slappy_engine-0.2.0a0-cp311-cp311-win_amd64.whl (654.8 kB view details)

Uploaded CPython 3.11Windows x86-64

slappy_engine-0.2.0a0-cp311-cp311-manylinux_2_34_x86_64.whl (737.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

slappy_engine-0.2.0a0-cp311-cp311-macosx_11_0_arm64.whl (681.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file slappy_engine-0.2.0a0.tar.gz.

File metadata

  • Download URL: slappy_engine-0.2.0a0.tar.gz
  • Upload date:
  • Size: 405.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for slappy_engine-0.2.0a0.tar.gz
Algorithm Hash digest
SHA256 e15f28f351c258e78fffb274bbc9a8d824e42ea9f8a540f8c5bd3022b15f504b
MD5 bc0dd50298598ae7a29658c85db6eb28
BLAKE2b-256 c7878f4106d2ea11302b74243844b48f3dea748f01d247f3990f1876ca4aff89

See more details on using hashes here.

Provenance

The following attestation bundles were made for slappy_engine-0.2.0a0.tar.gz:

Publisher: publish.yml on andrewkwatts-maker/SlapPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slappy_engine-0.2.0a0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for slappy_engine-0.2.0a0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a86826f31ec71b2297942ddfdb88b93de3eabfe496de689d571e591f5d43b63e
MD5 1ed82a946ed0057677088840024636ab
BLAKE2b-256 486c620a2cae092ee18b187f428f5740d359dff2f8ee44d173ddd3fd5a5510a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for slappy_engine-0.2.0a0-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on andrewkwatts-maker/SlapPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slappy_engine-0.2.0a0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for slappy_engine-0.2.0a0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 0bb636c74aabd9f8981401a014bea13d162ddd6043cd8b89450a23cb341d298e
MD5 f6c528a408783a501fc80a5e6035dda9
BLAKE2b-256 df06454d3433ccb011675552b1bce027f48af5902228da5a2247f8863c977790

See more details on using hashes here.

Provenance

The following attestation bundles were made for slappy_engine-0.2.0a0-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on andrewkwatts-maker/SlapPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slappy_engine-0.2.0a0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slappy_engine-0.2.0a0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 31a551d7a4d313c24b7f26805cf0c9c3b9f3c69f2f8bc5f3114cdf9e45a23a36
MD5 aa5ac9f2ef10e42c1342f920b4539414
BLAKE2b-256 bc40fe4416ee3de66cd76bf3e55784e2cc3ec0cd5277f28d6c5193a76fed3e40

See more details on using hashes here.

Provenance

The following attestation bundles were made for slappy_engine-0.2.0a0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on andrewkwatts-maker/SlapPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slappy_engine-0.2.0a0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for slappy_engine-0.2.0a0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0b216bb2250eaf3b981386b0772340ab5268c6b0ae463e498061bfcf56f2f545
MD5 8b826395bbbf7e323131af2a807831ad
BLAKE2b-256 446e222539de1b6de15835f46137af78f63add97ba13bc014635beb10a877dd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for slappy_engine-0.2.0a0-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on andrewkwatts-maker/SlapPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slappy_engine-0.2.0a0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for slappy_engine-0.2.0a0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 103b0c799cc2c538e42b43ffac88f0cee8e752da76b6ea379526bca0e6c3dcd4
MD5 7439a1603980a9a4e1cc6572f124ecaf
BLAKE2b-256 a9c5d7e3c2ca63a8c7c28ba75145b102ed46cd4d7ef6c2d579c383112aa7f0f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for slappy_engine-0.2.0a0-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on andrewkwatts-maker/SlapPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slappy_engine-0.2.0a0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slappy_engine-0.2.0a0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 00b9bf786b367bbdb46e9690ece6d84f6496ed0c79039f1122a9666f10383dd6
MD5 9bb97d00693d1d8e42d3cad7ebe0f20f
BLAKE2b-256 ec6366dc67756776f03d3f8cbb69a17befa67249e04caeb04128126aa89b478b

See more details on using hashes here.

Provenance

The following attestation bundles were made for slappy_engine-0.2.0a0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on andrewkwatts-maker/SlapPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slappy_engine-0.2.0a0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for slappy_engine-0.2.0a0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a3e24a96611716a4197f52175bee19a5818fe8f5cc145eb7b7f581825844f017
MD5 919e2d6ce10793412e25cfdde4978734
BLAKE2b-256 971fa3ecdf44be777abb8c0d8efd6855eb69bde1a4c5d60f7753c5702f2d08f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for slappy_engine-0.2.0a0-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on andrewkwatts-maker/SlapPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slappy_engine-0.2.0a0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for slappy_engine-0.2.0a0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 87118494c5db32eae916637e975472a63a58e44d824aed8fd89e89dd651b4883
MD5 e1e749288e7f2f6ea3e72d239f0c8c32
BLAKE2b-256 2b148af378924ccb556fbad624cc03bafb0951896bb8468b7b62bb2c32d8f151

See more details on using hashes here.

Provenance

The following attestation bundles were made for slappy_engine-0.2.0a0-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: publish.yml on andrewkwatts-maker/SlapPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slappy_engine-0.2.0a0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for slappy_engine-0.2.0a0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc76406b2b0a5ea8d5e2fd2efb4f92a04926133f7bcc9717b8cee7dfa9384c2d
MD5 a669496d628bdd6ba3306f75ea4fa705
BLAKE2b-256 195d1eae53f52572d7196591901c0502f8f0684df40ae86e75880574ee6522ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for slappy_engine-0.2.0a0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on andrewkwatts-maker/SlapPy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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