Creating a mod your own mod

Contents

How to create a mod

This will cover the basics of how to create your own mod from installing the software needed, to building and injecting your first mod.

Documentation

This documentation will be for things we find out about VTROL VR and what to share such as methods to receiving player input to added new vehicles. This section will be added upon when people find out new things to share.

Helpful Links

Helpful links will be a collection of useful sites people have used to help them create the mods and understand what they can do in the Unity engine.

Setup

Software

  • Visual Studio with .net desktop development workload
  • Unity 2019.1.8 (Optional)
Visual Studio

You can download Visual Studio for free from the Microsoft website , when installing make sure to include the ".NET desktop development".

This should give you access to create a Class Library in the .NET framework later on.

Unity 2019.1.8 (Optional)

You don't need Unity, however, if you want to start importing your own assets into the game then you will need to create asset bundles inside of Unity. I have recommended 2017.1.1 because it is the closest version to the current version of VTOL VR is made in. You can download that version of Unity from their website here. Go to Unity 2017.X at the top, then scroll to Unity 2017.1.1 and download the installer.

Once these are installed, we can next move onto creating a basic mod in Visual Studio.

Creating your first mod

Now we have downloaded the correct software needed to create mods, we can start making them!

Creating the project

First, we need to create this new project. Open Visual Studio and click on create a new project. You'll be shown a list of different types of projects you can create, the one we want is a Class Library (.NET Framework).

Next, you want to configure your new project, you can put any name but for this tutorial, I am calling mine "VTOLVRTutorialMod". Make sure it's using .NET Framework 4.5 then press create.

Adding References

Now with this empty project, we need to add the Unity.dll's to the project so we can access things from the Unity engine. On the right, right click on references and click on "Add Reference...".

Press "Browse..." at the bottom and then you need to navigate to where VTOL VR is installed, then you need to go to the Managed folder in VTOLVR_Data.
VTOL VR\VTOLVR_Data\Managed

For this example, we just need, "UnityEngine.dll", "UnityEngine.CoreModule.dll", "UnityEngine.IMGUIModule.dll" and "ModLoader.dll" (Found in VTOL VR > VTOLVR_ModLoader), but for other mods, you make later down the line, you might need more references from here. Now we just need to say that we are using this .dll file in this script with using at the top.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

Time to add something into the game!

So with what we currently have, it will inject into the game our script but nothing else happens. Let's make a simple button output to the log so we know it's working fine.

We are going to use Unity's old GUI because we can easily create it in code. First, we are using the function OnGUI which gets called every frame and is used for UI, then creating a button and checking if it has been pressed in the if statement. If it has been pressed it will return true and run Log().

I haven't gone through this code in detail because this is something people with experience in Unity should know. If this is the first time getting into programming, I recommend at this step, looking up unity tutorials, any Unity tutorial would apply to this however it does become a bit harder when applying it to this situation of modding.

public class VTOLVRTutorialMod : VTOLMOD
{
    private void OnGUI()
    {
        if (GUI.Button(new Rect(100,100,100), "My Button"))
        {
            Log("Ouch, that hurts");
        }
    }
}                   

Building the .dll file

Now we have our mod create, we need to create the .dll file. Thankfully this is simple, right clicking on the project and pressing Build.

The output window should show where the .dll file has been placed. Mine is in A:\Code\VTOLVRTutorialMod\VTOLVRTutorialMod\bin\Debug\VTOLVRTutorialMod.dll All we need is our .dll, none of the other files is needed. Move our .dll file to the mods folder, launch the game, inject the mod and hopefully, you'll see the button appear.

Completed our first mod!

So now when you head over to the mods tab you can see your .dll mod in the list. Select it and press load and the button will apear on the desktop view only. When you press it with your mouse, the Debug.Log will run and in the player.log file you can see the output.

Once you have finished creating your mod, head over to the release section to learn how to add an image and description to your mod.

Releasing your mod

Now your mod is ready to be used by everyone, there are some extra steps you need to do before it can go up on the website. First, you'll create a zip file with your mod DLL, an XML file which describes your mod and an optional preview image.

First, you want to create the XML file. To do this you first want to open the launcher, and press "Mod Creator". This will create an info.xml file in the "VTOLVR_ModLoader" Folder, don't rename this file just move it to the same place your DLL mod is.

When you open it, you'll see a "Mod Name" and "Mod Description". You just need to replace that next with the name of your mod and a bit of information about your mod.

Then optionally, you can create a preview.png file which will display an image next to your mod when it's selected. The recommended size is 512x512. For this example, I just used my profile picture.

Once you have created these files, you then can put these all into a zip file by selecting them all and sending to zip. The name of your zip should be similar to the name of your mod.

Once you have created the zip, place it in your mods folder (keep a backup) and when you launch the launcher it should extract the files to be used when in-game.

Does your mod need any dependencies?

If your mod needs any dependencies, we've got you covered. Create a folder in your zip called "Dependencies", then include any DLL files needed in there. Then when the user launches the launcher, it will copy any dependencies into the Managed folder before they start the game.

How to get your mod on the website

At the moment there is no way users can upload mods onto the vtolvr-mods.com website, this has to be done by hand my .Marsh.Mello. . Once you have created and tested your mod, send the zip file to Marsh and then he will upload it to the site.