Skip to content

L-N-X-1/NextGenEngine

Repository files navigation

NextGenEngine Logo

NextGenEngine

A C# game engine built on .NET 10 with an integrated ImGui editor — no separate editor/runtime split. The executable is the editor, like Unity.

Built with Silk.NET for windowing, OpenGL, and input. Editor UI powered by Dear ImGui via ImGui.NET.


Features

  • Integrated editor — windowed editor with dockable panels; switch to full-screen play mode instantly
  • Entity Component System (ECS) — lightweight entity/component architecture with typed and untyped APIs
  • ImGui editor panels
    • Hierarchy — list, select, create, duplicate, delete entities
    • Inspector — edit component values (position, rotation, scale, tag); add/remove components via dropdown
    • Viewport — game renders into an OpenGL framebuffer displayed as an ImGui image; pan with middle-mouse, zoom with scroll wheel, click to select entities
    • Assets — recursive browser of the Assets/ folder
    • Console — color-coded log with Info / Warning / Error filters and auto-scroll
  • Editor & play modes — editor mode pauses game logic; play mode hides panels and runs the full game loop; Escape returns to editor
  • Scene serialization — save and load scenes as .ngs JSON files
  • Static LoggerLogger.Info/Warn/Error feeds the console panel from anywhere in the engine

Getting Started

Prerequisites

Build & Run

git clone https://github.com/L-N-X-1/NextGenEngine.git
cd NextGenEngine
dotnet run

The editor window opens immediately. No project setup required.


NuGet Dependencies

Package Version
Silk.NET.Windowing 2.23.0
Silk.NET.OpenGL 2.23.0
Silk.NET.OpenGL.Extensions.ImGui 2.23.0
Silk.NET.Input 2.23.0
Silk.NET.Maths 2.23.0

ImGui.NET is a transitive dependency of Silk.NET.OpenGL.Extensions.ImGui.


Project Structure

NextGenEngine/
├── Core/
│   ├── Engine.cs           # Main loop, mode switching, owns all subsystems
│   └── Logger.cs           # Static logger; feeds the Console panel
├── Rendering/
│   ├── Renderer.cs         # OpenGL wrapper, clear color
│   └── Framebuffer.cs      # FBO + color texture + depth RBO; used for viewport
├── Input/
│   └── InputManager.cs     # Keyboard/mouse state; exposes IInputContext for ImGui
├── ECS/
│   ├── ECS.cs              # Entity struct, IComponent, ComponentStore
│   ├── EntityManager.cs    # Create/destroy entities; CreateEntityWithId for deserialization
│   └── Components.cs       # TransformComponent, TagComponent
├── Scenes/
│   ├── SceneManager.cs     # Holds active scene; forwards Update/Render
│   ├── MainScene.cs        # Default scene — WASD player movement
│   └── SceneSerializer.cs  # Save/load scenes as .ngs JSON
├── Assets/
│   └── AssetManager.cs     # String-keyed asset cache
└── Editor/
    ├── EditorManager.cs    # Orchestrates panels, dockspace, menu bar
    ├── EditorCamera.cs     # Viewport pan/zoom
    └── Panels/
        ├── HierarchyPanel.cs
        ├── InspectorPanel.cs
        ├── ViewportPanel.cs
        ├── AssetsPanel.cs
        └── ConsolePanel.cs

Editor Controls

Action Input
Pan viewport Middle-mouse drag
Zoom viewport Scroll wheel
Select entity Left-click in Viewport
Create entity Right-click in Hierarchy → Create Empty Entity
Delete entity Right-click entity in Hierarchy → Delete
Add component Inspector → Add Component button
Remove component Right-click component header in Inspector
Save scene File → Save Scene (saves to scene.ngs)
Load scene File → Open Scene (loads from scene.ngs)
Enter play mode Play button in menu bar
Exit play mode Escape key

Scene Files

Scenes are saved as .ngs JSON files (NextGenScene). Each entity and its components are fully serialized.

{
  "SceneName": "MainScene",
  "Entities": [
    {
      "Id": 0,
      "Components": [
        {
          "TypeName": "NextGenEngine.ECS.TransformComponent, NextGenEngine",
          "Data": { "Position": { "X": 400, "Y": 300 }, "Scale": { "X": 1, "Y": 1 }, "Rotation": 0 }
        },
        {
          "TypeName": "NextGenEngine.ECS.TagComponent, NextGenEngine",
          "Data": { "Tag": "Player" }
        }
      ]
    }
  ]
}

Extending the Engine

Add a new component

  1. Create a class in ECS/Components.cs implementing IComponent with public settable properties and a parameterless constructor.
  2. Register it in InspectorPanel._addable to make it available in the editor dropdown.

Add a new scene

public class MyScene : Scene
{
    public override void Load()   { /* create entities */ }
    public override void Update(double dt) { /* game logic */ }
    public override void Render(double dt) { /* draw calls */ }
}

// Load it:
Engine.Instance.SceneManager.LoadScene(new MyScene());

Log from anywhere

Logger.Info("Something happened.");
Logger.Warn("Watch out.");
Logger.Error("Something broke.");

Roadmap

  • Sprite rendering (textured quads)
  • Physics component (Box2D or custom)
  • Audio system
  • Prefab system
  • Undo/redo in editor
  • File dialog for scene open/save
  • Multiple viewport cameras
  • Asset hot-reloading

License

MIT

About

NextGenEngine is a lightweight, integrated game engine featuring a Dear ImGui-powered editor, an Entity Component System (ECS), and OpenGL rendering via Silk.NET. Open it, build a scene, hit Play — all in one window.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages