Xengine is a comprehensive, modular game engine written entirely in C# targeting .NET 8.0. It provides a complete foundation for building 2D and 3D games with a component-based architecture.
- Application Management - Configuration, lifecycle management, and platform abstraction
- Time System - Delta time, fixed timestep, time scaling, and timer utilities
- Event System - Attribute-based and delegate-based event handling
- Logging - Multi-target logging with log levels and file output
- Thread Safety - Main thread dispatching and object pooling
- Vector Types - Vector2, Vector3, Vector4 with full operator support
- Quaternion - Rotation representation with Euler angle conversion
- Matrix4x4 - Transform matrices, projections, and view matrices
- Transform - Position, rotation, scale with parent-child relationships
- Geometry - Ray, Plane, Sphere, BBox, Rect for spatial calculations
- Color - RGB/HSV color representation and manipulation
- Random - Game-friendly random number generation
- Scene Graph - Hierarchical game object management
- GameObject - Entity container with transform and component system
- Component - Modular behavior system with lifecycle callbacks
- GameTransform - Local and world space transformations
- Camera - Perspective and orthographic projection
- Mesh Renderer - Basic mesh rendering support
- Materials - Color, texture, and PBR properties
- Lighting - Directional, point, and spot lights
- Rigid Bodies - Mass, velocity, forces, and collision response
- Colliders - Box, sphere, capsule, and mesh colliders
- Raycasting - Ray intersection queries
- Trigger System - Non-physical collision detection
- Audio System - Sound playback management
- Audio Source - 3D positional audio
- Audio Clips - Sound data loading and caching
- Audio Mixer - Volume groups and effects
- Keyboard - Key states, press, and release detection
- Mouse - Position, buttons, scroll wheel
- Input Actions - Rebindable input abstraction
- Canvas - Screen-space UI rendering
- Elements - Panel, Text, Button, Image, InputField, Slider, Toggle
- Layout - Anchoring and pivot-based positioning
- Resource Manager - Asset loading and caching
- File System - Virtual file system with mount points
- Resource Types - Text, binary, JSON, prefabs
- Server/Client - TCP-based networking
- Message System - Serialized network messages
- Connection Management - Client tracking and events
Xengine/
├── Source/
│ ├── Xengine.Core/ # Core utilities and application
│ ├── Xengine.Math/ # Mathematical types and functions
│ ├── Xengine.Events/ # Event system
│ ├── Xengine.FileSystem/ # Virtual file system
│ ├── Xengine.Scene/ # Scene graph and components
│ ├── Xengine.Rendering/ # Rendering system
│ ├── Xengine.Physics/ # Physics simulation
│ ├── Xengine.Audio/ # Audio system
│ ├── Xengine.Input/ # Input handling
│ ├── Xengine.UI/ # User interface
│ ├── Xengine.Resources/ # Asset management
│ ├── Xengine.Network/ # Networking
│ ├── Xengine.Engine/ # Main engine coordinator
│ ├── Xengine.Launcher/ # Application entry point
│ └── Xengine.Sample/ # Sample game code
└── Xengine.sln # Visual Studio solution
- .NET 8.0 SDK
- Windows, macOS, or Linux
.\run.ps1cd Xengine
dotnet build
dotnet run --project Source/Xengine.Launcher# Debug build
dotnet build -c Debug
# Release build
dotnet build -c Releaseusing Xengine.Core;
using Xengine.Engine;
using Xengine.Scene;
using Xengine.Math;
// Configure and create engine
var config = new ApplicationConfig
{
Name = "My Game",
WindowWidth = 1280,
WindowHeight = 720
};
using var engine = new Engine(config);
engine.Initialize();
// Create a scene
var scene = engine.LoadScene("MainScene");
// Create a camera
var cameraObj = scene.CreateGameObject("Camera", new Vector3(0, 5, -10));
var camera = cameraObj.AddComponent<CameraComponent>();
cameraObj.Transform.LookAt(Vector3.Zero);
// Create a game object with custom component
var player = scene.CreateGameObject("Player");
player.AddComponent<PlayerController>();
// Run the game
engine.Run();public class PlayerController : Component
{
public float Speed = 5f;
protected override void OnUpdate()
{
var input = InputSystem.Instance;
var move = Vector3.Zero;
if (input.IsKeyDown(KeyCode.W)) move.Z += 1;
if (input.IsKeyDown(KeyCode.S)) move.Z -= 1;
if (input.IsKeyDown(KeyCode.A)) move.X -= 1;
if (input.IsKeyDown(KeyCode.D)) move.X += 1;
Transform.Position += move.Normalized * Speed * Time.Delta;
}
}| Argument | Description |
|---|---|
-headless |
Run without graphics window |
-editor |
Enable editor mode |
-width <n> |
Set window width |
-height <n> |
Set window height |
-fullscreen |
Start in fullscreen mode |
Xengine follows a modular, layered architecture:
- Core Layer - Basic utilities, logging, time management
- Math Layer - Mathematical types independent of engine
- Systems Layer - Independent subsystems (physics, audio, input)
- Scene Layer - Game object and component management
- Engine Layer - Coordination of all systems
- Application Layer - Game-specific code
This project is provided as-is for educational and development purposes.
Contributions are welcome! Please feel free to submit issues and pull requests.






