NeoKolors.Tui.Lifecycle.Game2D 2026.4.0-preview.2

This is a prerelease version of NeoKolors.Tui.Lifecycle.Game2D.
dotnet add package NeoKolors.Tui.Lifecycle.Game2D --version 2026.4.0-preview.2
                    
NuGet\Install-Package NeoKolors.Tui.Lifecycle.Game2D -Version 2026.4.0-preview.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NeoKolors.Tui.Lifecycle.Game2D" Version="2026.4.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NeoKolors.Tui.Lifecycle.Game2D" Version="2026.4.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="NeoKolors.Tui.Lifecycle.Game2D" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NeoKolors.Tui.Lifecycle.Game2D --version 2026.4.0-preview.2
                    
#r "nuget: NeoKolors.Tui.Lifecycle.Game2D, 2026.4.0-preview.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NeoKolors.Tui.Lifecycle.Game2D@2026.4.0-preview.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NeoKolors.Tui.Lifecycle.Game2D&version=2026.4.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=NeoKolors.Tui.Lifecycle.Game2D&version=2026.4.0-preview.2&prerelease
                    
Install as a Cake Tool

NeoKolors.Tui.Lifecycle.Game2D

Build & Test NuGet Version NuGet Downloads License

NeoKolors.Tui.Lifecycle.Game2D is a dedicated 2D terminal game engine providing fixed-timestep game loops, 2D camera viewport transformations, and modular multi-stage rendering pipelines.


Architecture

                       ┌─────────────────────────┐
                       │       Game2DLoop        │
                       └────────────┬────────────┘
                                    │
            ┌───────────────────────┴────────────────────────┐
            ▼                                                ▼
┌────────────────────────┐                       ┌───────────────────────┐
│ FixedTimestep Tick     │                       │ Variable Render Tick  │
│  - Physics & Logic     │                       │  - Render2DPipeline   │
│  - 60 Hz deterministic │                       │  - Camera2D transform │
└────────────────────────┘                       └───────────┬───────────┘
                                                             │
                              ┌──────────────────────────────┼──────────────────────────────┐
                              ▼                              ▼                              ▼
                     ┌──────────────────┐           ┌──────────────────┐           ┌──────────────────┐
                     │ Background Stage │           │  Entities Stage  │           │    HUD Stage     │
                     └──────────────────┘           └──────────────────┘           └──────────────────┘

Core Components

1. Game Loop (Game2DLoop)

Game2DLoop drives the game execution, decoupling physics updates from rendering:

  • TargetFps: Target render framerate (e.g. 60 or 120 FPS).
  • FixedTicksPerSecond: Fixed simulation rate (default 60 Hz).
  • OnFixedUpdate: Dispatched for fixed physics/logic updates.
  • OnVariableUpdate: Dispatched per render frame with actual delta time.
using NeoKolors.Tui.Core;
using NeoKolors.Tui.Lifecycle.Game2D;

var screen = new NKCharScreen(new Size2D(120, 35));
var camera = new Camera2D(new Rect2D(0, 0, 120, 35));
var pipeline = new Render2DPipeline();

var loop = new Game2DLoop(screen, camera, pipeline) {
    TargetFps = 60,
    FixedTicksPerSecond = 60
};

loop.OnFixedUpdate += dt => {
    // 60 Hz physics update
    player.Update(dt);
    enemyManager.Update(dt);
};

2. 2D Camera (Camera2D)

Translates world coordinates to terminal character screen cells, supporting viewport scrolling, zooming, and tracking targets:

using NeoKolors.Tui.Lifecycle.Game2D;

var camera = new Camera2D(viewport: new Rect2D(0, 0, 80, 24));
camera.Position = player.Position; // Follow player

// Convert world point to screen coordinates
Point2D screenPos = camera.WorldToScreen(enemy.Position);

3. Modular Rendering Pipeline (Render2DPipeline & IGame2DStage)

Render passes are organized into cleanly isolated stages:

public class WorldEntitiesStage(GameState state) : IGame2DStage {
    public void Render(Game2DRenderContext context) {
        var screen = context.Screen;
        var camera = context.Camera;

        foreach (var entity in state.Entities) {
            var pos = camera.WorldToScreen(entity.Position);
            if (camera.IsVisible(pos)) {
                screen.Place(entity.Sprite, pos);
            }
        }
    }
}

// Register stages
pipeline.AddStage(new StarfieldStage());
pipeline.AddStage(new WorldEntitiesStage(gameState));
pipeline.AddStage(new ParticleEffectsStage());
pipeline.AddStage(new HudOverlayStage());

Complete Game Example

Check out Examples/ExampleGame2D.cs for Cosmic Invaders, a complete, playable 2D arcade terminal game built with this engine.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.4.0-preview.2 0 10/30/2026
2026.4.0-preview.1 59 10/23/2026