-
-
Notifications
You must be signed in to change notification settings - Fork 6
The Launcher
The Launcher is what your client will run to update the game. It requires an initial configuration in order to work.
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:

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.
If you need to deeper customize settings, take a look at the
Launcher.csscript, inCreateSettingsmethod. TheLauncherSettingsinstance exposes multiple customizable settings you can tune to fit your needs.
If you are using the WPF Launcher, you can set Remote URL and other settings in MainWindow.xaml.cs in CreateSettings method.
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).
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.
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.
Just upload the whole Updater folder to your web server. That's it! :)
Assuming your remote root is
http://localhost/patch/, after the uploading we should be able to see theUpdaterfolder athttp://localhost/patch/Updaterand with the browser we should be able to navigate tohttp://localhost/patch/Updater/updater_index.json.
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.