Modding: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
 
(21 intermediate revisions by the same user not shown)
Line 1: Line 1:
The Onsets Scripting API is what other games call "modding". Since scripting is the main feature of Onsets, Onset can be seen as modding "by default".
The Onsets Scripting API is what other games call "modding". Since scripting is the main feature of Onset, Onset can be seen as modding "by default".


This guide is just for how to import additional 3D models to Onset.
This guide is just for how to import additional 3D models and maps to Onset.


= Workflow =
= Workflow =
Onset uses the Unreal Engine and therefore uses it's modding pipeline to load additional content. Unfortunately this process it not easy in Unreal, so already having a bit of experience in Unreal will definitely help you.
Onset uses the Unreal Engine and therefore uses it's modding pipeline to load additional content.  


You can import any 3D models from any 3D program into Unreal (FBX, OBJ). Unreal will create a .pak file out of your assets that can then be loaded in Onset.  
You can import any 3D models from any 3D program into Unreal (FBX, OBJ).
Unreal will create a .pak file out of your assets that can then be loaded in Onset.  


[[File:OnsetModdingWorkflow.png]]
[[File:OnsetModdingWorkflow.png]]
Line 16: Line 17:
* [[GetAllFilesInPak]]
* [[GetAllFilesInPak]]
* [[ReplaceObjectModelMesh]]
* [[ReplaceObjectModelMesh]]
* [[ReplaceAnimationLibrarySequence]]


= Onset Engine Version =
= Other Modding Features =
* [[Custom_Maps|Importing custom maps/levels]]
* [[ImportPlayerMesh|Importing player character meshes and clothing items]]
 
= Onset Engine Version & Modding SDK =
{| class="wikitable" style="text-align: left;"
{| class="wikitable" style="text-align: left;"
!colspan="6"|Versions
!colspan="6"|Versions
Line 23: Line 29:
|Onset Version
|Onset Version
|Engine Version
|Engine Version
|SDK Download
|-
|1.0.0 - 1.2.0
|UE 4.23.X
|https://dev.playonset.com/OnsetModding_423_v1.0.zip
|-
|-
|1.0.0
|1.2.1 (LATEST, Take this)
|UE 4.23
|UE 4.25.X
|https://dev.playonset.com/OnsetModding_425_v1.1.zip
|}
|}


Line 34: Line 46:
https://docs.unrealengine.com/en-US/GettingStarted/Installation/index.html
https://docs.unrealengine.com/en-US/GettingStarted/Installation/index.html


= Create the Unreal Mod Project =
= Setup project =
 
After installing the Unreal Engine, launch it.


[[File:Mod_EngineStart.JPG]]
After installing the Unreal Engine, download the SDK for the correct engine version from above.


Name your project and then click '''Create Project'''. This is not the name of the mod.
Extract the ''OnsetModding'' folder to your ''Unreal Projects'' folder. It's usually located in your Documents folder.


[[File:Mod_CreateProject.png]]
Double click on the ''OnsetModding.uproject''. It will open the Unreal Engine.
At the first launch Unreal compiles shaders which takes some time. The CPU usage will be 100% and the loading screen will be stuck at 45% for some time.


First thing to do is to save the initial map. Unreal Engine requires this later on for the packaging process.
[[File:StartOnsetModding.png]]
Hit the "Save Current" button.
 
[[File:Mod_SaveMap.png]]
 
Make sure it looks like this and then click "Save".
 
[[File:Mod_SaveMap2.png]]


Go to Edit -> Plugins
Go to Edit -> Plugins
Line 82: Line 86:
All files that you import will need to be placed inside your mod content folder (MyFirstMod).
All files that you import will need to be placed inside your mod content folder (MyFirstMod).


[[File:Mod_ContentBrowserFolder.png]]
If you are familiar with Unreal then you can skip this:<br>
* [[Import3DModel|Adding an example 3d model with textures and materials.]]
* [[Custom_Maps|Creating a custom map.]]
You can also watch any Unreal tutorial on YouTube on how to add and setup your models in Unreal.


= Package your content =
Open the Onset Pak Creator window.
[[File:OpenOnsetPakCreator.png]]
# Select your mod from the left side.
# Click 'Browse' to select a location where the .pak file will be placed. For example D:\OnsetModPackage
# Click Create .pak


If you are familiar with Unreal then you can skip this:
[[File:PakCreatorWindow.PNG]]
[[Import3DModel]]
You can also watch any Unreal tutorial on YouTube on how to add and setup your models in Unreal.


= Package your content =
The packaging process can take a moment. When it's done you will find the .pak file in your specified folder.
We now continue to package all of your assets into a single .pak file.
Go to "Window" -> "Project Launcher":


[[File:Mod_OpenProjectLauncher.png]]
[[File:PakCreatorDone.PNG]]


Edit "BaseProfile".
[[File:PakFileDoneInFolder.PNG]]


[[File:Mod_EditBaseProfile.png]]
= Loading the pak file =


Check every setting so that it looks like in the image below.  
Put your new .pak file in a package of your Onset Server. Open the corresponding package.json and enter the name of the pak file under "files".
Example:
<pre>
{
"author": "Blue Mountains",
"version": "1.0",
"server_scripts": [
"server.lua"
],
"client_scripts": [
"map.lua"
],
"files": [
"MyFirstMod.pak"
]
}
</pre>


[[File:Mod_BaseProfile.png]]
Now you can use [[LoadPak]] in a client script to load your pak file.


Go back and edit "ModProfile".
'''The following step is no longer needed since 1.4.0'''.


[[File:Mod_EditModProfile.png]]
To view the contents of your .pak file you can use the UnrealPak tool. It is located under ''C:\Program Files\Epic Games\UE_4.25\Engine\Binaries\Win64''


Make sure the settings look the same as in the image below. The most important setting is "Name of the DLC to build". This must be the same name that you have chosen earlier.
[[File:UnrealPakList.PNG]]


[[File:Mod_ModProfile.png]]
Loading with [[LoadPak]].
<syntaxhighlight lang="Lua">
LoadPak("MyFirstMod", "/MyFirstMod/", "../../../OnsetModding/Plugins/MyFirstMod/Content/")
</syntaxhighlight>

Latest revision as of 14:04, 30 April 2021

The Onsets Scripting API is what other games call "modding". Since scripting is the main feature of Onset, Onset can be seen as modding "by default".

This guide is just for how to import additional 3D models and maps to Onset.

Workflow

Onset uses the Unreal Engine and therefore uses it's modding pipeline to load additional content.

You can import any 3D models from any 3D program into Unreal (FBX, OBJ). Unreal will create a .pak file out of your assets that can then be loaded in Onset.

Lua Modding Functions

Other Modding Features

Onset Engine Version & Modding SDK

Versions
Onset Version Engine Version SDK Download
1.0.0 - 1.2.0 UE 4.23.X https://dev.playonset.com/OnsetModding_423_v1.0.zip
1.2.1 (LATEST, Take this) UE 4.25.X https://dev.playonset.com/OnsetModding_425_v1.1.zip

Install Unreal Engine

You first need to install the Unreal Engine. See the above table for what version is required.

https://docs.unrealengine.com/en-US/GettingStarted/Installation/index.html

Setup project

After installing the Unreal Engine, download the SDK for the correct engine version from above.

Extract the OnsetModding folder to your Unreal Projects folder. It's usually located in your Documents folder.

Double click on the OnsetModding.uproject. It will open the Unreal Engine. At the first launch Unreal compiles shaders which takes some time. The CPU usage will be 100% and the loading screen will be stuck at 45% for some time.

Go to Edit -> Plugins

Select "New Plugin"

Select "Content Only". Enter a mod name. Make sure "Show Content Directory" is ticked. Then click "Create Plugin". The name of the mod is really important as we need that later one. So remember that.

You will see this message.

Introduce Content

Open the Content Browser.

Click this icon to get a folder overview.

All files that you import will need to be placed inside your mod content folder (MyFirstMod).

If you are familiar with Unreal then you can skip this:

You can also watch any Unreal tutorial on YouTube on how to add and setup your models in Unreal.

Package your content

Open the Onset Pak Creator window.

  1. Select your mod from the left side.
  2. Click 'Browse' to select a location where the .pak file will be placed. For example D:\OnsetModPackage
  3. Click Create .pak

The packaging process can take a moment. When it's done you will find the .pak file in your specified folder.

Loading the pak file

Put your new .pak file in a package of your Onset Server. Open the corresponding package.json and enter the name of the pak file under "files". Example:

{
	"author": "Blue Mountains",
	"version": "1.0",
	"server_scripts": [
		"server.lua"
	],
	"client_scripts": [
		"map.lua"
	],
	"files": [
		"MyFirstMod.pak"
	]
}

Now you can use LoadPak in a client script to load your pak file.

The following step is no longer needed since 1.4.0.

To view the contents of your .pak file you can use the UnrealPak tool. It is located under C:\Program Files\Epic Games\UE_4.25\Engine\Binaries\Win64

Loading with LoadPak.

LoadPak("MyFirstMod", "/MyFirstMod/", "../../../OnsetModding/Plugins/MyFirstMod/Content/")