Moongate.Core 0.21.0

Prefix Reserved
dotnet add package Moongate.Core --version 0.21.0
                    
NuGet\Install-Package Moongate.Core -Version 0.21.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="Moongate.Core" Version="0.21.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Moongate.Core" Version="0.21.0" />
                    
Directory.Packages.props
<PackageReference Include="Moongate.Core" />
                    
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 Moongate.Core --version 0.21.0
                    
#r "nuget: Moongate.Core, 0.21.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 Moongate.Core@0.21.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=Moongate.Core&version=0.21.0
                    
Install as a Cake Addin
#tool nuget:?package=Moongate.Core&version=0.21.0
                    
Install as a Cake Tool

Moongate.Core

Shared primitives, geometry, collections, configuration helpers, and utilities for Moongate applications.

Installation

Requires .NET 10. Use the package version available in your configured NuGet feed.

dotnet add package Moongate.Core

Features

  • Entity identities with Serial and the IMoongateEntity contract.
  • Two- and three-dimensional points, rectangles, and geometry interfaces.
  • Collections, buffers, and general-purpose helpers.
  • TOML configuration helpers using snake_case names, version information, and network address utilities.

Example

Create a position and a persistent entity identifier:

using Moongate.Core.Geometry;
using Moongate.Core.Primitives;

var position = new Point3D(100, 200, 5);
var id = new Serial(1);

Console.WriteLine($"{id}: {position.X}, {position.Y}, {position.Z}");

Configuration, version and address recipes

Put this model in ShardOptions.cs:

public sealed class ShardOptions
{
    public string ShardName { get; set; } = "Moongate";
    public int GamePort { get; set; } = 2593;
}

Run this Program.cs to round-trip a TOML file and inspect the calling assembly:

using System.Net;
using System.Net.Sockets;
using System.Reflection;
using Moongate.Core.Utils;

var path = Path.Combine(Path.GetTempPath(), $"moongate-options-{Guid.NewGuid():N}.toml");
try
{
    await TomlUtils.SerializeToFileAsync(new ShardOptions(), path);
    var restored = await TomlUtils.DeserializeFromFileAsync<ShardOptions>(path)
        ?? throw new InvalidOperationException("Configuration was empty");
    Console.WriteLine(await File.ReadAllTextAsync(path)); // shard_name, game_port
    if (restored.ShardName != "Moongate" || restored.GamePort != 2593)
    {
        throw new InvalidOperationException("TOML round trip failed");
    }
}
finally
{
    File.Delete(path);
}

var assembly = Assembly.GetExecutingAssembly();
Console.WriteLine($"Application version: {VersionUtils.GetVersion(assembly)}");
Console.WriteLine($"Application codename: {VersionUtils.GetCodename(assembly)}");

var addresses = NetworkUtils.GetLocalIpAddresses()
    .Where(address => address.AddressFamily == AddressFamily.InterNetwork &&
                      !IPAddress.IsLoopback(address))
    .Distinct();
foreach (var address in addresses)
{
    Console.WriteLine(address);
}

TomlUtils.Serialize/Deserialize<T> work with strings; the file and async file variants create parent directories when writing. Default options use snake_case names plus any converters added with the thread-safe TomlUtils.AddTomlConverter. Explicit TomlSerializerOptions replace those defaults for that call. Writes overwrite the target and are not atomic; parsing, serialization and I/O errors propagate to the caller. The server's create-default-if-missing behavior belongs to its ConfigHelper, not to every TomlUtils write.

VersionUtils.GetVersion() without an assembly reads Moongate.Core's version. Pass your application's assembly to read its version, stripping build metadata following +. Codename reads the AssemblyMetadata("Codename", "...") value and returns an empty string when absent. The server embeds its Codename MSBuild property into this metadata through its project configuration; merely declaring an arbitrary MSBuild property in another project does not embed it automatically.

VersionUtils.GetBuildTime and GetBuildConfiguration read the AssemblyMetadata entries BuildTime (ISO 8601, UTC) and BuildConfiguration (Debug or Release) an application writes at build time; they give null and an empty string when the assembly has none. VersionUtils.FormatHeader fills {Version}, {Codename}, {Configuration} and {BuildTime} in a banner text, writing unknown for what the assembly does not carry.

NetworkUtils.GetLocalIpAddresses() enumerates local unicast addresses without filtering loopback, inactive interfaces, duplicates or address family. Apply the filters appropriate to your application, as above. These are local interface addresses, not your public NAT address. GetListeningAddresses(endpoint) formats local addresses of the endpoint's family with its port; it does not inspect the OS socket table to discover actual listeners.

Dependencies and scope

This package has no dependency on another Moongate package. Its external dependencies include DryIoc, Humanizer, Serilog, ShaiRandom, Tomlyn, and ZLinq; NuGet resolves them automatically.

It provides shared building blocks. Asynchronous PostgreSQL entity storage is provided by Moongate.Persistence; TCP transport is provided by Moongate.Network.

License and source

Licensed under AGPL-3.0-or-later. See the source repository and license.

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 (7)

Showing the top 5 NuGet packages that depend on Moongate.Core:

Package Downloads
Moongate.Network.Packets

Ultima Online packet definitions, span-based serialization, and packet registration for Moongate.

Moongate.Server.Core

Plugin-facing server contracts, events, registries, and dependency injection extensions for Moongate.

Moongate.Persistence

Asynchronous PostgreSQL persistence for serial-identified entities, powered by FreeSql.

AbyssIrc.Server.Core

Core server components for AbyssIrc. Provides the fundamental server framework, interfaces, and implementations for building IRC server functionality.

Moongate.Scripting

Embedded Lua scripting for Moongate: attribute-bound modules, loop-affine execution, timer-driven coroutines, and editor definitions.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.21.0 688 11/3/2026
0.20.1 740 10/22/2026
0.20.0 144 10/22/2026
0.19.0 473 10/16/2026
0.18.0 154 10/16/2026
0.17.0 186 10/14/2026
0.16.0 151 10/9/2026
0.15.0 139 10/7/2026
0.14.0 148 10/4/2026
0.13.0 146 10/3/2026
0.12.0 132 10/2/2026
0.11.0 143 9/30/2026
0.10.0 146 9/30/2026
0.9.0 156 9/27/2026
0.8.0 140 9/26/2026
0.7.0 145 9/24/2026
0.6.0 149 9/21/2026
0.5.0 142 9/20/2026
0.4.1 139 9/20/2026
0.4.0 157 9/19/2026
Loading failed