Mtf.Games
1.0.5
dotnet add package Mtf.Games --version 1.0.5
NuGet\Install-Package Mtf.Games -Version 1.0.5
<PackageReference Include="Mtf.Games" Version="1.0.5" />
<PackageVersion Include="Mtf.Games" Version="1.0.5" />
<PackageReference Include="Mtf.Games" />
paket add Mtf.Games --version 1.0.5
#r "nuget: Mtf.Games, 1.0.5"
#:package Mtf.Games@1.0.5
#addin nuget:?package=Mtf.Games&version=1.0.5
#tool nuget:?package=Mtf.Games&version=1.0.5
Mtf.Games
A lightweight, custom C# 2D game engine and arcade game collection. Built on bespoke rendering (Mtf.Drawing) and input abstractions, this framework is designed to make implementing classic 2D arcade games fast, modular, and intuitive.
Included Games
CircleEater
An Agar.io-style survival game where the player controls a circle and must consume wandering enemy circles to grow.
- Objective: Consume all enemy circles (default: 15) on the canvas to win.
- Rules: You can only eat circles smaller than your current size. Every time you consume an enemy, your circle's radius increases.
- Game Over: Colliding with an enemy circle that is larger than your player circle.
Snake (Wormy)
A custom take on the classic snake game, built visually using connected circle primitives (CirclePrimitive).
- Objective: Navigate the canvas to consume randomly generated food, score points, and grow your worm.
- Rules: The worm grows longer based on the randomly generated nutritional value of the food consumed.
- Game Over: Colliding with the screen boundaries or the worm's own body. The player wins by reaching the maximum score (1000 points).
Architecture Overview
The framework relies heavily on dependency injection and specific interfaces to keep the game logic completely decoupled from the rendering and physical input layers:
GameEngineBase: The core abstract class managing the primaryGameLoop(), pause states, frame pacing, and game-over/victory sequences.IGameContext: An aggregate interface combiningICanvas,IInputContext,IAudioContext, andIApplicationContext. It provides everything a game instance needs to interact with the host system.ICanvas: Handles the physical dimensions of the screen and the rendering of shapes (likeCirclePrimitiveandTextPrimitive).IInputContext/IButtonStates: Abstracts keyboard or controller inputs into simple, readable boolean checks (e.g.,IsUpButtonPressed()).IMoveable&IDirectable: General interfaces for standardizing movement and directional heading for entities.
Getting Started
To run or extend this project, you need a .NET environment that implements the required UI/rendering frontend (e.g., WinForms, WPF, MonoGame, or a custom display matrix) mapping to the Mtf.Drawing abstraction.
- Implement the
IGameContextinterface in your host application to handle drawing and input. - Instantiate either
CirclesGameEngineorSnakeGameEngine, passing your custom context into the constructor. - Call
.GameLoop()to start playing.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- Mtf.Drawing (>= 1.0.9)
- System.Drawing.Common (>= 10.0.8)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Mtf.Games:
| Package | Downloads |
|---|---|
|
Mtf.Lego.Mindstorms.EV3
Library for interacting with Lego Mindstorms EV3 robots. |
GitHub repositories
This package is not used by any popular GitHub repositories.