Skip to content

The Launcher

Emanuele Manzione edited this page Oct 6, 2020 · 24 revisions

The Launcher is what your client will run to update the game. It requires an initial configuration in order to work.

Initialization

I will refer to the Launcher scene in MHLab/Patch/Launcher/Scenes, but the configuration is similar for other clients (WPF, WinForms, etc).

To configure it, just find the LauncherData game object: it contains a LauncherData component. It should look like this:

Launcher data

Here you must set some information:

  • Remote URL: the HTTP address where you uploaded files previously
  • Launcher Executable Name: the name of your Launcher executable, with the extension. In the screenshot you can see an example related to Windows's exe.
  • Game Executable Name: the name of your game executable, with the extension.

Other settings you see in the screenshot are just for UI management.

Hint

If you need to deeper customize settings, take a look at the Launcher.cs script, in CreateSettings method. The LauncherSettings instance exposes multiple customizable settings you can tune to fit your needs.

Initialization on WPF

If you are using the WPF Launcher, you can set Remote URL and other settings in MainWindow.xaml.cs in CreateSettings method.

Customization

Launcher and other scenes are just samples: you're encouraged to customize them. Also the Launcher.cs script is just a minimal sample of what you can do with the PATCH's API: feel free to edit it.

The UI can be trivially customized with the Unity UI system (or with Visual Studio if you're using the WPF version).

First launcher update

When you are satisfied of your Launcher, it's time to build it as I explained here. Place built files in Updater folder in your PATCH's workspace then go to Admin Tool > Launcher.

Here just insert the Launcher archive name and the Compression level and hit Build Launcher update.

Commandline equivalent

Run the command .\MHLab.Patch.Admin.exe --patcherUpdate

When the process completes you will notice a new file in Updater folder: updater_index.json. It contains metadata for the Launcher update. PATCH also generated a compressed archive (it is in the root folder of PATCH workspace) that contains your Launcher, ready to be distributed to the clients.

Uploading the first update

Just upload the whole Updater folder to your web server. That's it! :)

Hint

Assuming your remote root is http://localhost/patch/, after the uploading we should be able to see the Updater folder at http://localhost/patch/Updater and with the browser we should be able to navigate to http://localhost/patch/Updater/updater_index.json.

Testing the Launcher

If you want to test the Launcher, just create a new folder and extract inside it the content of the Launcher compressed archive. Don't run your Launcher inside the Updater folder!

Run the extracted executable and check that everything is acting like you expect!

After the first run, your Launcher downloaded your game in the Game subfolder. From now on you can run directly your game: the PreGame scene will check if any update is available and - if so - it will run the Launcher for updates.

Clone this wiki locally