SquidStd.Game
0.41.2
dotnet add package SquidStd.Game --version 0.41.2
NuGet\Install-Package SquidStd.Game -Version 0.41.2
<PackageReference Include="SquidStd.Game" Version="0.41.2" />
<PackageVersion Include="SquidStd.Game" Version="0.41.2" />
<PackageReference Include="SquidStd.Game" />
paket add SquidStd.Game --version 0.41.2
#r "nuget: SquidStd.Game, 0.41.2"
#:package SquidStd.Game@0.41.2
#addin nuget:?package=SquidStd.Game&version=0.41.2
#tool nuget:?package=SquidStd.Game&version=0.41.2
<h1 align="center">SquidStd.Game</h1>
Small, dependency-light building blocks for games: dice-notation rolling and a generic A* pathfinder. Both are pure logic - no engine, no renderer, no fixed grid type - so they drop into any turn-based or real-time game loop built on SquidStd.
Install
dotnet add package SquidStd.Game
Usage
using SquidStd.Game.Dice;
// Parse dice notation: "[N]dS[+/-M]" (for example "2d6+1", "d20"), the wrapped
// "dice(2d6+1)" form, or a pure constant such as "5".
var expression = DiceExpression.Parse("2d6+1");
expression.Min; // 3 - every die shows 1
expression.Max; // 13 - every die shows its max face
expression.Average; // 8.0
var total = expression.Roll(); // random total in [Min, Max]
Pathfinding
using SquidStd.Game.Pathfinding;
const int width = 20;
const int height = 20;
var blocked = new HashSet<(int X, int Y)> { (5, 5), (5, 6), (5, 7) };
var pathfinder = new AStarPathfinder<(int X, int Y)>(
neighbors: p => new (int X, int Y)[] { (p.X + 1, p.Y), (p.X - 1, p.Y), (p.X, p.Y + 1), (p.X, p.Y - 1) }
.Where(c => c.X >= 0 && c.X < width && c.Y >= 0 && c.Y < height && !blocked.Contains(c)),
cost: (_, _) => 1.0,
heuristic: (p, goal) => Math.Abs(p.X - goal.X) + Math.Abs(p.Y - goal.Y) // Manhattan distance
);
var path = pathfinder.FindPath((0, 0), (10, 10), maxExpandedNodes: 5_000);
// Or the try-variant, which reports success instead of checking for an empty list:
var found = pathfinder.TryFindPath((0, 0), (10, 10), out var tryPath, maxExpandedNodes: 5_000);
The returned path includes both the start and the goal node. It is empty (never null) when the
goal is unreachable or the expansion budget runs out, and contains only the start node when start
equals goal. A consistent (monotone) heuristic - one that never decreases by more than the edge
cost between adjacent nodes, which includes Manhattan/Euclidean distance and the zero heuristic -
guarantees an optimal path; a zero heuristic turns the search into Dijkstra. The optional
maxExpandedNodes budget caps the work done per call so real-time callers (game loops) don't stall
chasing an unreachable goal. A pathfinder instance holds no search state of its own - every
FindPath call keeps its own - so a single instance is thread-safe and reusable across concurrent
searches, provided the supplied delegates and comparer are themselves safe for concurrent
invocation.
Key types
| Type | Purpose |
|---|---|
DiceExpression |
Parsed [N]dS[+/-M] dice notation with Min/Max/Average/Roll. |
AStarPathfinder<TNode> |
Generic A* over any graph via neighbor/cost/heuristic delegates. |
License
MIT - part of SquidStd.
| 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
- SquidStd.Core (>= 0.41.2)
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 |
|---|---|---|
| 0.41.2 | 83 | 9/1/2026 |
| 0.41.1 | 96 | 8/5/2026 |
| 0.41.0 | 103 | 7/24/2026 |
| 0.40.1 | 101 | 7/23/2026 |
| 0.40.0 | 93 | 7/21/2026 |
| 0.39.0 | 104 | 7/20/2026 |
| 0.38.0 | 99 | 7/20/2026 |
| 0.37.0 | 98 | 7/17/2026 |
| 0.36.0 | 99 | 7/15/2026 |
| 0.35.0 | 100 | 7/15/2026 |
| 0.34.0 | 107 | 7/14/2026 |
| 0.33.1 | 100 | 7/13/2026 |
| 0.33.0 | 101 | 7/13/2026 |
| 0.32.1 | 102 | 7/13/2026 |
| 0.32.0 | 105 | 7/13/2026 |
| 0.31.0 | 102 | 7/12/2026 |
| 0.30.0 | 107 | 7/12/2026 |
| 0.29.0 | 104 | 7/11/2026 |