# Introduction This launcher template is a simple plugin that allows you to create a custom launcher for your game that gives users a small initial download, pulls larger files as needed, manages game versions, supports updates, and patches only the needed files. It also helps run the game securely on Windows, Mac, and Linux. The code is all Unity so developers can apply custom layouts, buttons, art / logos, ad banners, authentication, blockchain wallet connectivity, news updates, back end cloud providers, or any other custom functionality they desire. ## Key Features - Windows, Linux, and MacOS (including silicone) support. - Easily to set up different environments for Dev, Staging, or Production. - Game version download/update and install with tracking. - Optional game update by setting flag. - Patching game files. - Easy patching editor tool. - Command Line Arguments Processing. - Disabling the frame of the Native window. - Simple UI with loading bar, buttons, and all states. # Server Setup This utility uses the free / low-cost **Google Cloud** to store the game / app binaries and the data file indicating what version of the game you currently have available. You can easily use AWS's S3 or any other Cloud Storage of your choosing. To change the cloud storage / server details, you just need to inherit from the *PatchConfig* and *BuildConfig* classes and implement the required methods. ## Setting Up Google Cloud If you don't already have an account, create a free one at Google Cloud: https://console.cloud.google.com/getting-started?pli=1 ## Game Versions and Game Binaries / Executables The main driver of whether a game needs to be updated is its version. You can use any version format you want, but the following rules will apply: - If the client version is lower than the server's "version" then an update will be optionally available to the user. - If the client version is lower than the server's "requiredVersion" then the user *must* update before launching. The steps to set up the version in the database: ### 1. Create a new Metadata.json file with the proper settings #### 1.1. **requiredVersion** - the minimum version of the game that is required to run the game #### 1.2. **version** - the current version of the game #### 1.3. **size** - the size of the game in bytes #### Example: ```json { "requiredVersion" : "0.1.18", "version" : "0.1.26", "size" : "42000000" } ``` ## Patching If you want to create an update that is patched, so only the parts of the binary that are different are updated (resulting in much quicker updates), then optionally take this step: ### 2. Create a new PatchMetadata.json file with the proper settings #### 2.1. Open Window -> Patch Window in Unity ![](https://hackmd.io/_uploads/rykUfKrh2.png) #### 2.2. Select the build folder ![](https://hackmd.io/_uploads/S1PDfKr23.png) #### 2.3. Generate the patch JSON ile (PatchMetadata.json). It will be generated in the <b>StreamingAssets</b> folder. ![](https://hackmd.io/_uploads/Hy57ftH22.png) ### 3. Create a bucket in Google Cloud Storage #### 3.1. Create a proper folder structure in the bucket for Dev, Staging, and Production versions of your game (or any environments you choose) ![](https://hackmd.io/_uploads/Hk3LS9cj2.png) Under each environment, create a folder for Mac, Win, and Linux. ![](https://hackmd.io/_uploads/rJiwrqco3.png) #### 3.2. Configure bucket settings in the Unity project Do so for each environment you want to set up. The Launcher will use this Variable.JSON locally in the client to define its environment and which bucket it will fetch from. The output will be generated in the <b>StreamingAssets</b> folder. (NOTE: You need to generate a new variable.JSON after each change in the config.) ![](https://hackmd.io/_uploads/SJAQfFRj3.png) ### 4. Make the bucket **public** in the bucket settings ### 5. Upload the build #### Make a .zip file with the full build by gathering everything under the base game folder. For Windows: ![](https://hackmd.io/_uploads/SyZxJTP2n.png) And for Mac: ![](https://hackmd.io/_uploads/rymcZtr23.png) #### Upload a .zip file of the Windows, Mac, or Linux build #### Optionally, add the full folder to your Google Cloud drive in addition to the ZIP file (for patching) #### Add the Metadata.json and PatchMetadata.json files you created earlier ![](https://hackmd.io/_uploads/r1eFrcci2.png) ### 6. Configure Directory Config in the Unity project These will be the usual settings, with your own company and product name: ![](https://hackmd.io/_uploads/rkHcH95jn.png) ### 7. Configure Window Config in the Unity project ![](https://hackmd.io/_uploads/S14jS5ci3.png) ### 8. Configure Patch Config in the Unity project (OPTIONAL) The launcher will check the weight of the patch files and the weight of the full game ZIP. We suggested setting this value to 70% of the full ZIP, since if the patch has too many files / is too large, it will actually be faster and cheaper to download the ZIP, not the patch files individually. ![](https://hackmd.io/_uploads/S1osr5qj2.png) ### 9. Run MainScene to test the Launcher! #### **NOTE**: We are using the FREE TextMeshPro plugin to provide a better UI experience in our asset. If you don't have TextMeshPro installed, unity will show an import pop-up, just click on the "Import TMP Essential Resources" button to import it. ![](https://hackmd.io/_uploads/Byc-MFB32.png)