Skip to main content

A GPU-accelerated 2D game engine for Python with camera, drawing and packaging helpers.

Project description

PyBitEngine ⚡

Documentation License Python

A GPU-accelerated 2D game engine for Python, built on SDL2, ModernGL, NumPy and Numba.

PyBitEngine helps developers draw thousands of 2D objects efficiently while keeping the API simple. It uses instanced GPU rendering, texture atlases, and Numba kernels to reduce runtime overhead.


📦 Version: 0.1.3

This release brings major new features: a unified collision system, mouse helpers, rounded shapes, pixel‑perfect texture collisions, a texture atlas, depth sorting, performance optimizations, and a complete timer module.

What is new in 0.1.3

  • Unified collision systemCheckCollision works with any combination of immutable shapes (Rect, Circle, Ellipse, Triangle, Line, RotRect, RoundedRect, Polygon, TextureCollider). Zero object creation overhead.
  • Mouse helpersMouseOver, MousePressed, MouseClicked, MouseHeld, MouseDragging, MouseWheelOn work directly with any shape and optionally with a camera for world-space picking.
  • Full rounded shapesDrawRoundedRect, DrawRoundedTriangle and their outline variants, with GPU-instanced batch versions (DrawRoundedRectsBatch, DrawRoundedTrianglesBatch).
  • Pixel‑perfect texture collisionsCollidePointTexture and CollidePointTextureBatch use the alpha channel stored on the CPU (no GPU readback, no disk I/O at runtime).
  • Texture atlasLoadTextureAtlas inserts an image into the shared atlas; DrawSpritesBatch can then render thousands of sprites from the same atlas in one draw call.
  • Easy‑to‑use batch wrappersDrawRects, DrawLines, DrawCircles, DrawEllipses, DrawSprites, DrawTexts accept lists of tuples with the same parameters as their immediate counterparts. No NumPy knowledge required.
  • Early‑Z / depth sortingenable_early_z() and the begin_opaque_pass() / begin_transparent_pass() helpers let you sort opaque objects front‑to‑back and transparent objects back‑to‑front, dramatically reducing overdraw.
  • Performance boost — color packing in uint32, pre‑computed cos/sin on the CPU, optimized Numba kernels, and fewer allocations make batch rendering faster than ever.
  • Complete key constants — all keyboard and mouse constants are now exported, including previously missing ones like PE_K_CAPSLOCK, PE_K_NUMLOCK, PE_K_PRINTSCREEN, PE_K_LSUPER, etc.
  • PE_TIME module — non‑blocking timers: Scheduler, After, Every, Countdown, Cooldown, Stopwatch, plus AsyncTimer/AsyncAfter for background work with RunOnMainThread and PumpMainThread.
  • PE_PAKER modulepack() creates standalone executables using cx_Freeze, with automatic inclusion of assets and dependencies.
  • CameraGPU and CameraCPU — both now support smooth follow, screen‑shake, world bounds, coordinate conversion (screen_to_world / world_to_screen), and batch culling (is_visible_batch). The shake offset is now zero‑mean (no net drift).
  • Painter’s algorithm fixedDrawTexture now participates in the same batching system as primitives, so draw calls appear in the exact order they are issued.

🚀 Installation

pip install pybitengine

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

pybitengine-0.1.3a1.tar.gz (108.5 kB view details)

Uploaded Source

Built Distribution

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

pybitengine-0.1.3a1-py3-none-any.whl (108.9 kB view details)

Uploaded Python 3

File details

Details for the file pybitengine-0.1.3a1.tar.gz.

File metadata

  • Download URL: pybitengine-0.1.3a1.tar.gz
  • Upload date:
  • Size: 108.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for pybitengine-0.1.3a1.tar.gz
Algorithm Hash digest
SHA256 73576a3faf890e54f23ec321282f8c7c5692617278c7d162bb88d84ee09fc6fa
MD5 9b9ff63fd3604f056dbf4f6ef9a0e0e2
BLAKE2b-256 56c22e21b62755576e8284607964a1add7348c5b9009a7219e00ffa8333ca5e3

See more details on using hashes here.

File details

Details for the file pybitengine-0.1.3a1-py3-none-any.whl.

File metadata

  • Download URL: pybitengine-0.1.3a1-py3-none-any.whl
  • Upload date:
  • Size: 108.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for pybitengine-0.1.3a1-py3-none-any.whl
Algorithm Hash digest
SHA256 87cc5e3178f4c68398e3b260f24b6cddda352e8335875a237361f0468613cbaf
MD5 aaf8cb36ab689c1874cd88d238e79ee1
BLAKE2b-256 5d3a85f9b7eaf693501fb76087856149671f5fe2eff6df4c0f68b67ca1e9521d

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