Web Rarely

UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. -- Doug Gwyn

AI War UI Mod

2014-08-09

The AI War devs have said that they have only a couple hours per week to work on community-requested features. Because of that, a day or two ago I decided to create a mod to implement some requested features from the Mantis bug tracker. I started by implementing the features that I personally requested, but I think some of these will be useful for everyone. I also did a bit of bug-fixing.

  • #15634: structure (e.g. turret) templates
  • #15635: shift-select a subset of the selected units
  • #15636: right-clicking enemy ships in the planet overview/summary should attack them
  • #15637: clicking an enemy or ally in the planet overview/summary deselects your ships
  • #15638: planet-specific auto build engineers (etc) builds the wrong number
  • #15639: show warnings / alerts in the galaxy view
  • #15690: Bottom-aligned context menus overlap the global unit selection buttons
  • #3836: Allow auto-build sliders in CTRLS to work without having tech
Here are the details.

#15634: structure (e.g. turret) templates
This feature lets you save templates for groups of structures that you frequently construct. For instance, if you have a standard layout of turrets that you place around wormholes or in a system, you can save the group as a template and easily build more copies of it. The templates are global, so you can share them between campaigns. Here's how it works. First, select the items you want to save as a template. The items have to be the kind that can be directly constructed, but they don't actually have to be "buildings". (They could be directly constructable ships if you wanted.) Then alt-right-click to open the context menu and choose to save the template. I implemented a system with a fixed number of template slots for simplicity.

Later, when you want to build the template, deselect everything and alt-right-click again to open the context menu. Choose the template you want to load.

Move the ghost where you want it. (If you're building very close to a wormhole, you may have to be precise in your positioning.)

Click to place the template. Time saved! This is great in multiplayer when you don't want to annoy everyone by pausing the game to get some defenses up. It also works with a mobile builder when you want to quickly set up a beachhead in enemy territory.

Note that if building the template would exceed the cap for a particular type of object, the error message displayed might not show the correct object name.

#15635: shift-select a subset of the selected units
This feature lets you easily select a subset of the selected units. For instance, if you have a large blob selected, you can easily select just the ships you want. Here's how it works. First, have some ships selected. Then, hold down shift and click on each of the ships you want in the list. They'll turn yellow to show that they're part of the pending selection. (Shift-alt-click, shift-ctrl-click, and shift-alt-ctrl-click should work as expected: Shift-click again or shift-alt-click to remove the ship from the pending selection. Shift-ctrl-click to add a whole class of ships to the selection. Shift-ctrl-click again or shift-alt-ctrl-click to remove a whole class of ships from the selection.)

Finally, release the shift key to make that the new selection!

#15636: right-clicking enemy ships in the planet overview/summary should attack them
#15637: clicking an enemy or ally in the planet overview/summary deselects your ships
These two features, together, make it a bit easier to control your ships in a battle. First, if you have ships selected, you can right-click an enemy icon to attack a ship of that type. Right-clicking again attacks the next enemy of that type. This works with shift-attacking too. For instance, if you want to make a quick raid on the enemy's tachyon guardians, and you see in the planet overview/summary that they have four of them, you can simply shift-right-click the tachyon guardian icon four times to quickly add all of them to the attack queue. You should also be able to right-click an icon for an allied ship to move your selected units to the allied ship (although I haven't tested it). The second feature makes the game not deselect your units if you click on icons for enemies or allies. Instead it just moves the camera. So if you move the camera to an enemy, you can immediately attack without having to reselect your ships. Alternately, you can jump to an ally to see how they're doing without losing control of your own ships.

#15638: planet-specific auto build engineers (etc) builds the wrong number
This feature allows the per-planet auto-build settings to override the global settings. Normally, the per-planet settings are added to the global settings, so if your global settings say to auto-build two Mk I engineers and your per-planet settings say to build one Mk I engineer, the planet will end up building three of them. It's impossible to have per-planet settings build fewer units than the global settings. The mod fixes that by making per-planet settings override the global settings, so in the previous example, only one engineer would be built rather than three. The mod also allows you to specify that no engineers should be built. That is, rather than having zero mean "use the global settings", it uses -1 for that, so you can specify a per-planet value of zero in order to disable auto-building on a specific planet.

Note that if you apply the mod to an existing campaign, you may need to adjust your auto-build settings because they'll start building different numbers of items, and because most planets will specify zero for the auto-building. If you start a new campaign, no adjustment should be needed.

#15639: show warnings / alerts in the galaxy view
I tend to spend a lot of time in the galaxy view to get an overview of everything that's happening, but the game hides alerts, messages, and your selection while in that view. Because of that, I've lost many planets due to being unable to see the "200 enemy ships on ImportantPlanet" etc. alerts. So I've made all that stuff visible on the galaxy view, although I tried to hide unimportant messages. Having the selection visible is also nice so you can monitor the progress of a battle (or some repair work) while remaining in the galaxy view, and instantly retreat your ships if they get too damaged.

If you want to hide them temporarily, perhaps because they're obscuring a planet, you can press the Ctrl key.

#15690: Bottom-aligned context menus overlap the global unit selection buttons
This bug causes certain context menus to overlap other buttons in the UI. That wouldn't be a problem except that the game fails to consider Z-order when processing button clicks, so if a context menu overlaps the buttons along the bottom of the game window you won't be able to click the last few items in the context menu because they'll activate the buttons instead. I didn't fix the click processing in general but I fixed the problem that caused the menu to overlap the buttons in the first place. I'm a big user of assault transports and being unable to choose some of the items from the special unload menu was a frequent annoyance for me.

#3836: Allow auto-build sliders in CTRLS to work without having tech
This issue prevents you from moving the auto-build sliders for Mk II and Mk III engineers if you don't have the tech yet. If you save the CTRLS to disk when you have the tech and then load it in a new campaign, you can end up with Mk2/3 sliders set to build several per planet and no way to disable them (because you can't adjust the sliders). Then, when you unlock the tech, they instantly get built everywhere even when you didn't want that. So I made it possible to move the sliders before you have the tech. Of course it doesn't actually auto-build them until you get it.

Other Notes
I haven't done extensive testing, especially in multiplayer. I've only tested it in Windows, but there's a good chance it'll work on other operating systems. Let me know if you have any problems! I do hope the developers include these features in the game because creating this mod was painful and maintaining it will be a chore.

Download
The mod can be downloaded from here (1.2MB, released September 19, 2014 and based on game version 8.014).

Installation
If the current game version is the same as the one the mod was based on, or if you don't mind returning to the mod version, installation is simple:

  1. Navigate to your AI War game directory. (E.g. C:\Program Files (x86)\Steam\SteamApps\common\AI War Fleet Command)
  2. Navigate to the AIWar_Data/Managed subdirectory.
  3. Make a backup of your Assembly-CSharp.dll file and replace it with the one from the mod.
If the current game version is different from the one the mod was based on and you want to continue using it, installation is a bit more complicated:
  1. Navigate to your AI War game directory. (E.g. C:\Program Files (x86)\Steam\SteamApps\common\AI War Fleet Command)
  2. Navigate to the AIWar_Data/Managed subdirectory.
  3. Make a backup of your Assembly-CSharp.dll file.
  4. Copy the apply.exe and *.diff files from the mod into the directory.
  5. Open a command prompt.
  6. Change to the AIWar_Data/Managed directory.
  7. Run "c:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\ildasm.exe" /utf8 Assembly-CSharp.dll /out=disasm.il
    ildasm.exe may be located in a different directory on your computer. Look around under the "Microsoft SDKs" folder for it. If it's not there, you'll need to install it.
  8. Figure out whether this represents a debug or release build. One way to tell is that the disasm.il file for a debug build is usually over 40MB while a release build is usually less than 40MB. Based on that, select debug.diff or release.diff to use in the next step.
  9. Run apply disasm.il build.diff
    Replace build with debug or release as appropriate. If all goes well, then all hunks in the patch should apply correctly and there should be no rejects or errors. If some hunks fail to apply, then the game has changed too much and the patch needs to be updated.
  10. Run "c:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm.exe" /nologo /quiet /dll /output=Assembly-CSharp.dll /fold disasm.il
    If all goes well, there should be no errors. You can delete the disasm.il file.
  11. Run the game and try it out. If it doesn't work, restore your backup of Assembly-CSharp.dll.

Uninstallation
Replace Assembly-CSharp.dll with the backup you made.

Comments

Manual patch not working for 8.023 2015-12-23 12:01PM
Hello Adam,
Excellent mod! specially the template's feature, do you have plans to update the patch to the latest published version 8.023. When trying the steps you provided, it is failing on one hunk: "Hunk #34 FAILED at 913275."

Thank you very much for your efforts!
an anonymous Ed
RE: Manual patch for 8.023 2015-12-27 12:10PM
Hi Ed, I didn't have a plan so to speak and in fact I don't have the game installed right now, but if there's a specific feature in 8.023 that you need that isn't in 8.014 then let me know and I'll reinstall the game and try to update the patch.
Update for 8.024 2019-08-22 08:15PM
Hi Adam,

Four years after the last comment, I stumbled upon your mod and I'd love to use your templates in the latest version of AI War 1. Any chance you could update it to 8.024?

Thanks!
an anonymous Gab
RE: Update for 8.024 2019-08-27 08:59PM
Hi, Gab. I looked, but I no longer have the source code for this patch. It must have been lost when Windows crashed some time ago. Sorry about that.

Add a comment

Note: The information you enter (including your name and email address) will be displayed publicly.




Line breaks are converted to <br>'s, and all HTML tags except b, u, i, tt, and pre are filtered out.