A modern, lightweight 2D game engine built with .NET 8, featuring high-performance rendering, networking support, and a custom asset pipeline. Designed for simplicity and moddability.
- Cross-platform support (Windows, Linux, macOS)
- Entity Component System architecture using DefaultEcs
- Scene management with hot reload support
- Flexible service container for dependency injection
- High-performance sprite batching with dynamic batching
- Camera system with zoom, rotation, and bounds
- Lighting system with up to 32 dynamic lights
- Normal mapping support
- Custom shader system with GLSL support
- Custom KPAK binary format with LZ4 compression
- Asynchronous asset loading with caching
- Texture, audio, JSON, and text asset support
- Package mounting system for mod support
- OpenAL-based audio engine
- 3D positional audio
- WAV file support with automatic format detection
- Audio clip and source management
- Built-in multiplayer with LiteNetLib
- Entity synchronization over network
- Remote Procedure Call (RPC) system
- Peer-to-peer and client-server architectures
- Unified input handling (keyboard, mouse, gamepad)
- Virtual axes and action mapping
- Gamepad support with multiple controller support
- .NET 8.0 SDK or higher
- OpenGL 3.3+ compatible graphics card
- OpenAL compatible audio device
using KitsuneEngine.Core;
public class SimpleGame : Game
{
protected override void LoadContent()
{
// Mount asset packages
var assets = Services.Get<AssetManager>();
assets.MountDirectory("Assets");
// Load a texture
var playerTexture = assets.LoadTexture("player.png");
// Play a sound
var audio = Services.Get<AudioSystem>();
audio.PlaySound("jump", 0.8f);
}
protected override void Update(float deltaTime)
{
// Game logic here
}
}KitsuneEngine/
├── Core/ - Game loop, scene management, ECS
├── Graphics/ - Rendering, textures, sprites, cameras
├── Audio/ - Sound system with OpenAL
├── Assets/ - Asset loading and KPAK format
├── Network/ - Multiplayer networking
├── Input/ - Input handling system
└── Components/ - Built-in ECS components
Kitsune Engine uses a custom binary format (.kpak) for packaging game assets:
// Pack assets from directory
var packer = new KpakPacker()
.SetCompression(true, LZ4Level.L04_HC);
packer.Pack("Assets/", "game.kpak");
// Load in game
assets.Mount("game.kpak");
var data = assets.LoadBytes("textures/player.png");Features:
- LZ4 compression for reduced file size
- FNV-1a hashing for fast asset lookup
- Streaming support for large assets
- Metadata storage for debugging
- Clone the repository:
git clone https://github.com/TamKungZ/Kitsune-2D-Game-Engine.git
cd Kitsune-2D-Game-Engine- Restore dependencies:
dotnet restore- Build the engine:
dotnet build -c Release- Create a new .NET console project:
dotnet new console -n MyGame
cd MyGame- Add reference to KitsuneEngine:
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\KitsuneEngine\KitsuneEngine.csproj" />
</ItemGroup>
</Project>- Create your game class and run it.
var world = new DefaultEcs.World();
var entity = world.CreateEntity();
entity.Set(new Transform { Position = new Vector2(100, 100) });
entity.Set(new Sprite { Texture = playerTexture });
entity.Set(new NetworkComponent { NetworkId = 1, IsOwner = true });public class MovementSystem : AComponentSystem<float, Transform, Velocity>
{
public MovementSystem(World world) : base(world) { }
protected override void Update(float deltaTime, ref Transform transform, ref Velocity velocity)
{
transform.Position += velocity.Value * deltaTime;
}
}public class NetworkedGame : Game
{
protected override void Initialize()
{
var network = new NetworkService(World);
network.StartServer(7777);
Services.Register(network);
}
}- Sprite batching supports up to 10,000 sprites per batch
- Asset caching reduces file I/O operations
- Network updates use delta compression
- ECS architecture ensures cache-friendly memory layout
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Silk.NET for cross-platform graphics and input
- DefaultEcs for the Entity Component System
- StbImageSharp for image loading
- LiteNetLib for networking capabilities
- All contributors and users of the engine
For questions, issues, or discussions, please use the GitHub Issues section of this repository.
Kitsune Engine - Made for developers who want to focus on making games, not fighting with complex engines.
