Skip to content

Use a library

Start with a small console application. You need the .NET 10 SDK and access to NuGet; this first example needs no Moongate server, database or UO client files.

1. Create a project and install the package

Section titled “1. Create a project and install the package”

Run these commands from the directory where you keep your projects:

Terminal window
dotnet new console -n MoongateLibraryDemo -f net10.0
cd MoongateLibraryDemo
dotnet add package Moongate.Core

NuGet records the installed version in MoongateLibraryDemo.csproj. Keep that version when sharing or deploying your application. If you use several Moongate packages, choose versions from the same release.

Replace Program.cs with:

using Moongate.Core.Geometry;
var position = new Point3D(100, 200, 5);
Console.WriteLine($"Position: {position.X}, {position.Y}, {position.Z}");

Run it from the project directory:

Terminal window
dotnet run

Expected output:

Position: 100, 200, 5

You have now used a Moongate type in your own application. The Core guide adds configuration, identity and network-address examples.

Each guide lists its prerequisites and includes an example. NuGet resolves the package dependencies; install the package you use directly.

I want to… Start here
Use geometry, identities or configuration helpers Core
Build a TCP client or server Network, then the TCP cookbook
Read or write UO packets Network.Packets
Store entities in PostgreSQL Persistence and the entity tutorial
Validate a versioned SQL migration catalog Persistence.Migrations
Embed Lua in an application Scripting
Build a host with startup services, an event bus and plugins Hosting
Use the server contracts of the game Server.Core
Build an administration client Admin.Contracts
Read or render UO client data Ultima

To extend a running Moongate server, follow Writing a plugin. To change and validate the packages themselves, use the contributor guide to package verification.

Made with ❤️ by Tom

Buy me a coffee