Arepy is a lightweight and expressive ECS game engine built in Python, designed to make building 2D games simple, fast, and enjoyable. It provides a clean API, a modern architecture, and first-class integration with Raylib and ImGui.
- High-performance ECS architecture optimized for games
- Raylib integration for hardware-accelerated 2D graphics
- ImGui debugging overlay with real-time tools
- Memory-efficient component pools
- Flexible query system with
With/Withoutfilters - Simple and intuitive API design
- Fluent entity builder system
pip install arepygit clone https://github.com/Scr44gr/arepy.git
cd arepy
pip install -e ".[testing]"from arepy import ArepyEngine, Color, Rect, Renderer2D, SystemPipeline
from arepy.bundle.components.rigidbody_component import RigidBody2D
from arepy.bundle.components.transform_component import Transform
from arepy.ecs import Entities, Query, With
from arepy.math import Vec2
# Colors
WHITE = Color(255, 255, 255, 255)
RED = Color(255, 0, 0, 255)
def movement_system(query: Query[Entities, With[Transform, RigidBody2D]], renderer: Renderer2D):
delta_time = renderer.get_delta_time()
for entity in query.get_entities():
transform = entity.get_component(Transform)
velocity = entity.get_component(RigidBody2D).velocity
transform.position.x += velocity.x * delta_time
transform.position.y += velocity.y * delta_time
def render_system(query: Query[Entities, With[Transform, RigidBody2D]], renderer: Renderer2D):
renderer.start_frame()
renderer.clear(color=WHITE)
for entity in query.get_entities():
transform = entity.get_component(Transform)
renderer.draw_rectangle(
Rect(transform.position.x, transform.position.y, 50, 50),
color=RED
)
renderer.end_frame()
if __name__ == "__main__":
game = ArepyEngine(title="Arepy Example")
world = game.create_world("main_world")
entity = (world.create_entity()
.with_component(Transform(position=Vec2(0, 0)))
.with_component(RigidBody2D(velocity=Vec2(50, 10)))
.build())
world.add_system(SystemPipeline.UPDATE, movement_system)
world.add_system(SystemPipeline.RENDER, render_system)
game.set_current_world("main_world")
game.run()Lightweight identifiers that represent objects in the game world:
entity = world.create_entity()
player = (world.create_entity()
.with_component(Transform(position=Vec2(100, 100)))
.with_component(PlayerController())
.build())Pure data containers attached to entities:
from arepy.ecs import Component
class Health(Component):
def __init__(self, value: int = 100):
self.value = value
self.max_value = value
class Weapon(Component):
def __init__(self, damage: int = 10, range: float = 100.0):
self.damage = damage
self.range = rangeSystems implement game logic:
def damage_system(query: Query[Entity, With[Health, Weapon]]):
for entity in query.get_entities():
health = entity.get_component(Health)
weapon = entity.get_component(Weapon)
if health.value <= 0:
entity.kill()Filter entities based on their components:
Query[Entity, With[Transform, Velocity]]
Query[Entity, Without[Dead]]
# Planned:
Query[Entity, With[Transform, Velocity], Without[Frozen]]pytest # Run all tests
pytest --cov=arepy # Coverage report
pytest tests/test_registry.py -vWe welcome contributions. Refer to the Contributing Guide.
- Fork the repository
- Create a feature branch
- Implement your changes and tests
- Ensure tests pass
- Commit and push
- Open a Pull Request
- Python 3.10+
- Raylib 5.5.0+
- Bitarray 3.4.2+
- Advanced query system
- Scene management
- Asset pipeline improvements
- Physics integration
- Audio system
- Networking support
- Visual editor
This project is licensed under the MIT License β see the LICENSE file for details.
Made with β€οΈ by Abrahan Gil

