Skip to main content
Yuna

Yuna Python Game Engine

Fast, dependency-light ECS game engine for Python.

Features

  • AI: behavior trees, blackboards, pathfinding, perception, and steering for game agents.
  • Commands: a command pattern with validation, permissions, macros, and undoable results.
  • Config: data-driven schemas, formula patterns, and validators for tunable game data.
  • ECS: an archetype-backed Entity Component System with fast component queries.
  • Events: an event bus with dispatching, queuing, filtering, and consumption control.
  • FSM: finite state machines with states, transitions, and a driving system.
  • Game loop: a fixed-timestep loop with an accumulator and dependency-aware scheduling.
  • Modifiers: a staged pipeline for stacking, scaling, and expiring stat modifiers.
  • Networking: state replication with authority, delta compression, and interest management.
  • Particles: a pure particle simulation with world-level fields for short-lived effects.
  • Physics: a 2D physics engine with rigid bodies, shapes, and a stepping system.
  • Prefabs: reusable entity templates instantiated into any world.
  • Profiling: a performance monitor with per-system stats and timing decorators.
  • Replay: deterministic recording and playback with incremental snapshots.
  • Resources: object pooling and flyweight sharing to cut allocation churn.
  • Scene: chunked scene streaming with transitions for large or open worlds.
  • Scripting: a compact bytecode compiler and VM for in-game scripts.
  • Services: a service locator with provider registration and lifetime control.
  • Spatial: spatial partitioning via grids, quadtrees, and BVH for fast collision queries.
  • State: snapshotting, serialization, versioning, and migrations for save/load.

Optional native acceleration

SpatialGrid and SpatialSystem accept native_raycast=True, which routes raycasts through an optional engine_native extension module when one is installed. Yuna does not ship this module: without it the flag is inert and raycasts use the pure-Python path, which is the reference implementation and behaviorally identical. Games that need faster raycasts can provide their own engine_native package exposing a compatible SpatialIndex.

Install

uv add yuna-engine

Quick start

One entity, two components, one system. A star falls under gravity:

from dataclasses import dataclass

from yuna import Component, ECSWorld, System


@dataclass
class Position(Component):
    x: float
    y: float


@dataclass
class Velocity(Component):
    dx: float
    dy: float


class GravitySystem(System):
    @property
    def priority(self) -> int:
        return 100

    def update(self, world: ECSWorld, delta_time: float) -> None:
        for _entity, (pos, vel) in (
            world.query().with_components(Position, Velocity).iterator()
        ):
            vel.dy += 9.8 * delta_time
            pos.x += vel.dx * delta_time
            pos.y += vel.dy * delta_time


world = ECSWorld()
world.register_system(system=GravitySystem())

star = world.create_entity()
world.add_component(entity_id=star, component=Position(x=0.0, y=100.0))
world.add_component(entity_id=star, component=Velocity(dx=0.0, dy=0.0))

for _ in range(60):
    world.update(delta_time=1 / 60)

pos = world.get_component(entity_id=star, component_type=Position)
print(pos.x, pos.y)  # print position

Sixty ticks is one second at 60 fps. The star falls ~5 units, to y≈105.

License

MIT. See LICENSE.

Metadata

Release files for yuna-engine 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yuna-engine 0.1.0
File Size Uploaded
yuna_engine-0.1.0.tar.gz 428.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yuna-engine 0.1.0
File Interpreter ABI Platform
yuna_engine-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 678.1 kB

Release files / yuna_engine-0.1.0.tar.gz

Download URL yuna_engine-0.1.0.tar.gz
Size 428.5 kB
Tags Source
SHA-256 checksum
How to use checksums
75f7c8ff1da64efa0d4b8da49519e1eccf6967b55cabc08f2260f85c26dfc4d6
BLAKE2b-256 checksum
How to use checksums
316a44a3e234cfe06731ff0fe289a80b0d6e09725036126b89e01d8c8f98ccb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / yuna_engine-0.1.0-py3-none-any.whl

Download URL yuna_engine-0.1.0-py3-none-any.whl
Size 249.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a42263794065febb4056ccc084dd9fe6e27a5a6ba8325f00c8e3ca78e94250f
BLAKE2b-256 checksum
How to use checksums
dbab3d3a8a7e10e88de46a2d53044078b51b4a53296b864fd1374a949fc231b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

1.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page