How to create a GameMode Mod
In this Tutorial, we will walk through some basics about how to create GameMode Mod for Contractors VR.
Making a GameMode Mod requires you have some basic knowledge on Blueprint programming and Unreal's GameMode and Network framework
To get started, you will need to create a GameMode Mod in Contractors Mod Editor, you could do so by clicking on "Create Mod" button, select "New GameMode" and fill in the name for your Mod.
*Very Important!!! Your mod name must only contains alphabet characters ,numbers and ASCII special characters. Otherwise you mod will not allowed to be uploaded to mod.io service.
A content folder will be created for your Mod, All the Blueprints and Sssets you created for this mod need to be put in this directory.
GameMode related blueprints need to derive from specific classes
- Your GameMode Blueprint need to derive from /Game/Blueprints/GameModes/CS_GameMode
- Your GameState Blueprint need to derive from /Game/Blueprints/GameModes/CS_GameState
- Your PlayerState Blueprint need to derive from /Game/Blueprints/GameModes/CS_PlayerState
- Your PlayerController Blueprint need to derive from /Game/Blueprints/GameModes/CS_PlayerController
- Your Character need to derive from /Game/Blueprints/Player/CS_Character
GameMode Mod currently support the following team assignments:
- Team based GameMode with 2 teams with team number 1 and 2.
- Free For All GameMode where each player have their own team number assigned to them.
You can change Team Assignment style for your GameMode by changing "Free For All" property in your GameMode blueprint.
Setup Sub-Level and Player Spawn Style
Your GameMode Mod will reuse exsisting Sublevels from official GameModes, You need to choose which one fit your GameMode the best. Sub-Levels contains PlayerStarts and Objective Markers which you can use to make your GameMode logic work.
ie. PlayerStarts and ObjectiveMarkers contained in domination sublevel
Sublevels available for your are:
Set the "Spawn Type" Property in your GameMode actor to choose which official GameMode's sublevel you want to use
Add the PlayerCharacter you want to use into "Team #Pawn Class Array" property of your GameMode blueprint.
Your PlayerCharacter must inherit from CS_Character.
Find Player a PlayerStart
You can override "FindPlayerStart" function in your GameMode to implement your custom player spawn logic
An example for TDM style player spawn
You must return a valid "PlayerStart" in this function.
We have implemented some helper functions for finding player a PlayerStart under certain rules, you can use them if they fit your gamemode design needs.
Find a Dynamic PlayerStart under the rules you select. It will evaluate all the PlayerStarts of the type you specified, and find one fits your rules the best.
"Player Start Class": The PlayerStart class you want to use for PlayerStart evaluation.
"Use Explicit Player Start Class": if checked, the function will only evaluate the PlayerStarts with the PlayerStartClass you specified, excluding all the ones inheriting from this PlayerStartClass.
"Enemy/Friendly PlayerStart Policy": There are three options you can choose from: Away From, Close To, Don't Care
Same as FindPlayerStartDynamic by take objectives you want to focus on into consideration
"Focus Array": An Array of "ObjectiveFocusInfo" to use for PlayerStart evaluation.
"Focus": The Actor you want to take in consideration when evaluating PlayerStarts.
"Desired Dist": Combined with "Focus Policy", this parameter decide how far/close you want the PlayerStart from the Focused Actor during PlayerStart evaluation.
"Focus Policy": There are three options: Away From, Close To, Desired Distance.
Find a TeamedPlayerStart with same Team Number as respawning player.
End the Match
When you wan to end the match, you could call "Finish Match" to end the match and decide Winner Team.
Contractors VR allow you to customize each UI elements for your GameMode individually.
You can look at some official GameModes as an example on how it's done.