Skip to content

The Admin Tool

Emanuele Manzione edited this page Feb 7, 2023 · 28 revisions

Before you can start updating your game, you have to perform some initialization tasks.

Initialization

Go on Window > PATCH > Admin Tool or press Alt + Shift + P: this will initialize the workspace. If you now click on Window > PATCH > Go to Workspace folder or press Alt + Shift + O the workspace will open and you will see some new folders: App, Builds, Patches, Updater.

Window

Commandline equivalent

Run the command .\MHLab.Patch.Admin.exe init: this will initialize the workspace. You will find an App folder in the same folder. The App folder will contains your game's current files.

Using the Admin CLI

If you want to use the Admin CLI, it can be found in the Assets\MHLab\Patch\Admin\MHLab.Patch.Admin.Commandline.7z archive (for Basic version) and in Assets\MHLab\Patch\MHLab.Patch.zip (for Plus version). Extract the project somewhere and open it with your IDE. If you own the Basic version, you will need to add the two DLLs (MHLab.Patch.Core.Admin.dll and MHLab.Patch.Core.dll, contained in the archive) as dependencies of your project. Then you can build it, the output will be the .exe file you can use.

The first game version

Now you just need to build your game as I explained here. Once you done and built files are available, move all of them to the App folder (or build directly inside it) inside the PATCH's workspace. Go to Admin Tool > Builds and hit Initial build button.

Initial build

Commandline equivalent

Run the command .\MHLab.Patch.Admin.exe build

After the computation, you will notice new files and folder spawned in your Builds folder:

  • 0.1.0 folder, it contains your game's files with some metadata about the version number
  • builds_index.json file, it contains metadata about all versions
  • build_0.1.0.json file, it contains metadata about the specific version

Upload the first build

It's a good time to upload files! Upload the Builds folder (containing 0.1.0 folder, builds_index.json and build_0.1.0.json files) to the /Builds folder on your web server.

Hint

To test if your files are reachable by the Launcher, just navigate over them with a normal web browser. Assuming we uploaded files at http://localhost/patch/, we will navigate on http://localhost/patch/Builds/builds_index.json (note the /Builds folder in the URL, which is the correct location where the Launcher will look for that file). The browser now should show a JSON string. You can also use the Test Remote URL button in LauncherData component to do the same!

The second version

When you made enough changes to your game and you want to deploy a new version, just build your game again and put it in App folder. Go to Admin Tool > Builds again. This time you can notice that more options exist. Before proceeding, you should take a look at Release type. It regulates how the version number is increased and contains three options:

  • Patch release: with a previous version number of 2.3.6, a patch release will change the version number to 2.3.7. It is used for very little changes, hotfixes and similar stuff.
  • Minor release: with a previous version number of 2.3.6, a minor release will change the version number to 2.4.0. It is used for minor changes or additions to the existing functionalities.
  • Major release: with a previous version number of 2.3.6, a major release will change the version number to 3.0.0. It is used for major changes/additions to the existing functionalities or for changes/additions that break the backward compatibility.

Commandline equivalent

You can set the Release Type in the commandline too: .\MHLab.Patch.Admin.exe build for a Patch Release, .\MHLab.Patch.Admin.exe build -r minor for a Minor Release, .\MHLab.Patch.Admin.exe build -r major for a Major Release. You can even pass in an explicit version number, if needed, for example: .\MHLab.Patch.Admin.exe build -b 0.1.2

Warning

The Release type Patch release has nothing in common with the ability to generate a patch between two game versions. It is just a way to regulate the version number!

Pick a release type accordingly to your needs and hit Build new version button. Again, after some computation the process will complete and you will find in your Builds folder a new version.

Second build

Commandline equivalent

You can use the command .\MHLab.Patch.Admin.exe build or .\MHLab.Patch.Admin.exe build -r minor or .\MHLab.Patch.Admin.exe build -r major

Hint

You can avoid to upload all versions you built. Patches are enough to update your clients' game. Why would you want to upload a build, then? Because of the repair functionality. Patches can be applied only if the game files' state is correct. So if your client corrupts a file or tries to modify it, the patch cannot be applied. The repairer runs exactly for this reason: if a file is corrupted, the correct state is restored. The repairer also runs if the client's version is really old. Really old = the local version does not exist on the server and the smallest available version is bigger than the local version. Remember: when you want to upload a new build, you must upload always version-specific files and folders (0.1.1 folder and build_0.1.1.json, for example), but also the index file (builds_index.json).

Generating the first patch

At this point you have two versions of your game. It's time to generate a patch between them: in this way updating from the old version to the new one will be a breeze. Go to Admin Tool > Patches. Set the version from / version to (it is automatically set on last two versions, for your convenience) and the compression level, then hit Build new patch button.

New patch

Hint

The compression level can go from 1 to 9. It impacts how strong the compression for that patch will be: lower levels offer better compression time but worse compression ratio.

When the process completes, you will find new files in your Patches folder (let's say your versions are 0.1.0 and 0.1.1):

  • patches_index.json file: it tracks down all patches you built
  • 0.1.0_0.1.1.json file: it contains metadata about the patch between version 0.1.0 and version 0.1.1
  • 0.1.0_0.1.1.zip file: it is a compressed archive that contains actual files needed to apply this patch

Commandline equivalent

Run the command .\MHLab.Patch.Admin.exe patch. It will generate a patch between your latest two versions. Run the command .\MHLab.Patch.Admin.exe patch --from 0.1.0 --to 0.1.1 instead to specify which versions you want to target.

Upload the first patch

Upload 0.1.0_0.1.1.zip, 0.1.0_0.1.1.json and patches_index.json files on your web server. Remember to always upload patches_index.json everytime you upload a patch. So if your Remote URL is http:/localhost/patch, you will upload your patch files at http:/localhost/patch/Patches/.