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.3a0.tar.gz (108.4 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.3a0-py3-none-any.whl (108.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pybitengine-0.1.3a0.tar.gz
  • Upload date:
  • Size: 108.4 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.3a0.tar.gz
Algorithm Hash digest
SHA256 e9acbacae2678d389cd00146e8a5e3a9a7b7571b5e90d12f34a3327d01cc93c7
MD5 41322d8004e7b94f71a8ddf803fbc687
BLAKE2b-256 1a1d8012f7967f8ea0562d5c275bf6c0e1877895ad1cbd35a052fdac7c5d01d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybitengine-0.1.3a0-py3-none-any.whl
  • Upload date:
  • Size: 108.8 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.3a0-py3-none-any.whl
Algorithm Hash digest
SHA256 6399e8d8fddda791861ff66bf5c78a718b15d07280d206441612d094c3144c8c
MD5 d19a8d4605e1cbe3b475f81fe2490f30
BLAKE2b-256 32e88b33967e7d858d2c0b0c89b8662bd40f162d28e2b6ac273a8d34a94d4489

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