A Python game engine with physics, rendering, and input systems
Project description
Pyg Engine
A Python game engine built with Pygame and Pymunk for 2D physics, rendering, and game development. Inspired by the Unity game engine's Monobehavior system with scriptable game objects, rigidbody and collider system. Built in physics materials, update system, and mouse+keyboard input system. Built-in window resizing.
NOTE: This is in alpha development stage. Everything is under active development and large changes will likely be made. Also, its pronounced pig engine :)
Features
- OOP Model: Easy and simple game object implementation system. Create players, environment, enemies, etc. with ease
- 2D Physics: Built-in physics via Pymunk
- Input: Mouse and keyboard input handling
- Components: Modular component-based architecture
- Scripts: Dynamic script loading and execution
- Camera: Flexible camera with multiple scaling modes
- Collision: Advanced collision detection and response
Installation
pip install pyg-engine
Or install from source:
git clone <repository-url>
cd pyg-engine
pip install -e .
Quick Start
from pyg_engine import Engine, GameObject, Size
from pygame import Color
# Create the engine
engine = Engine(
size=Size(w=800, h=600),
backgroundColor=Color(0, 0, 0),
windowName="My Game"
)
# Create a game object
player = GameObject(
name="Player",
position=(400, 300),
size=(50, 50),
color=Color(255, 0, 0)
)
# Add to engine
engine.addGameObject(player)
# Start the game loop
engine.start()
Examples
Run examples directly:
# List all available examples
python examples/__init__.py
# Run a specific example
python examples/basic_example.py
python examples/mouse_example.py
python examples/enhanced_mouse_example.py
python examples/main_physics_test.py
python examples/simple_drag_test.py
Available examples:
basic_example.py- Basic engine setup and object creationmain.py- Complete physics demo with collision detection, mouse and keyboard input, multiple game objects, and physics materials.enhanced_mouse_example.py- Advanced mouse interactions with physicsmouse_example.py- Mouse input handling and interaction
Documentation
See the docs/ directory for detailed guides:
README.md- General documentationPHYSICS_CONTROLS_GUIDE.md- Physics system guideMOUSE_INPUT_GUIDE.md- Input system guideSPRITE_SYSTEM_UPGRADE.md- Sprite system documentation
Testing
Run the test suite:
cd pyg_engine
python -m pytest tests/
Development
To set up the development environment:
pip install -e .
TODO
In Development:
- State machine
- Animation system
- Sprite colliders
- Audio system
- Coroutines and async services
- More basic shapes
Planned:
- Debug interface
- File storage system
- 2D lighting system
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyg_engine-1.0.0a1.tar.gz.
File metadata
- Download URL: pyg_engine-1.0.0a1.tar.gz
- Upload date:
- Size: 61.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9406ded6e29b5226c665c6f3ba4b7596406e5621e4fbea6d93158ceb91353115
|
|
| MD5 |
9b5663d4f0c18416ce34104f0ab6b41a
|
|
| BLAKE2b-256 |
39bafbd48c085756bc6256b19b4a48dac0e751c100f472410f2051f7395b8806
|
Provenance
The following attestation bundles were made for pyg_engine-1.0.0a1.tar.gz:
Publisher:
publish-to-pypi.yml on aram-ap/pyg-engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyg_engine-1.0.0a1.tar.gz -
Subject digest:
9406ded6e29b5226c665c6f3ba4b7596406e5621e4fbea6d93158ceb91353115 - Sigstore transparency entry: 331947441
- Sigstore integration time:
-
Permalink:
aram-ap/pyg-engine@82f12ef4a124ef1261d89c5ae28352c7e2d5000f -
Branch / Tag:
refs/tags/v1.0.0a1 - Owner: https://github.com/aram-ap
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@82f12ef4a124ef1261d89c5ae28352c7e2d5000f -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyg_engine-1.0.0a1-py3-none-any.whl.
File metadata
- Download URL: pyg_engine-1.0.0a1-py3-none-any.whl
- Upload date:
- Size: 42.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98b71b2321b402605341519d5f0a5f9ed45a80e45e8db6e6f88f6d868ff8b450
|
|
| MD5 |
c4474962dda6ba194d0ad2bab361fc2d
|
|
| BLAKE2b-256 |
eb1b21239dd3a457df54265a95ce84f3fa6686c746e381d0c1105b9eb203dc8b
|
Provenance
The following attestation bundles were made for pyg_engine-1.0.0a1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on aram-ap/pyg-engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyg_engine-1.0.0a1-py3-none-any.whl -
Subject digest:
98b71b2321b402605341519d5f0a5f9ed45a80e45e8db6e6f88f6d868ff8b450 - Sigstore transparency entry: 331947465
- Sigstore integration time:
-
Permalink:
aram-ap/pyg-engine@82f12ef4a124ef1261d89c5ae28352c7e2d5000f -
Branch / Tag:
refs/tags/v1.0.0a1 - Owner: https://github.com/aram-ap
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@82f12ef4a124ef1261d89c5ae28352c7e2d5000f -
Trigger Event:
release
-
Statement type: