Skip to main content

Полноценный 3D игровой движок на Python с OpenGL

Project description

AETHER ENGINE

============

Полноценный 3D игровой движок на Python с OpenGL 4.6
Автор: entiti937 | Версия: 1.0.2 | Лицензия: MIT
PyPI: https://pypi.org/project/aether-engine/


УСТАНОВКА
--------

Базовая:
pip install aether-engine

С аудио:
pip install aether-engine[audio]

С физикой:
pip install aether-engine[physics]

Полная:
pip install aether-engine[full]


БЫСТРЫЙ СТАРТ
-------------

Создайте файл main.py:

from aether.core.engine import Engine
from aether.scene.scene import Scene
from aether.scene.entity import Entity
from aether.scene.component import Transform, MeshRenderer
from aether.graphics.mesh_factory import MeshFactory
from aether.graphics.material import Material
from aether.graphics.camera import Camera

engine = Engine(1280, 720, "Моя игра")
scene = Scene("MainScene")
camera = Camera(position=(0, 2, 8))
scene.set_main_camera(camera)

cube = Entity("Player")
cube.add_component(Transform(position=(0, 1, 0)))
cube.add_component(MeshRenderer(mesh=MeshFactory.create_cube(), material=Material()))
scene.spawn(cube)

engine.load_scene(scene)
engine.run()

Запустите:
python main.py

Управление: WASD - движение, мышь - поворот, ESC - выход.


СОЗДАНИЕ ОКНА И СЦЕНЫ
---------------------

Настройка движка:
from aether.core.engine import Engine
from aether.core.config import EngineConfig

config = EngineConfig()
config.app_name = "Моя RPG"
config.graphics.width = 1920
config.graphics.height = 1080
engine = Engine(config=config)

# Или просто
engine = Engine(1280, 720, "Моя игра")

Работа со сценами:
from aether.scene.scene import Scene
from aether.scene.scene_manager import SceneManager

menu = Scene("Menu")
game = Scene("Game")
manager = SceneManager()
manager.register_scene(menu)
manager.register_scene(game)
manager.load_scene("Game")
manager.transition_to("Menu", transition_time=1.0)


ENTITY И КОМПОНЕНТЫ
-------------------

Создание объекта:
from aether.scene.entity import Entity
from aether.scene.component import Transform, MeshRenderer, RigidbodyComponent

player = Entity("Player", tag="player")
player.add_component(Transform(position=(0, 2, 0), rotation=(0, 45, 0), scale=(1, 1, 1)))
player.add_component(MeshRenderer(mesh=MeshFactory.create_cube(), material=Material()))
player.add_component(RigidbodyComponent(mass=75.0, use_gravity=True))
scene.spawn(player)

Доступ к компонентам:
transform = player.get_component("Transform")
transform.translate(0, 0, 1)
transform.rotate(0, 10, 0)

mesh = player.get_component("MeshRenderer")
mesh.visible = False

Свой компонент:
from aether.scene.component import Component

class HealthComponent(Component):
def __init__(self, max_hp=100):
super().__init__()
self.max_hp = max_hp
self.hp = max_hp

def update(self, dt):
if self.hp <= 0:
print(f"{self.entity.name} died!")

def take_damage(self, amount):
self.hp -= amount

player.add_component(HealthComponent(100))


КАМЕРА
------

from aether.graphics.camera import Camera

camera = Camera(position=(0, 5, 15), yaw=-90, pitch=-20, fov=60)
scene.set_main_camera(camera)
camera.move_forward(dt)
camera.move_left(dt)
camera.rotate(dx, dy)


ОСВЕЩЕНИЕ
---------

from aether.graphics.light import DirectionalLight, PointLight, SpotLight

sun = DirectionalLight(direction=(0.5, -1, 0.3), color=(1.0, 0.95, 0.8), intensity=1.5)
lamp = PointLight(position=(0, 3, 0), color=(1.0, 0.8, 0.6), intensity=2.0, range=15.0)
flashlight = SpotLight(position=(0, 2, 0), direction=(0, 0, -1), intensity=3.0)


МАТЕРИАЛЫ И ТЕКСТУРЫ
--------------------

from aether.graphics.material import Material
from aether.graphics.texture import Texture

mat = Material("Metal")
mat.albedo = (0.8, 0.2, 0.2)
mat.metallic = 1.0
mat.roughness = 0.3
mat.albedo_map = Texture("textures/rust.png")
mat.normal_map = Texture("textures/rust_normal.png")


ФИЗИКА
------

Встроенная (AABB):
from aether.physics.collider import BoxCollider, SphereCollider
from aether.scene.component import RigidbodyComponent

body = RigidbodyComponent(mass=10.0, use_gravity=True)
entity.add_component(body)
entity.add_component(BoxCollider(size=(1, 1, 1)))
body.add_force((0, 100, 0))
body.add_impulse((0, 0, 50))

Raycast:
from aether.physics.raycast import Ray, raycast

ray = Ray(origin=(0, 10, 0), direction=(0, -1, 0))
hit = physics_world.raycast(ray.origin, ray.direction)
if hit.hit:
print(f"Попадание в {hit.entity.name}")

PyBullet (опционально):
from aether.physics.bullet_backend import BulletPhysicsBackend

bullet = BulletPhysicsBackend()
bullet.initialize(gravity=(0, -9.81, 0))
body_id = bullet.create_rigid_body("my_entity", mass=1.0, shape_type="box", dimensions=(1,1,1), position=(0,5,0))
bullet.step(dt)


СИСТЕМА ЧАСТИЦ
--------------

from aether.graphics.particle_system import ParticleEmitter

fire = ParticleEmitter(max_particles=1000)
fire.position = (0, 1, 0)
fire.emission_rate = 200
fire.start_color = (1.0, 0.5, 0.0, 1.0)
fire.end_color = (1.0, 0.0, 0.0, 0.0)
fire.velocity = (0, 3, 0)

fire.update(dt)
fire.render(view, projection)


ТЕРРАЙН
-------

from aether.graphics.terrain import Terrain

terrain = Terrain(width=512, depth=512, max_height=100)
terrain.generate_height_map(seed=42, octaves=6)
terrain.generate_chunks()
height = terrain.get_height(world_x, world_z)
terrain.render(view, projection, camera_position)


ВОДА
----

from aether.graphics.water import WaterBody

water = WaterBody(size=100, resolution=256, position=(0, 0, 0))
water.wave_speed = 1.5
water.water_color = (0.0, 0.3, 0.6)
water.update(dt)
water.render(view, projection, camera_position)


НЕБО И АТМОСФЕРА
----------------

from aether.graphics.sky_atmosphere import SkyDome

sky = SkyDome(radius=500)
sky.set_time_of_day(12.0) # Полдень
sky.render(view, projection)


ОКРУЖЕНИЕ
---------

from aether.environment.environment_system import EnvironmentSystem, Weather, Season

env = EnvironmentSystem()
env.set_weather(Weather.RAIN)
env.set_time(18, 30, 0)
env.set_season(Season.WINTER)
env.update(dt)


AI И НАВИГАЦИЯ
--------------

Деревья поведения:
from aether.ai.behavior_tree import BehaviorTree, Sequence, Selector, IsEnemyNearby, AttackTarget

bt = BehaviorTree()
root = Selector("Root")
attack = Sequence("Attack")
attack.add_child(IsEnemyNearby(radius=5.0))
attack.add_child(AttackTarget(damage=10.0))
root.add_child(attack)
bt.set_root(root)
bt.set_context("entity", enemy)
bt.set_context("target", player)
bt.tick()

NavMesh:
from aether.ai.navmesh import NavMeshBuilder

navmesh = NavMeshBuilder.build_from_grid(origin=(0,0,0), size_x=100, size_z=100, cell_size=1.0)
path = navmesh.find_path(start_pos, end_pos)
smoothed = navmesh.smooth_path(path)


АУДИО
-----

from aether.audio.audio_manager import AudioManager

audio = AudioManager()
audio.load_sound("explosion", "sounds/explosion.wav")
audio.play_sound("explosion", volume=0.8)
audio.play_music("music/background.mp3", loop=True)
audio.set_master_volume(0.7)


UI
--

from aether.ui.canvas import Canvas
from aether.ui.button import Button, Panel, Label

canvas = Canvas(1920, 1080)

def on_click():
print("Нажали!")

btn = Button("Начать игру", x=100, y=100, width=200, height=50, callback=on_click)
panel = Panel(x=50, y=50, width=400, height=300)
panel.title = "Инвентарь"
canvas.add(panel)
canvas.add(btn)
canvas.update(dt, mouse_x, mouse_y, mouse_pressed, mouse_just_pressed)
canvas.render()


СЕТЬ
----

Сервер:
from aether.network.network_manager import NetworkServer

server = NetworkServer(max_clients=32)
server.start(host="0.0.0.0", port=7777)

Клиент:
from aether.network.network_manager import NetworkClient

client = NetworkClient("Player1")
client.connect("127.0.0.1", 7777)
client.send(NetworkMessage("chat", {"text": "Привет!"}))


СОХРАНЕНИЯ
----------

from aether.core.save_system import SaveSystem, SaveData

save_system = SaveSystem()
data = SaveData("save_01")
data.set_custom("health", 85)
save_system.save(slot_id=0, save_data=data)
loaded = save_system.load(slot_id=0)


ДОСТИЖЕНИЯ
----------

from aether.core.achievement_system import AchievementSystem

achievements = AchievementSystem()
achievements.register_achievement("first_kill", "Первая кровь", points=10)
achievements.increment_stat("kills")


КОНСОЛЬ РАЗРАБОТЧИКА
--------------------

from aether.core.console import Console

console = Console()
console.register_command("spawn", spawn_enemy)
console.register_variable("g_difficulty", 2, "Сложность", 1, 5)
console.execute("spawn 5")


РЕДАКТОР (ImGui)
----------------

from aether.editor.imgui_integration import ImGuiManager, EditorLayout, HierarchyPanel, InspectorPanel

imgui = ImGuiManager()
imgui.initialize(window, 1920, 1080)
editor = EditorLayout()
editor.add_panel(HierarchyPanel())
editor.add_panel(InspectorPanel())

# В игровом цикле:
imgui.begin_frame()
editor.render(scene, console, profiler)
imgui.end_frame()


STEAM API
---------

from aether.platform.steam_api import SteamAPI

steam = SteamAPI()
steam.initialize(app_id=1234567)
steam.set_achievement("ACH_WIN_ONE_GAME")
steam.cloud_save("save.sav", data)


СТРУКТУРА ДВИЖКА
----------------

aether/
core/ - Ядро (Engine, Config, Input, Time, Console, SaveSystem)
graphics/ - Графика (Renderer, Shader, Mesh, Camera, Light, Water, Sky, Terrain, Particles)
scene/ - Сцена (Entity, Component, Scene, SceneGraph, SceneManager)
physics/ - Физика (PhysicsWorld, Collider, Rigidbody, Raycast, BulletBackend)
ai/ - AI (NavMesh, BehaviorTree)
network/ - Сеть (Client, Server)
audio/ - Аудио (AudioManager, Sound, Music)
ui/ - UI (Canvas, Button, Panel, Label, Font)
editor/ - Редактор (ImGui, Gizmo, DebugDraw)
environment/ - Окружение (TimeOfDay, Weather, Seasons)
resources/ - Ресурсы (ResourceManager, AssetDatabase, OBJ Loader, Texture Loader)
platform/ - Платформа (SteamAPI)
animation/ - Анимация (Skeleton, AnimationClip, Animator)
assets/ - Ассеты (AssetPipeline)
utils/ - Утилиты (Math, Logger, Profiler, ObjectPool)


ЗАВИСИМОСТИ
-----------

Базовая установка (обязательно):
numpy>=1.24, glfw>=2.6, PyOpenGL>=3.1.7, Pillow>=10.0

Аудио (опционально):
pygame>=2.5 (Python 3.10-3.12) или pygame-ce (Python 3.13+)

Физика (опционально):
PyBullet>=3.2.5 (требует Visual Studio Build Tools)
pymunk>=6.0 (альтернатива, не требует компиляции)

Полная установка:
Все выше + freetype-py, imgui, noise, pyyaml, imageio

Примечание по версиям Python:
Python 3.10-3.12: все пакеты доступны
Python 3.13+: используйте pygame-ce вместо pygame
Python 3.14+: PyBullet может не собраться, используйте pymunk


СИСТЕМНЫЕ ТРЕБОВАНИЯ
--------------------

Python 3.10+
OpenGL 4.6
Windows 10+ / Linux / macOS
Видеокарта с поддержкой OpenGL 4.6
4 GB RAM минимум


ЛИЦЕНЗИЯ
--------

MIT License. Используйте свободно в любых проектах.


Автор: entiti937
Версия: 1.0.2 - Исправлен импорт Engine и проблемы с новыми библеотеками, полная документация

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

aether_engine-1.0.2.tar.gz (105.3 kB view details)

Uploaded Source

Built Distribution

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

aether_engine-1.0.2-py3-none-any.whl (92.6 kB view details)

Uploaded Python 3

File details

Details for the file aether_engine-1.0.2.tar.gz.

File metadata

  • Download URL: aether_engine-1.0.2.tar.gz
  • Upload date:
  • Size: 105.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for aether_engine-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a794e226d493b16cabdaafb8174339b63f83abad11a24cec7c7c33a16e888d16
MD5 ea5fa2307b457d38a60bb9157edc2d39
BLAKE2b-256 8bf36395c5ed25fe2527d77a8f679c8e2f428fdff3987e4735fc96faff4b7994

See more details on using hashes here.

File details

Details for the file aether_engine-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: aether_engine-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 92.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for aether_engine-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3d00fed6c66fa5356fa71d62be2fa3f81d7006852d13136247ddc3c76bdc3eb5
MD5 c4380d9b617d2087af3198fb14e103d7
BLAKE2b-256 0f194a10468d070fa71ddfae9242804677c0dc4123923bae0aa11e56d8a3107f

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