AI War 2:Earlier Than Earlier Alpha Modding Instructions

From Arcen Wiki
Jump to navigation Jump to search

NOTE: all modding workflows are subject to being completely invalidated and replaced later in development :)

See some tutorials on youtube starting with for clearer examples, though some of them are a bit dated (some of the data structures have changed names).

Most of the Minor Factions (Dyson Sphere, Dark Spire, Human Marauders, etc...) are implemented essentially as Mods of the game, and there's a lot of really useful tidbits in that code.

How To Mod Existing Unit Stats

Our example case here will be "Contrary to the developers, I do not agree that losing is fun. I will therefore cheat out the wazoo and make my Ark massively more powerful."

Error creating thumbnail: File missing

First, find your game directory and go to GameData/Configuration/ , then open the GameEntity directory.

Error creating thumbnail: File missing

Right-click KDL_Ships_PlayerStructures.xml and open it with whatever editor you like to use for xml (notepad, or your platform's equivalent, will do for initial experimenting).

Error creating thumbnail: File missing

Here's what the Ark looks like in xml. Change balance_strength_multiplier from 20 to, say, 2000, and save the file.

Now start the game (if it's already loaded, press Ctrl+F10 to reload all external stuff) and give it a whirl. You should find dying much harder to achieve.

How To Mod External C# Code

Our example case here will be "Make the Basic Turretry pattern spread its turrets out a lot more."

Zero'th, you will need to have some working understanding of C#. You can proceed without it, but try to understand what you're looking at before you actually change something.

First, you will need something that can edit C# (and preferably open a .sln or .csproj file). For windows, I suggest Visual Studio 2015 community edition ( , though perhaps that now serves a later version) since that's what we used. For mac/linux I suggest MonoDevelop ( ), not because I think it's the best but because it's the only one I've tried that works on mac/linux.

Error creating thumbnail: File missing

First, find your game directory and go to AIWarExternalCode/, then open AIWarExternalCode.sln .

Error creating thumbnail: File missing

In the IDE, open BuildPatterns/BasicTurretry.cs .

Error creating thumbnail: File missing

Look around to understand it, and then go down to the marked line. The operative number is the "100" in FInt.FromParts( 0, 100 ), which simply means "0.1" in our fixed-int math. You could change that to, for example, 500 to get 0.5 and spread the turrets out a lot more.

So make the change and build the solution. You will get an error about it not finding "MonoBuild_Single.bat" but don't worry about it; it's a holdover from our environment that you don't need (currently) for just the external code. We'll excise the error message later.

Now copy AIWarExternalCode/bin/Debug/AIWarExternalCode.dll to GameData/ModdableLogicDLLs/ .

Then start or restart the game application (Ctrl+F10 should work for this, but does not yet) and try the build pattern. Much roomier! ... Incidentally, much easier for the AI to destroy piecemeal. Hmm...

Badger's Feeble Attempt

I have performed a simple Mod as a proof of concept. I wanted to add a new turretry pattern, FancyTurretry. To do this I went to ~/AIWar2/AIWarExternalCode/src/BuildPatterns and created a new file called FancyTurretry.cs (which I created by creating a copy of BasicTurretry.cs, then editing that). I then edited the XML file ~/AIWar2/GameData/Configuration/BuildMenu/KDL_BuildMenus.xml and added a new entry for FancyTurretry:

     <item pattern_controller_dll_name="AIWarExternalCode" pattern_controller_type_name="Arcen.AIW2.External.BuildPattern_BasicTurretry"\ />
     <item pattern_controller_dll_name="AIWarExternalCode" pattern_controller_type_name="Arcen.AIW2.External.BuildPattern_FancyTurretry"\ />

Also if anyone is doing modding on linux, BadgerBadger has a little bash script that handles compilation that can be shared. I imagine the script will need to be tweaked in the future if the modding process changes, but it works right now.

How To Mod Graphics/Music/Sound

This will require using the Unity Editor and a unity project we provide, but that project isn't ready yet. Sorry!