DaveGreen.ShapeEngine 5.0.0

Prefix Reserved
dotnet add package DaveGreen.ShapeEngine --version 5.0.0
                    
NuGet\Install-Package DaveGreen.ShapeEngine -Version 5.0.0
                    
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="DaveGreen.ShapeEngine" Version="5.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DaveGreen.ShapeEngine" Version="5.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DaveGreen.ShapeEngine" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DaveGreen.ShapeEngine --version 5.0.0
                    
#r "nuget: DaveGreen.ShapeEngine, 5.0.0"
                    
#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.
#:package DaveGreen.ShapeEngine@5.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DaveGreen.ShapeEngine&version=5.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DaveGreen.ShapeEngine&version=5.0.0
                    
Install as a Cake Tool

My custom-made engine based on the great Raylib Framework. The Main focus is being performant and only using draw functions instead of textures.

When using Shape Engine everything from Raylib is available as well. (Raylib ExamplesRaylib Cheatsheet)

Shape Engine´s examples are available on Itch as well and it is a great way to support me 😉

You are free to use Shape Engine or any part of Shape Engine for your own projects, but keep in mind that Shape Engine was designed to help me with my specific game dev needs. Nevertheless I am looking forward to creations that Shape Engine made possible 😃

Release Trailer 5.0 Release Trailer 3.0 Release Trailer 2.0 Release Trailer 1.0

Getting Started & Documentation

This repository includes an Examples Project to showcase the capabilities of ShapeEngine and help you get started quickly. Explore the examples to see what’s possible and how to implement different features.

  • Documentation:
    Documentation is available here.

  • Documentation Source:
    You can find the documentation repository here.

For any issues, suggestions, or questions about the docs, please open an issue in the ShapeEngineDocs repository.

Development Process

The Main Branch contains the current development stage. You can follow the development process here:

Installation / How to Use

There are multiple ways to use Shape Engine:

  1. Create a new solution & project and download Shape Engine from the Nuget manager. (Recommended)
dotnet add package DaveGreen.ShapeEngine
  1. Clone or fork the repository and add new projects to the solution. You then can reference the Shape Engine project and start working on your game. The advantages are that you can easily change things in Shape Engine and everything updates automatically in your own project.
  2. Create a new solution & project in a .net IDE. (Visual Studio / JetBrains Rider for example). Download or fork ShapeEngine and either create a local nuget package or build the solution to create all necessary dll files.
  3. [Using a local Nuget Package] Create a folder on your machine called something like “Local Nuget Packages” and copy the ShapeEngine Nuget package that you created to this folder. (You can also add the Shape Engine Nuget package directly to your Project). Now you need to create a new Package source in the Nuget Manager that points to your “Local Nuget Packages” Folder. This source can be used in your Nuget Manager to find and install the Shape Engine Nuget Package.
  4. You manually copy all needed DLL files to your project. You need the following DLLs: Clipper2Lib, Raylib-Cs, Microsoft.Toolkit.HighPerformance, Shape Engine Core, Raylib. All DLL files except Raylib can be anywhere in your projects folder hierarchy. The Raylib DLL must be on the root level of your project. You need to select the right Raylib DLL for your operating system. Now just add a reference for all DLLs except the Raylib DLL and you are done. On MacOS you need to do the same step except using the .dylib file instead of the raylib DLL. You need to set the property “Copy if Newer” to true on the .dylib file. Then everything should work.
  5. Create a new solution & project and just add the Shape Engine Core DLL to your project and reference it. Now you need to download the right version of the Raylib_CsLo & Clipper2 Nuget packages. The releases on GitHub will state which versions were used.

Minimal Project Setup

using System.Drawing;
using ShapeEngine.Color;
using ShapeEngine.Core;
using ShapeEngine.Core.Structs;
using ShapeEngine.Geometry;
using ShapeEngine.Geometry.RectDef;

namespace ShapeEngineProject;   
public static class Program
{
    public static void Main(string[] args)
    {
	    var game = new MyGameClass
		(
			GameSettings.StretchMode("Shape Engine Game"),
			WindowSettings.Default,
			FramerateSettings.Default,
			InputSettings.Default
		);
	    game.Run();
    }
}

public class MyGameClass : Game
{
    //Gives you static access to the instance of MyGameClass - If you do not need/want this, you can remove it.
    public new static MyGameClass Instance  => myInstance?? throw new NullReferenceException("Instance is not initialized! You need to create a MyGameClass instance before accessing this property!");
    private static MyGameClass? myInstance;
    
    public MyGameClass(
		GameSettings gameSettings, WindowSettings windowSettings,
		FramerateSettings framerateSettings, InputSettings inputSettings)
		: base(gameSettings, windowSettings, framerateSettings, inputSettings)
    {
        //Game.Instance is already checked to never be instantiated twice, so this is safe
        myInstance = GetInstanceAs<MyGameClass>();
    }
    
    protected override void DrawGame(ScreenInfo game)
    {
        game.Area.Draw(new ColorRgba(Color.DarkOliveGreen));
        game.Area.DrawLines(12f, new ColorRgba(Color.AntiqueWhite));
        game.MousePos.Draw(24f, new ColorRgba(Color.Lime), 36);
    }
}

Examples

You can download the newest builds of the Example Project on Itch io. You can clone the repo and inspect the example projects there as well.

  • Examples are simple scenes that focus on one specific area or feature of Shape Engine.
  • Examples showcase the various capabilities of Shape Engine, allowing users to explore various features.
  • The examples cover all major features of Shape Engine, ensuring that users can grasp its full potential.

Features

In general my goal is to provide the most relevant system a game dev needs without adding a solution for every possible problem.

Dependencies

I am just using the Raylib Cs c# bindings and the Cipper2 library for polygon clipping.

If you use the nuget manager to download Shape Engine as a nuget package you don't have to take care of any dependencies, because they will be downloaded automatically.

Limitations

There is no physics system because I don´t need one and would´t know how to make one. There is complete collision system but the collision response is up to you. You can also use raylibs physics system.

History

I made Shape Engine because I wanted to help myself make games with a specific art style and certain limitations. At first, it started out with some helper scripts but now it is a relatively sophisticated system to make games with raylib. Certain parts of the basic game loop are inspired by Bytepath and other things I already used in games that I made myself (especially Fracture Hell). Feel free to use any single part if you don´t want to use the whole package.

Contact

If you have an issue, or a suggestion for a new feature GitHub is the best way to get in contact with me.

On these platforms you can follow the development process of Shape Engine, get in contact with me and always stay up date.

Linktree

https://linktr.ee/davegreen.games

https://linktr.ee/shapeengine

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

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
5.0.0 99 4/24/2026
4.0.5 598 6/24/2025
4.0.4 476 5/30/2025
4.0.3 476 5/28/2025
4.0.2 210 5/27/2025
4.0.1 221 5/22/2025
4.0.0 258 5/16/2025
3.1.0 280 12/15/2024
3.0.0 194 12/9/2024
2.4.0 246 11/6/2024
2.3.1 199 10/23/2024
2.3.0 202 10/21/2024
2.2.0 205 10/4/2024
2.1.1 237 9/11/2024
2.1.0 196 9/8/2024
2.0.2 206 8/30/2024
2.0.1 218 8/29/2024
2.0.0 197 8/29/2024
1.0.3 260 6/5/2024
1.0.2 216 6/1/2024
Loading failed

#Summary
The 5.0 release is focused on refactoring and cleanup of existing systems while also introducing a selection of targeted new features to make the engine cleaner, faster, and easier to extend.
First of all, the input system was overhauled: there is a new InputActionSettings struct, a redesigned gesture system, and improved gamepad handling. The most notable fix is that gamepads now work on macOS again.
Next, the collision system was decoupled from the spatial-partitioning system to allow custom broadphase implementations. The pathfinding system received several improvements and an optional parallelization mode, allowing path requests to be handled concurrently rather than sequentially. The collision system also gained partial parallelization, allowing parts of the collision-detection algorithm to run in parallel.
A new resource-packer project was added to bundle resources into text or binary packs, and the ShapeEngine content system was updated to support these packs. Alongside this, I cleaned up and modernized the legacy content system and added simple JSON and XML serializer classes to replace the old, JSON-only serializer. I also included example scenes for JSON and XML serialization; these scenes can load custom JSON and XML files to alter scene behavior at runtime.
Many drawing APIs were modernized, renamed, and decluttered. Drawing functions are now all grouped within each shape. New MaskedDrawing* functions were implemented, and StripedDrawing* was overhauled and modernized. Several GitHub workflows were added to simplify repository and engine maintenance.

#Changelog
##Input System
- [BREAKING] Input system improvements.
- [NEW] InputGesture system added  (LongPress, DoubleTap, etc.).
- [NEW] InputDeviceSettings struct added for easier setup of the input system.
- [NEW] InputActionSettings struct added for easier setup of input actions.
- [NEW] Automated system for applying the current gamepad mappings added (gamepads now works on macOS).
- [UPDATE] Gamepad management improved.

##Collision System
- [BREAKING] Collision system improved.
- [BREAKING] Collision system separated from spatial partitioning algorithm to allow use of custom algorithms.
- [NEW] Optional parallelization features for better performance added (allows to run certain parts of the collision detection algorithm concurrently).
- [NEW] MotionType and BroadphaseType enums added to the collision system.

##Pathfinding
- [BREAKING] Pathfinding system improved.
- [NEW] Optional parallelization features for PathRequest handling added.

##Savegame
- [BREAKING] Savegame system improved.
- [NEW] Savegame folder is now automatically created based on ApplicationName and SaveDirectory.
- [NEW] Automated savegame backup system added (automatically creates a backup folder in the savegame directory and it can create and apply backups).

##Docs
- [NEW] XML summaries added to every class, member, and function that is public.

##Drawing
- [BREAKING] Overhaul of all outline drawing functions of all closed shapes and polyline to allow using transparent colors without overlapping artifacts.
- [NEW] MaskedDrawing* functions added (Allows to only draw a shape or shape outline within a certain area or outside of a certain area).
- [NEW] StripedDrawing* overloads added.
- [UPDATE] Striped drawing functions improved.
- [UPDATE] Striped drawing functions moved into shape structs/classes.

##Workflows
- [NEW] Workflow added to automatically update the gamepad mappings file once a month (SDL GameController DB is used as source).
- [NEW] Workflow added to automatically keep ShapeEngines dependencies up to date (raylib and Clipper2).
- [NEW] Workflow added to automatically attach Example project builds to new releases.
- [NEW] Workflow added to upload ShapeEngine nuget packages to nuget.org (manually triggered only).

##Core
- [NEW] ApplicationName property added (used for setting up the savegame folder).
- [NEW] ShapeEngine now handles capping of FrameRate to the set FrameRateLimit.
- [NEW] AdaptiveFpsLimiter class added.
- [NEW] MacOS app bundling and packaging support for Examples added.
- [NEW] New VsyncMode enum added. (Disabled, Half, Normal, Double, Quadruple)
- [UPDATE] VSync now works better and no longer disrupts fullscreen (If VSyncMode is enabled the FrameRateLimit is automatically set to the refresh rate of the current monitor based on the VsyncMode).
- [NEW] New AdaptiveFpsLimiter classed implemented. Automatically adjust fps limit to find highest frame rate that can be sustained without dips. Works with all VsyncModes and with uncapped frame rate limit (frame rate limit <= 0).
- [NEW] Idle detection implemented. Engine now detects if no input was received for a certain amount of time and idle mode will be triggered. (GameSettings parameter added to customize behavior)
- [NEW] Idle frame rate limit system implemented. When idle mode is triggered and GameSettings.IdleFrameRateLimit is set, the engine will be limited to this frame rate until the idle mode ends.
- [NEW] Unfocused frame rate limit system implemented. When the window looses focus and WindowSettings.UnfocusedFrameRateLimit is set, the engine will be limited to this frame rate until the window gains focus again.
- [NEW] Added new FixedDelta property to the GameTime class to properly distinguish between fixed and open delta values.
- [BREAKING] Added a new FramerateSettings struct. Framerate specific settings from GameSettings and WindowSettings were moved to FramerateSettings.
- [NEW] Dynamic substepping properties added to FramerateSettings. Dynamic substepping splits up large frame deltas into multiple smaller update cycles. It works similar to fixed update but it only comes into play with extreme frame rate drop to keep the update delta consistent.
- [NEW] MaxDelta property added to FramerateSettings. The MaxDelta value is used to cap the maximum allowed frame delta each frame.
- [BREAKING] Reworked the entire fixed update system.
- [NEW] Added HandleInput() method to the game loop hierarchy (Game, Scene, CustomEvent)
- [BREAKING] Clipper2 wrapper system completely overhauled and improved (cleaner api, less memory allocations, moved to Path64 from PathD for better accuracy, and much more)
- [UPDATE] .net 8.0 updated to .net 10.0

##Shapes
- [NEW] Polygon GetIncircle() function added
- [NEW] Polygon Round()/RoundCopy() functions added
- [NEW] Polygon ToAbsolute() function added
- [NEW] Polygon GetPreviousVertex()/GetNextVertex() and GetPreviousIndex()/GetNextIndex() functions added.
- [NEW] Polygon GenerateOutlineTriangulation function added
- [NEW] Polygon Triangulate() overload added with ref parameter (reduce allocations)
- [NEW] Various new  geometric functions added to certain Shapes.

##Misc
- [BREAKING] Pool System overhauled and drastically simplified.
- [NEW] PerlinNoise class added (thanks to Fixin).
- [NEW] ResourcePacker project added - Allows packing/ unpacking of resources to text or binary files.
- [NEW] DebugLogger class added (allows to print information to console and/or to a log file).
- [UPDATE] A lot of misc fixes, improvements, and clean up.
- [UPDATE] Better polygon bounding circle algorithm implemented.
- [UPDATE] Clipper2 library updated to v2.0
- [NEW] PerformanceMeasureWatch class added.
- [NEW] MacOS app bundling added

##Example Scenes
- [NEW] New Savegame Example Scene added.
- [NEW] New XML / JSON serialization systems added.
- [NEW] New XML / JSON Example Scenes added.
- [FIX] EndlessSpaceExampleScene no longer updates the CollisionHandler twice each frame and properly makes use of FixedUpdate() when FixedPhysicsFramerate is enabled.
- [NEW] New shaders added
- [UPDATE] Existing shaders improved / fixed.
- [NEW] New Shockwave Shader is used in EndlessSpaceCollision example scene now.
- [NEW] Resources are now packed and copied to output directory on build.

And many more miscellaneous  changes, additions and fixes that would be too much to put them all here!