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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pybitengine-0.1.3.tar.gz
  • Upload date:
  • Size: 98.0 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.3.tar.gz
Algorithm Hash digest
SHA256 f0c08538f5a937bdd2c27d3d70b972fc7cc1a61a8cbcc10da329004c3e507a06
MD5 2aa97ca481506866e49ce183c220f561
BLAKE2b-256 79c49aba14767897a561052a8f552d9a28df170914dfa3239128e4d54b0e6c6b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybitengine-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 97.7 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 88af53992d66fef3bac112f898accd734adebeea527a0fd3a7b0373c88f5d265
MD5 16ea21ec3e8d9277b2f84c22b0f53ae7
BLAKE2b-256 4d97fa3a9fd74d355e63a3fd33bbac6491e5f3fce9685f696c937542164caf25

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