GameDev.Kit 1.1.5

dotnet add package GameDev.Kit --version 1.1.5
NuGet\Install-Package GameDev.Kit -Version 1.1.5
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.1.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GameDev.Kit --version 1.1.5
#r "nuget: GameDev.Kit, 1.1.5"
#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.1.5

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

GameDev.Kit v1.1.5

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 Snippets:

public class Pong : IGame
{
    private Object2D ball = new();
    public void PerFrameOperations(int fps, ref char[][] map, ref bool finished, int frame)
    {
        float time = (1f / fps) * 1000;
        ball.Move(time, fps, out Vector previousPos);
    }
    public void OnGenerate(char[][] map, char[] row, char pixel)
    {
        Write(pixel switch
        {
            'X' => '█',
            'B' => '█',
            'P' => '■',
            ' ' => ' '
        });
    }
}
static void Main(string[] args)
{
    var map = new char[][]
    {
        new char[] {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
        new char[] {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
        new char[] {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
        new char[] {'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X'},
        new char[] {'X', ' ', ' ', ' ', ' ', ' ', 'P', ' ', ' ', ' ', ' ', ' ', ' ', 'X'},
        new char[] {'X', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'X'},
        new char[] {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
        new char[] {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
        new char[] {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '},
    }
    IGame pong = new Pong();
    pong.StartGame(map, 30);
}

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.

The IGame Interface


The IGame Interface is to be implemented by the class that controls per-frame operations and re-generating the map. To implement the interface, a void named PerFrameOperations needs to be added to the class, as well as a void named regenerateMap, which has two parameters, a char[] called row, which is the current row that is being generated, and a char called pixel, which is the pixel about to be generated. You can see the following implemented class below:

public class Pong : IGame
{
    private Object2D ball = new();
    public void PerFrameOperations(int fps, ref char[][] map, int frame)
    {
        float time = (1f / fps) * 1000;
        ball.Move(time, fps, out Vector previousPos);
    }
    public void OnGenerate(char[][] map, char[] row, char pixel)
    {
        Write(pixel switch
        {
            'X' => '█',
            'B' => '█',
            'P' => '■',
            ' ' => ' '
        });
    }
}

The StartGame method in the interface will regenerate the map, run any per-frame operations, and put the Thread to sleep for one frame. It will loop like this until finished is set to true.

The regenerateMap method will run the OnGenerate method for every pixel and row it iterates through. The following example shows a sample 'OnGenerate' method:

public void OnGenerate(char[][] map, char[] row, char pixel)
{
    Write(pixel switch
    {
        'X' => '█',
        'B' => '█',
        'P' => '■',
        ' ' => ' '
    });
}

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 392 7/11/2021
1.1.0 416 7/10/2021
1.0.9 416 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