Skip to main content

A powerful Python game engine with comprehensive math library and render pipeline

Project description

Core

A powerful Python game engine with comprehensive math library and render pipeline.

Features

  • Complete Math Library (IntPy): Vectors, matrices, quaternions, geometry, advanced math
  • Render Pipeline: Camera system, materials, lighting, scene management
  • Engine Core: Main loop, time management, input handling, event system
  • Component System: Entity-component architecture
  • Resource Management: Asset loading and caching
  • Configuration: Flexible settings system
  • Logging: Built-in logging with levels

Installation

# Install from source
pip install -e .

# Or install in development mode
pip install -e ".[dev]"

Quick Start

Basic Engine Setup

from Engine import Engine

def update(delta_time):
    # Your update logic here
    pass

def render():
    # Your rendering logic here
    pass

# Create and run engine
engine = Engine(width=1280, height=720, title="My Game")
engine.set_update_callback(update)
engine.set_render_callback(render)
engine.run()

Using Math Library

from IntPy import vector3D, Matrix4x4, Quaternion, lerp

# Vectors
v1 = vector3D(1, 2, 3)
v2 = vector3D(4, 5, 6)
result = v1 + v2  # vector3D(5, 7, 9)

# Matrices
matrix = Matrix4x4.translation(10, 20, 30)
transformed = matrix * v1

# Quaternions
quat = Quaternion.from_euler(0, 45, 0)
rotated = quat.rotate_vector(v1)

# Interpolation
value = lerp(0.0, 100.0, 0.5)  # 50.0

Using Render Pipeline

from Render_Pipeline import Camera, Scene, GameObject, PrimitiveFactory, MaterialLibrary
from IntPy import vector3D

# Create camera
camera = Camera(
    position=vector3D(0, 0, 5),
    target=vector3D(0, 0, 0),
    fov=60.0
)

# Create scene
scene = Scene("MyScene")
scene.set_main_camera(camera)

# Create objects
cube_mesh = PrimitiveFactory.create_cube(1.0)
material = MaterialLibrary.metallic_rough(metallic=0.8, roughness=0.2)

obj = GameObject("Cube", mesh=cube_mesh, material=material)
obj.transform.set_position(vector3D(0, 0, 0))
scene.add_object(obj)

# Render scene (in your render callback)
from Render_Pipeline import RenderPipeline

renderer = RenderPipeline(1920, 1080)
renderer.render_scene(scene)

Input Handling

from Engine import get_input, Key, MouseButton

def update(delta_time):
    input_manager = get_input()
    
    # Keyboard
    if input_manager.is_key_pressed(Key.W):
        # Move forward
        pass
    
    if input_manager.is_key_down(Key.SPACE):
        # Jump (only on press)
        pass
    
    # Mouse
    if input_manager.is_mouse_button_pressed(MouseButton.LEFT):
        pos = input_manager.get_mouse_position()
        # Handle click
        pass
    
    scroll = input_manager.get_mouse_scroll()
    if scroll[1] != 0:
        # Handle scroll
        pass

Event System

from Engine import get_event_dispatcher, EventType

def on_window_resize(event):
    print(f"Window resized: {event.data}")

dispatcher = get_event_dispatcher()
dispatcher.subscribe(EventType.WINDOW_RESIZE, on_window_resize)

Component System

from Engine import get_entity_manager, TransformComponent

entity_manager = get_entity_manager()

# Create entity
entity = entity_manager.create_entity("Player")

# Add components
transform = TransformComponent()
transform.set_position(vector3D(0, 0, 0))
entity.add_component(transform)

# Update (called automatically by engine)
entity_manager.update(delta_time)

Examples

See the examples/ directory for more detailed examples:

  • basic_engine.py - Basic engine setup
  • math_examples.py - Math library usage
  • rendering_example.py - Render pipeline usage
  • input_example.py - Input handling
  • component_example.py - Component system

Documentation

Full documentation is available in the docstrings of each module.

License

MIT License

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

core3-1.0.0.tar.gz (52.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

core3-1.0.0-py3-none-any.whl (53.6 kB view details)

Uploaded Python 3

File details

Details for the file core3-1.0.0.tar.gz.

File metadata

  • Download URL: core3-1.0.0.tar.gz
  • Upload date:
  • Size: 52.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for core3-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3c7b3a15fe9d3eefe12bb7953034a5f1a1fb5396c0f3a09d58cccc4f3f00d335
MD5 db9019f41322a0f57a9d22032fb4b083
BLAKE2b-256 72fc6a792cc7f8b307734a0b8896d2d6f1d8d7c3c75eab3feef106e0783834ce

See more details on using hashes here.

File details

Details for the file core3-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: core3-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 53.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for core3-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be8df7c880d7587021ede53c8ca351d744bc500d857272f39a86fad7038fe597
MD5 f59d8b4d235509b3ef4a08e0717a94e1
BLAKE2b-256 ca2f36ba096f3c8621788968936f55c5fe80506c56d6275ffd4efc6878ab0e9a

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