Skip to content

[upcoming] 4. Producing OTAPI on your own

Luke edited this page Aug 2, 2021 · 7 revisions
Contents
1. Prerequisites
2. Producing a patched server OTAPI.dll
  ↳ Patcher options
  ↳ Running the server
5. Producing the launcher, a patched OTAPI.exe

Creating a OTAPI.dll or OTAPI.exe is totally built into the new OTAPI.Patcher CLI program as a set of questions. Simply clone the upcoming branch, restore nuget packages and run the OTAPI.Patcher.

Travis (.com) branch AppVeyor branch

Prerequisites

  • .NET5 SDK
  • Terminal or powershell, with git and dotnet working

Producing a patched server OTAPI.dll

  1. Open a terminal or powershell window clone OTAPI's upcoming branch

git clone -b upcoming https://github.com/DeathCradle/Open-Terraria-API.git

  1. Move into the checked-out project root

cd Open-Terraria-API

  1. Restore submodules

git submodule update --init --recursive

  1. Restore NuGet packages
dotnet restore OTAPI.Mods.sln
dotnet restore OTAPI.Server.Launcher.sln
dotnet restore OTAPI.Client.Launcher.sln
  1. Clean and build the mod patching solution. Rebuilding will ensure any changes to external scripts are copied during project building.
dotnet clean OTAPI.Mods.sln
dotnet build OTAPI.Mods.sln
  1. Move to the output directory, where all the assemblies are located

cd OTAPI.Patcher/bin/Debug/net5.0

  1. Run the project and wait for it to ask what you wish to patch.

dotnet run --project ../../../OTAPI.Patcher.csproj --framework net5.0

Patcher options

The patcher will currently present you the following options, depending on what you wish to do will also determine how you later run the output assembly.

  • [p] - OTAPI PC Server

This will download TerrariaServer for PC, patch it and produce a OTAPI.dll

  • [m] - OTAPI Mobile Server

This will download TerrariaServer for Mobile, patch it and produce a OTAPI.dll.

  • [c] - OTAPI Client

This will search for a pre-installed Terraria directory as part of known Steam or GOG locations.
It will produce a OTAPI.exe that is later used to run the modded game.

Running the server

To run the server there is an example OTAPI.Server.Launcher project that demos that you can compile and register to events provided by OTAPI.dll and OTAPI.Runtime.dll.

  1. Ensure you patched a server, not client

  2. Move back to the root of the OTAPI folder you cloned via get (if you are still in the patcher's output directory)

cd ../../../../

  1. Build the Server launcher project

dotnet build OTAPI.Server.Launcher.sln

  1. Move to the output assemblies

cd OTAPI.Server.Launcher/bin/Debug/net5.0

  1. Start the example server!

dotnet OTAPI.Server.Launcher.dll

Producing the launcher, a patched OTAPI.exe

The patching process is quite similar to the server, however since this is not a server it requires basically a self-dependent .net5 framework and all the game files that will still require the base game to extract data and patch. To do this you can usually run the launcher in debug mode, or in a published x64 folder.

  1. Open a terminal or powershell window clone OTAPI's upcoming branch

git clone -b upcoming https://github.com/DeathCradle/Open-Terraria-API.git

  1. Move into the checked-out project root

cd Open-Terraria-API

  1. Restore submodules

git submodule update --init --recursive

  1. Restore NuGet packages
dotnet restore OTAPI.Client.Launcher.sln
  1. Open OTAPI.Client.Launcher.sln in Visual Studio/Code.

  2. Clean and build the OTAPI.Client.Launcher solution. Rebuilding will ensure any changes to external scripts are copied during project building.

  3. Debug the OTAPI.Client.Launcher project. This will show the OTAPI Launcher GUI, and you can continue to use it while debugging.