yggame
yggame is a composable Python component library for building 2D games with Pygame-CE. It provides a headless-first runtime core, optional rendering adapters, scene management, input mapping, animation, collision helpers, UI primitives, inventory, dialogue, quests, AI, pathfinding, saves, and asset caching.
The project is being built as a production-oriented foundation. It intentionally favors tested contracts and useful implementations over generated line count. Large systems such as networking, skeletal animation, advanced lighting, and editor windows will be added behind stable interfaces rather than shipped as fragile placeholders.
Developer credit
Developer and maintainer: Yashraj Sachin Ghemud
This project, its public APIs, tests, examples, and release configuration are maintained under the name Yashraj Sachin Ghemud. Please retain this attribution when redistributing the project.
Installation
pip install yggame[dev]
# Add Pygame when building a graphical game:
pip install yggame[pygame]
The core package can be imported without Pygame, a display, or an audio device. This makes content validation, save migrations, simulations, and automated tests safe in CI and server environments.
Quick start
from yggame import Game
from yggame.core import BaseSystem
class Simulation(BaseSystem):
def update(self, delta: float) -> None:
super().update(delta)
# Advance gameplay here using a fixed simulation delta.
def draw(self, target, interpolation: float = 0.0) -> None:
pass
if __name__ == '__main__':
game = Game(fixed_delta=1 / 60)
game.add_system(Simulation())
game.run(frames=1)
Example composition
from yggame.core import Rect, Vec2
from yggame.input import InputMap
from yggame.physics import CollisionGrid, PlatformerBody
from yggame.ui import HealthBar
controls = InputMap()
controls.bind('move_left', 'keyboard:a')
controls.bind('move_right', 'keyboard:d')
controls.bind('jump', 'keyboard:space')
world = CollisionGrid(80, 30, tile_size=32)
player = PlatformerBody(Rect(96, 128, 24, 40))
health = HealthBar(maximum=100)
Public subsystem map
| Namespace | Responsibility | Headless by default |
|---|---|---|
yggame.core |
Game loop, context, events, timing, ECS, geometry, config, pooling | Yes |
yggame.render |
Layered render queue and viewport transforms | Queue yes; drawing adapter optional |
yggame.scenes |
Scene registry, stack navigation, transitions | Yes |
yggame.camera |
Follow camera, bounds, zoom, screen shake | Yes |
yggame.physics |
Collision grids, spatial hash, raycasts, movement bodies | Yes |
yggame.ui |
Retained UI tree and common widgets | Yes |
yggame.anim |
Tweens and frame animation state machines | Yes |
yggame.inventory |
Items, stacks, equipment, crafting, loot | Yes |
yggame.dialogue |
Dialogue trees, choices, quests | Yes |
yggame.ai |
FSM and behavior trees | Yes |
yggame.world |
A* and flow fields | Yes |
yggame.save |
Versioned save files and autosave | Yes |
yggame.assets |
Cached asset loading and hot reload | Yes |
Quality policy
Every public subsystem should have deterministic unit tests, explicit error behavior, and at least one runnable example before being treated as stable. Optional integrations must be isolated so importing the package never requires them. Data files carry schema versions, and public constructors prefer keyword-only extension points to reduce accidental breaking changes.
License
MIT. See LICENSE.
Five runnable demo games
The repository includes five deterministic, headless-first demo games under examples/yggame_demos/. Each demo is a small but complete vertical slice rather than a disconnected API snippet: it owns gameplay state, accepts typed commands, produces a transcript result, renders a terminal board, and composes multiple yggame subsystems.
| Demo | Category | Representative yggame systems |
|---|---|---|
| Skybound Runner | Platformer action | PlatformerBody, CollisionGrid, Camera2D, Health, particles |
| Neon Swarm | Top-down arena survival | TopDownBody, SpatialHash, steering agents, encounter waves, stats, status effects |
| Emberdeep | Roguelike dungeon crawler | BSP rooms, inventory, equipment, weighted loot, stats, recovery checkpoints |
| Last Bastion | Tower-defense strategy | Tilemap, A*, encounter scheduler, cooldowns, health, economy |
| The Missing Signal | Narrative detective RPG | Dialogue parser/session, quest system, content registry, saves, telemetry |
Run the launcher from the repository root:
python3 examples/run_demos.py list
python3 examples/run_demos.py skybound --board
python3 examples/run_demos.py swarm --steps 12 --board
python3 examples/run_demos.py emberdeep --commands 'explore,explore,fight,loot,save' --board
python3 examples/run_demos.py bastion --commands 'build 5,4,build 8,4,wait,wait' --board
python3 examples/run_demos.py signal --commands 'talk,choose 0,inspect dock,talk,choose 1,inspect frequency,travel relay,inspect blueprint,report'
The examples do not require a display or Pygame installation for their scripted scenarios. They are intended to be extended into graphical scenes by replacing the terminal render_text() implementations with yggame render queues and an optional Pygame adapter. The shared DemoGame protocol in examples/yggame_demos/base.py is deliberately small enough to use as a test seam for future graphical front ends.
Verification
Run the complete headless quality gate with:
ruff check src tests examples
mypy src/yggame
python3 -m pytest -q
Release verification
From a clean checkout, the release workflow is:
python -m pip install -e '.[dev]'
ruff check src tests examples
mypy src/yggame
python -m pytest -q
python -m build
python -m twine check dist/*
The package is headless-first and can be installed without Pygame. Optional integrations are available through the pygame, physics, network, localization, and all extras.
Production roadmap
Version 0.3.0 integrates the 100% Production-Grade Project Prompt Pack, maintained by Yashraj Sachin Ghemud. The pack is the canonical roadmap for hardening yggame into a cohesive, composable mini-engine ecosystem. See the release scope for the distinction between existing runtime capabilities and planned implementation work.
Metadata
Release files for yggame 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yggame-0.3.0.tar.gz | 124.3 kB | Without provenance | Details for yggame-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yggame-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for yggame-0.3.0-py3-none-any.whl |
Total release size: 270.7 kB
Release files / yggame-0.3.0.tar.gz
| Download URL | yggame-0.3.0.tar.gz |
|---|---|
| Size | 124.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1cf84463a766c03aae27d9a0a847e9ec13b1098803adddf41116f425a52b9792
|
|
BLAKE2b-256 checksum How to use checksums |
c3d2537d7ecd3bb4207bf3d69e3e2ce20292a72e2bae227d2864e7b4d81af498
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / yggame-0.3.0-py3-none-any.whl
| Download URL | yggame-0.3.0-py3-none-any.whl |
|---|---|
| Size | 146.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a5529135bdc36dcce35cdc9cb285eda5ebffb59b57020e1c6b99408531b7e57
|
|
BLAKE2b-256 checksum How to use checksums |
a2d266ace66d951266ef65a1dc04c4f4d69f165b650c3d61e81c5a78b583ce6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for yggame 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.