No description
Find a file
David Täljsten ea1076816f Add play-mode runner and viewport camera
Introduce EditorSceneRunner to snapshot/restore scenes and run a play-mode instance (Play/Pause/Stop) inside the editor. Integrate the runner into EditorGame and ViewportPanel so the viewport uses the active game Camera during play, disables editor camera input while playing, and wires the Play/Pause/Stop buttons. Make SceneSerializer public for runtime use, poll the runner from EditorGame.Update, and ensure Time.TimeScale and InputManager are used for pause/resume and per-frame updates. Update docs to mark play-mode features complete and add a sample scene JSON.
2026-02-21 18:23:16 +01:00
.github Initial Spelusion.Engine2D project scaffold 2026-02-07 17:32:47 +01:00
Spelusion.Engine2D Add scene serialization, file dialog & editor IO 2026-02-21 17:18:27 +01:00
Spelusion.Engine2D.Core/Docs Add WPF Editor UI and scripting attributes 2026-02-21 11:47:28 +01:00
Spelusion.Engine2D.Demo Add scene serialization, file dialog & editor IO 2026-02-21 17:18:27 +01:00
Spelusion.Engine2D.Editor Add play-mode runner and viewport camera 2026-02-21 18:23:16 +01:00
Spelusion.Engine2D.Tests Implement Phase 3 systems and demo 2026-02-07 21:50:07 +01:00
TestGame1 Add play-mode runner and viewport camera 2026-02-21 18:23:16 +01:00
.gitignore Initial Spelusion.Engine2D project scaffold 2026-02-07 17:32:47 +01:00
build.cmd Implement Phase 3 systems and demo 2026-02-07 21:50:07 +01:00
build.ps1 Implement Phase 3 systems and demo 2026-02-07 21:50:07 +01:00
build.sh Implement Phase 3 systems and demo 2026-02-07 21:50:07 +01:00
BUILD_SYSTEM.md Implement Phase 3 systems and demo 2026-02-07 21:50:07 +01:00
ENGINE_DEVELOPMENT_PLAN.md Add WPF Editor UI and scripting attributes 2026-02-21 11:47:28 +01:00
README.md Add Phase 2 demo, scenes, serialization & tests 2026-02-07 18:16:51 +01:00
Spelusion.Engine2D.slnx Add MonoGame-based Editor project 2026-02-21 12:42:03 +01:00

Spelusion.Engine2D

A feature-rich 2D game engine built on MonoGame with Unity-like Entity Component architecture.

License .NET MonoGame

?? Overview

Spelusion.Engine2D is a modern 2D game engine designed for developers who want Unity-like workflows with C# and MonoGame. It features:

  • Entity Component Architecture (Unity-like, NOT data-oriented ECS)
  • Scene Management with JSON serialization
  • Texture Atlas Support (TexturePacker integration)
  • 2D Camera System with orthographic projection
  • Input System with action mapping
  • Audio System with spatial audio support
  • Decoupled Editor (separate project)

Important: This engine uses Entity Component (EC) architecture, similar to Unity's classic GameObject system, NOT data-oriented Entity Component System (ECS) patterns.

?? Current Status

? Completed Phases

Phase 1: Foundation (Weeks 1-3)

  • Core engine structure with GameManager
  • Asset management system with TextureAtlas support
  • Input system with keyboard/gamepad/mouse
  • Audio system with SoundEffect/Song support
  • Time management and logging utilities
  • Unit tests for core systems

Phase 2: Entity Component System (Weeks 4-6)

  • Complete Entity Component architecture
  • Transform, Sprite, and Camera components
  • Scene management with lifecycle methods
  • JSON serialization for scenes and entities
  • Prefab system with instantiation
  • Working demo with ghostly01 texture atlas
  • Comprehensive unit and integration tests

?? Next Phase: Phase 3 (Weeks 7-9)

  • Collision and physics system
  • State machine system
  • Particle system
  • UI framework

??? Architecture

Entity Component (EC) Pattern

// Create an entity
var player = new Entity("Player");
player.Tag = "Player";

// Add components
var sprite = new Sprite();
sprite.SetSprite(textureAtlas, "ghost-idle-01");
player.AddComponent(sprite);

// Add to scene
scene.AddEntity(player);

Scene Management

// Create and load scene
var scene = new Scene("MainScene");
scene.Load();

// Update and render
scene.Update(gameTime);
scene.Draw(spriteBatch, gameTime);

?? Installation

Prerequisites

  • .NET 10.0 SDK
  • MonoGame 3.8.4.1

Clone and Build

git clone https://git.spelusion.com/david/Spelusion.Engine2D.git
cd Spelusion.Engine2D
dotnet build

Run Demo

cd Spelusion.Engine2D.Demo
dotnet run

?? Documentation

Core Documentation

Usage Examples

?? Testing

Run unit tests:

dotnet test

?? Features

? Implemented

  • Entity Component architecture (Unity-like)
  • Scene management with serialization
  • Texture atlas support (TexturePacker JSON)
  • 2D camera system with zoom/rotation
  • Input system with action mapping
  • Audio system with spatial audio
  • JSON serialization for all data
  • Prefab system
  • Object pooling for performance
  • Comprehensive logging and error handling

?? In Development

  • Collision detection and physics
  • State machine system
  • Particle effects
  • UI framework

?? Planned

  • Decoupled editor application
  • Animation system
  • Tilemap support
  • Plugin system
  • Advanced audio features

??? Project Structure

Spelusion.Engine2D/
??? Core/                    # GameManager, Time, Configuration
??? Assets/                  # AssetRepository, TextureAtlas
??? Scenes/                  # Entity, Components, Scene management
??? Input/                   # InputManager, KeyBinding
??? Audio/                   # AudioPlayer, Sound management
??? Serialization/           # JSON converters, SerializationManager
??? Prefabs/                 # Prefab system
??? Extensions/              # SpriteBatch extensions
??? Helpers/                 # DebugGraphics, GameTimer
??? Docs/                    # Documentation

Spelusion.Engine2D.Demo/     # Demo application
Spelusion.Engine2D.Editor/   # Editor application (future)
Spelusion.Engine2D.Tests/    # Unit and integration tests

?? Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Update documentation
  6. Submit a pull request

?? License

This project is licensed under the MIT License - see the LICENSE file for details.

?? Acknowledgments

  • Built on MonoGame framework
  • Inspired by Unity's component architecture
  • Texture atlas support via TexturePacker

?? Support

For questions, issues, or contributions:


Version: 0.2.0 (Phase 2 Complete)
Last Updated: 2024
Engine Architecture: Entity Component (EC) - Unity-like