Python SDK for GoudEngine - a Rust-powered game engine
Project description
GoudEngine Python SDK
Python bindings for the GoudEngine game engine, providing a Pythonic interface to the Rust core through ctypes FFI.
Design Philosophy
All logic lives in Rust. This SDK is a thin wrapper that marshals data and calls FFI functions. This ensures consistent behavior across all language bindings (C#, Python, Rust native).
Installation
Prerequisites
-
Build the GoudEngine native library:
cd goud_engine cargo build --release
-
The Python SDK will automatically locate the library in:
target/release/libgoud_engine.dylib(macOS)target/release/libgoud_engine.so(Linux)target/release/goud_engine.dll(Windows)
Using the SDK
# Add the SDK to your Python path
import sys
sys.path.insert(0, '/path/to/GoudEngine/sdks/python')
from goud_engine import GoudContext, Transform2D, Sprite, Vec2
Quick Start
Context Management
from goud_engine import GoudContext
# Create a context (manages an ECS world)
ctx = GoudContext.create()
# Spawn entities
entity_id = ctx.spawn_entity()
print(f"Spawned entity: {entity_id}")
# Check entity status
print(f"Entity alive: {ctx.is_entity_alive(entity_id)}")
print(f"Entity count: {ctx.entity_count()}")
# Despawn when done
ctx.despawn_entity(entity_id)
# Clean up
ctx.destroy()
Using Context Manager
from goud_engine import GoudContext
with GoudContext.create() as ctx:
entity_id = ctx.spawn_entity()
# Context automatically destroyed when exiting the block
Transform2D Component
import math
from goud_engine import Transform2D, Vec2
# Factory methods (all delegate to Rust FFI)
transform = Transform2D.from_position(100, 50)
transform = Transform2D.from_rotation(math.pi / 4) # 45 degrees
transform = Transform2D.look_at(0, 0, 100, 100) # Position looking at target
# Mutation methods (chainable)
transform = Transform2D()
transform.translate(10, 20).rotate(0.5).scale_by(2, 2)
# Direction vectors
forward = transform.forward() # Returns Vec2
right = transform.right()
# Point transformation
world_point = transform.transform_point(5, 5) # Local to world
local_point = transform.inverse_transform_point(105, 55) # World to local
# Interpolation
transform_a = Transform2D.from_position(0, 0)
transform_b = Transform2D.from_position(100, 100)
mid = transform_a.lerp(transform_b, 0.5) # Midpoint
Sprite Component
from goud_engine import Sprite, Color
# Create a sprite
sprite = Sprite(texture_handle=42)
# Builder pattern (returns new instances)
sprite = (Sprite(texture_handle=42)
.with_color(1.0, 0.0, 0.0, 1.0) # Red tint
.with_flip_x(True)
.with_anchor(0.5, 1.0) # Bottom-center
.with_source_rect(0, 0, 32, 32) # Sprite sheet
.with_custom_size(64, 64)) # Scale to 64x64
# Mutable operations (modify in place)
sprite.color = Color.red()
sprite.flip_x = True
sprite.set_source_rect(32, 0, 32, 32) # Next frame
High-Level Game API
from goud_engine import GoudGame, Transform2D, Sprite
# Create game (placeholder - full implementation coming)
game = GoudGame(800, 600, "My Game")
# Spawn entities
entity = game.spawn()
# Batch spawn
entities = game.spawn_batch(100)
# Clean up
game.close()
API Reference
Types
| Type | Description |
|---|---|
GoudContext |
Engine context managing an ECS world |
GoudResult |
FFI result type for operations that can fail |
GoudEntityId |
FFI entity identifier |
Vec2 |
2D vector |
Color |
RGBA color |
Rect |
2D rectangle |
Transform2D |
2D transformation component |
Sprite |
2D sprite rendering component |
Entity |
High-level entity wrapper |
GoudGame |
High-level game abstraction |
GoudContext Methods
| Method | Description |
|---|---|
create() |
Creates a new context |
destroy() |
Destroys the context |
is_valid() |
Checks if context is valid |
spawn_entity() |
Spawns an empty entity |
spawn_entities(count) |
Spawns multiple entities |
despawn_entity(id) |
Despawns an entity |
is_entity_alive(id) |
Checks if entity is alive |
entity_count() |
Returns alive entity count |
Transform2D Methods
| Method | Description |
|---|---|
from_position(x, y) |
Factory: position |
from_rotation(radians) |
Factory: rotation |
from_scale(sx, sy) |
Factory: scale |
look_at(px, py, tx, ty) |
Factory: look at target |
translate(dx, dy) |
Translate in world space |
translate_local(dx, dy) |
Translate in local space |
rotate(radians) |
Rotate by angle |
scale_by(fx, fy) |
Multiply scale |
forward() |
Get forward direction |
right() |
Get right direction |
transform_point(x, y) |
Local to world |
inverse_transform_point(x, y) |
World to local |
lerp(other, t) |
Interpolate |
Sprite Methods
| Method | Description |
|---|---|
with_color(r, g, b, a) |
Builder: color tint |
with_flip_x(flip) |
Builder: horizontal flip |
with_flip_y(flip) |
Builder: vertical flip |
with_anchor(x, y) |
Builder: anchor point |
with_source_rect(x, y, w, h) |
Builder: sprite sheet rect |
with_custom_size(w, h) |
Builder: render size |
set_source_rect(...) |
Mutate source rect |
clear_source_rect() |
Clear source rect |
set_custom_size(...) |
Mutate size |
clear_custom_size() |
Clear size |
Error Handling
from goud_engine import GoudContext, GoudEngineError
try:
ctx = GoudContext.create()
# ... operations
except GoudEngineError as e:
print(f"Engine error: {e}")
Thread Safety
- Context creation/destruction is thread-safe
- Individual contexts are NOT thread-safe
- Use one context per thread, or synchronize access
Building from Source
# Build the native library
cd goud_engine
cargo build --release
# The Python SDK automatically finds the library in target/release/
License
MIT License - same as GoudEngine core.
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 Distributions
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 goudengine-0.0.818.tar.gz.
File metadata
- Download URL: goudengine-0.0.818.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81b096b63203e8dd93fb2045245bddbaf290b0a4a5bfd7b481f6803dec876e25
|
|
| MD5 |
66df3bb67161b6f769f7d615a16eb029
|
|
| BLAKE2b-256 |
2243c83af65732b8d0fe8e5b0b0df5e3c7e7701f83124a0aaae75ac112b91d97
|
Provenance
The following attestation bundles were made for goudengine-0.0.818.tar.gz:
Publisher:
release.yml on aram-devdocs/GoudEngine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goudengine-0.0.818.tar.gz -
Subject digest:
81b096b63203e8dd93fb2045245bddbaf290b0a4a5bfd7b481f6803dec876e25 - Sigstore transparency entry: 1006596180
- Sigstore integration time:
-
Permalink:
aram-devdocs/GoudEngine@84170cebab0f610705608efda4fd2f2b9e13a80b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/aram-devdocs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@84170cebab0f610705608efda4fd2f2b9e13a80b -
Trigger Event:
push
-
Statement type:
File details
Details for the file goudengine-0.0.818-py3-none-win_amd64.whl.
File metadata
- Download URL: goudengine-0.0.818-py3-none-win_amd64.whl
- Upload date:
- Size: 2.1 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96f01205c5f7841083bfab5feb168e68e45343c2352c095f3174eefdb2bfc984
|
|
| MD5 |
52b368eaaa463e9d797a8f7a6376ccae
|
|
| BLAKE2b-256 |
78045a7c4dc18a2e88922148bd6d6072eb606e64194e6e50ddc544cea2e89446
|
Provenance
The following attestation bundles were made for goudengine-0.0.818-py3-none-win_amd64.whl:
Publisher:
release.yml on aram-devdocs/GoudEngine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goudengine-0.0.818-py3-none-win_amd64.whl -
Subject digest:
96f01205c5f7841083bfab5feb168e68e45343c2352c095f3174eefdb2bfc984 - Sigstore transparency entry: 1006596185
- Sigstore integration time:
-
Permalink:
aram-devdocs/GoudEngine@84170cebab0f610705608efda4fd2f2b9e13a80b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/aram-devdocs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@84170cebab0f610705608efda4fd2f2b9e13a80b -
Trigger Event:
push
-
Statement type:
File details
Details for the file goudengine-0.0.818-py3-none-manylinux2014_x86_64.whl.
File metadata
- Download URL: goudengine-0.0.818-py3-none-manylinux2014_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fff948a3e29a8d89358a351cb02b7f5e68c684632c88a2f55029769107cbb322
|
|
| MD5 |
1897c2f58e54634bc02cfbcd0b9be489
|
|
| BLAKE2b-256 |
9fdb446ec912954b25ecb2cb81009d5dae9242e14c98e50ba26fa60ea80c193b
|
Provenance
The following attestation bundles were made for goudengine-0.0.818-py3-none-manylinux2014_x86_64.whl:
Publisher:
release.yml on aram-devdocs/GoudEngine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goudengine-0.0.818-py3-none-manylinux2014_x86_64.whl -
Subject digest:
fff948a3e29a8d89358a351cb02b7f5e68c684632c88a2f55029769107cbb322 - Sigstore transparency entry: 1006596184
- Sigstore integration time:
-
Permalink:
aram-devdocs/GoudEngine@84170cebab0f610705608efda4fd2f2b9e13a80b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/aram-devdocs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@84170cebab0f610705608efda4fd2f2b9e13a80b -
Trigger Event:
push
-
Statement type:
File details
Details for the file goudengine-0.0.818-py3-none-macosx_14_0_arm64.whl.
File metadata
- Download URL: goudengine-0.0.818-py3-none-macosx_14_0_arm64.whl
- Upload date:
- Size: 3.3 MB
- Tags: Python 3, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5adb71d516d406ad091cf4ffe932718474b25f5075b6af8b84df7f143844e417
|
|
| MD5 |
b9d496d5e15d0de136c60b6fab1a7bf2
|
|
| BLAKE2b-256 |
b3db434cc82886c425be11c1eef22e31a81f6a2db43cd2c9362ef9bbc1d7e6b2
|
Provenance
The following attestation bundles were made for goudengine-0.0.818-py3-none-macosx_14_0_arm64.whl:
Publisher:
release.yml on aram-devdocs/GoudEngine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goudengine-0.0.818-py3-none-macosx_14_0_arm64.whl -
Subject digest:
5adb71d516d406ad091cf4ffe932718474b25f5075b6af8b84df7f143844e417 - Sigstore transparency entry: 1006596182
- Sigstore integration time:
-
Permalink:
aram-devdocs/GoudEngine@84170cebab0f610705608efda4fd2f2b9e13a80b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/aram-devdocs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@84170cebab0f610705608efda4fd2f2b9e13a80b -
Trigger Event:
push
-
Statement type:
File details
Details for the file goudengine-0.0.818-py3-none-macosx_13_0_x86_64.whl.
File metadata
- Download URL: goudengine-0.0.818-py3-none-macosx_13_0_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3, macOS 13.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fd932448dc28aca55fe3eeaae70aa2a5f152110ea0c2456f3069764a6fb1a9a
|
|
| MD5 |
07fad97935e3b255db669d57fce7da5e
|
|
| BLAKE2b-256 |
6dc0ee4b57dcaa70c41556d895bab977974edfb800a0c03b9e07928014c9970b
|
Provenance
The following attestation bundles were made for goudengine-0.0.818-py3-none-macosx_13_0_x86_64.whl:
Publisher:
release.yml on aram-devdocs/GoudEngine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
goudengine-0.0.818-py3-none-macosx_13_0_x86_64.whl -
Subject digest:
1fd932448dc28aca55fe3eeaae70aa2a5f152110ea0c2456f3069764a6fb1a9a - Sigstore transparency entry: 1006596187
- Sigstore integration time:
-
Permalink:
aram-devdocs/GoudEngine@84170cebab0f610705608efda4fd2f2b9e13a80b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/aram-devdocs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@84170cebab0f610705608efda4fd2f2b9e13a80b -
Trigger Event:
push
-
Statement type: