X2WOTCCommunityHighlander
https://steamcommunity.com/workshop/filedetails/?id=1134256495
Install / Use
/learn @X2CommunityCore/X2WOTCCommunityHighlanderREADME
X2WOTCCommunityHighlander
Welcome to the X2 WOTC Community Highlander Github project. This is where the work happens.
What version are we at?
We maintain two versions of the Highlander, published on the Steam Workshop:
- Stable version that matches the latest GitHub release and has been tested a fair amount.
- Beta version that is updated more frequently with changes from the master branch.
When using the Beta version, the Highlander's version in the lower right corner of the game's main menu will tell you which commit the beta version is based on.
What IS the X2WOTCCommunityHighlander?
Highlander replaces the game's main script package - XComGame. This allows the Highlander to alter portions of the game's code without using any ModClassOverrides to incorporate bugfixes and various ways for other mods to interact with the game's code without needing to use MCOs themselves, which would be bad for compatibility.
In other words, the purpose of the Highlander is to fix bugs and to improve compatibility between other mods.
As implied by the name, there can be only one Highlander. Therefore, it's important for the Highlander to address as many modding use-cases as possible, and incorporate bugfixes that would otherwise require Class Overrides to implement.
The original X2CommunityHighlander is an extension of the Long War 2 Highlander, which was built by the hard-working Pavonis Interactive team.
The X2WOTCCommunityHighlander provides a Highlander for the XCOM 2 War of the Chosen expansion.
How does it work?
As a mod user, you can simply use Highlander as any other mod.
As a modmaker and a potential contributor to the Highlander, learning the following could be beneficial. XComGame replacements can be loaded successfully into XCOM 2 only in one of two ways:
- As a cooked package (a .upk file). This is how the unmodified vanilla game works, and this is the way normally used by the Highlander.
- With the
-noseekfreeloadingswitch, which is designed for debugging purposes.
You can learn more details from Abe Clancy's excellent post on the Nexus Forums.
Building Against Highlander
When is it necessary?
Building against Highlander is necessary when your mod intends to call a specific function or use a class that exists only in the Highlander, such as CHEventListenerTemplate or XComGameState_Unit::HasAbilityFromAnySource().
If the game attempts to execute code that uses these classes/functions, and the Highlander mod is not active, the game will hard crash, so Highlander will become a hard requirement for your mod.
If you build your mod against the Highlander, but don't use any of its features, your mod will not have Highlander as a hard requirement, so there are no downsides to building your mod against the Highlander in this regard.
Building against Highlander is NOT necessary if your mod:
- Implements X2DownloadableContentInfo methods that exist only in Highlander, such as AbilityTagExpandHandler_CH or CanAddItemToInventory_CH_Improved.
- Sets values for configuration variables that exist only in Highlander, such as DLC Run Order or Required/Incompatible Mods.
Highlander will still be required for your mod to work properly, but you don't need to build your mod against it.
How to build your mod against the Highlander?
You need to replace the source code in the XCOM 2 SDK with the source code of the Highlander. Here's how:
-
Subscribe to Highlander, if you haven't already.
-
Close the Modbuddy, if it's open.
-
Locate the SDK folder that contains the source code:
..\steamapps\common\XCOM 2 War of the Chosen SDK\Development\
-
Delete the
Srcfolder. Yes, really. -
Make a backup of the
SrcOrigfolder. -
Locate the Highlander source code folder:
..\steamapps\workshop\content\268500\1134256495\Src\
- Copy the contents of Highlander's
Srcfolder into theSrcOrigin the SDK source code folder, overriding duplicate files.
From here: ..\steamapps\workshop\content\268500\1134256495\Src\
To here: ..\steamapps\common\XCOM 2 War of the Chosen SDK\Development\SrcOrig\
Done. Now your mods can take full advantage of Highlander's features.
Highlander Development
Highlander is a community project and everybody is welcome to contribute. Feel free to file a Pull Request for any of the open Issues and wait for a maintainer to review and merge it. You can also file new Issues.
Discussion channel
For the most part, discussion happens in the #highlander Discord channel of the XCOM 2 modmaking Discord server. It is our platform of choice for lengthy discussions that don't fit GitHub issues.
Code style
The code style is what is generally in use for the XCOM 2 codebase:
- Tabs (width: 4 spaces)
- Braces always on a new line
- Liberal use of space between blocks
- Braces even for one-line if/else bodies
The following code should illustrate all of this:
static function CompleteStrategyFromTacticalTransfer()
{
local XComOnlineEventMgr EventManager;
local array<X2DownloadableContentInfo> DLCInfos;
local int i;
UpdateSkyranger();
CleanupProxyVips();
ProcessMissionResults();
SquadTacticalToStrategyTransfer();
EventManager = `ONLINEEVENTMGR;
DLCInfos = EventManager.GetDLCInfos(false);
for (i = 0; i < DLCInfos.Length; ++i)
{
DLCInfos[i].OnPostMission();
}
}
Documenting your Contributions
Generally, Highlander changes will be weaved into vanilla code in ways that require us to keep close track of what code changes what vanilla behaviour, and for what purpose. To do this, we comment code precisely to match with issues created on Github at:
https://github.com/X2CommunityCore/X2WOTCCommunityHighlander/issues
Every change has a tracking issue, where the problem is described along with a use case for the Highlander change. This applies to bugs, enhancements, and new features.
Any code you write should be documented to include the issue it addresses, either as a single line comment, or as a start and end block. Don't forget to mark any variables added for that issue, as well.
We should be able to find every line of code related to an issue by searching for "Issue #928" (or whatever) in the codebase. In addition, any commits related to that issue should also have the issue number marked in the same way.
Additionally, every feature should be documented with inline documentation that will be published via GitHub Pages (at https://x2communitycore.github.io/X2WOTCCommunityHighlander/). That online documentation also has instructions for how to write your documentation and run the documentation tool.
Building the Highlander
- Make sure you have the full content SDK installed (
full_contentbranch in Properties->Betas->full_content). This requires about 90 GB of disk space. - The custom version of the X2ModBuildCommon built into Highlander's mod project requires Git, so make sure you have Git installed. You can download the Git installer from the official website. Note that Git embedded into some of the Git GUI apps like Source Tree is not enough, it must be a separate Git installation.
Once you have satisfied these requirements, you should be able to build the Highlander like any other mod.
Cooking a Final Release (Automated method)
Build the mod using Default/Final release (ModBuddy) or cooked/final release (VSCode) profiles
Cooking a Final Release (Manual method)
One-time preparation
The following instructions are functionally the same as those of a vanilla Highlander mod. All the below references to the root Steam directory are made as %STEAMLIBRARY%. You should replace them with your actual Steam directory folder, such as: "D:/SteamLibrary", or whatever.
A few files need to be copied into the SDK for you to successfully cook the
Highlander. Check the folder
%STEAMLIBRARY%\steamapps\common\XCOM 2\XCom2-WarOfTheChosen\XComGame\CookedPCConsole
and copy the following files to
%STEAMLIBRARY%\steamapps\common\XCOM 2 War of the Chosen SDK\XComGame\Published\CookedPCConsole:
GuidCache.upk
GlobalPersistentCookerData.upk
PersistentCookerShaderData.bin
*.tfc
Additionally, you need to install the complete SDK (full_content branch in Properties->Betas->full_content). This requires about 90 GB of disk space.
Cooking
Start by building the mod t
