-
Notifications
You must be signed in to change notification settings - Fork 6
Home
Osman Kahraman edited this page Jan 28, 2026
·
9 revisions
This document describes the internal architecture of PyGameEngine, focusing on how responsibilities are separated across engine layers and how different components interact during runtime.
PyGameEngine is designed as a modular, layered game engine, prioritizing clarity, reusability, and performance in real-time applications.
The engine is organized into four main layers:
- Engine Core
- Gameplay & Entities
- UI & Game Flow
- Data & Configuration
Each layer has a clearly defined responsibility and communicates with others through well-defined boundaries.
Location:
game_engine/core/*.py
- Runs the main game loop
- Controls frame timing and tick rate
- Propagates update and render cycles
- Handles physics and movement updates
- Independent from gameplay rules
- Does not contain UI or entity-specific logic
- Acts as the “motor” of the engine
Location:
game_engine/items/
- Defines all in-game objects (player, enemies, environment)
- Encapsulates object behavior and state
- Interacts with the engine via shared update methods
-
character.py– Player logic -
enemy_1.py– Enemy AI and behavior -
streetLight.py– Static environment objects -
template.py– Base template for reusable entities -
info.json– Metadata and configuration
Location:
game_engine/ui/
- Scene management (home, game, pause)
- Centralized event handling
- Tile-based rendering
- UI layout and composition
-
main.py– Engine entry point -
game.py– Active gameplay state -
home.py– Menu / home screen -
event.py– Input and event abstraction -
designer.py– UI layout logic -
tiles.py– Tile rendering -
tiles.json– Map and tile data
Files:
tiles.json
info.json
- Stores configuration and level data
- Enables data-driven behavior
- Reduces hardcoded logic
-
main.pyinitializes the engine - Engine core starts the main loop
- Events are captured and processed
- Game entities update their state
- Physics and movement are applied
- Rendering is executed
- Loop continues until exit
- Separation of Concerns
- Modularity
- Reusability
- Object-Oriented Architecture
- Performance Awareness
PyGameEngine’s architecture is intentionally simple but scalable.
By isolating engine mechanics, gameplay logic, and UI flow, it provides a clean foundation for building and extending real-time Python games using PyGame.