GameDev.Kit 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package GameDev.Kit --version 1.0.4
NuGet\Install-Package GameDev.Kit -Version 1.0.4
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="GameDev.Kit" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GameDev.Kit --version 1.0.4
#r "nuget: GameDev.Kit, 1.0.4"
#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.
// Install GameDev.Kit as a Cake Addin
#addin nuget:?package=GameDev.Kit&version=1.0.4

// Install GameDev.Kit as a Cake Tool
#tool nuget:?package=GameDev.Kit&version=1.0.4

GameDev.Kit v1.0.4

The game dev's kit for developing 2d console games


Use this library of classes to help speed up your game development process with pre-built Vectors and 2d Objects with Velocities and Positions. With a built-in game Loop method and Regenerate Map method, these three classes will help a bit.

C# Code Snippet:

public class Pong : Game
{
    private Object2D ball = new();
    public int Fps { get; set; }
    public override void StartGame(char[][] map, int fps)
    {
        Fps = fps;
        var perFrameOperations = new Operations(PerFrameOperations);
        var pixelsGenerate = new GeneratePixels(PixelsGenerate);
        StartGame(map, fps, perFrameOperations, pixelsGenerate);
    }
    // operations that are performed every frame
    private void PerFrameOperations()
    {
        float time = (1f / Fps) * 1000;
        ball.Move(time, out Vector previousPos);
    }
    // Writes specific characters to the console based on what is in the map's 2d array
    // e.g. the character 'P' on the map will cause this method to write the player ('■')
    // to the console, 'X' will write '█' to the console.
    private void PixelsGenerate(char[] row, char pixel)
    {
        Write(pixel switch
        {
            'X' => '█',
            'B' => '█',
            'P' => '■',
            _ => ' '
        });
    }
}

Classes and Properties


  • Vector: Has two properties: X and Y. Has a constructor that sets these two values to its parameters.
  • Object2D: Has two properties: A vector called Position, and a vector called Velocity. Has a Move method that updates the position of the object based on the length of a frame and the pixels per millisecond.
  • Game: Has a delegate void called Operations, which runs any Per-Frame operations, and another called GeneratePixels. See the below:
// Writes specific characters to the console based on what is in the map's 2d array
// e.g. the character 'P' on the map will cause this method to write the player ('■')
// to the console, 'X' will write '█' to the console.
private void PixelsGenerate(char[] row, char pixel)
{
    Write(pixel switch
    {
        'X' => '█',
        'B' => '█',
        'P' => '■',
        _ => ' '
    });
}
var pixelsGenerate = new GeneratePixels(PixelsGenerate);

The StartGame and RegenerateMap Methods


Game has a public boolean called Finished, whose default value is false, and the StartGame method loops through this boolean until it becomes true. In this loop, the map is first regenerated using the RegenerateMap method. The per-frame operations delegate is then called, and finally the Thread is put to sleep for one frame.

The RegenerateMap method loops through every row and character in the map, which is a 2d array of char. It calls the GeneratePixels delegate with the parameters being the current row and current pixel the loop is on.

Happy Game Developing!

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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • No dependencies.

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
1.1.5 396 7/11/2021
1.1.0 416 7/10/2021
1.0.9 417 7/10/2021
1.0.8 319 7/9/2021
1.0.7 291 7/9/2021
1.0.6 273 7/9/2021
1.0.4 320 7/8/2021
1.0.3 327 7/8/2021
1.0.2 316 7/8/2021
1.0.1 438 7/8/2021
1.0.0 266 7/8/2021

Bug fixes