Case Study of Modding: Marauders
Before talking about the release or multithreading, this is a great time to talk about the power that our Modder #1 (and volunteer developer to boot), Badger, has been able to exert thus far. He’s made a ton of factions, but right now let’s talk about Human Marauders, which were in the first game as well.
If you don’t remember them from the first game, that’s because they weren’t too exciting; marauders were units that would periodically show up from the gravity well edge (not a wormhole) and cause some trouble. They were hostile to the player only, and were generally pretty insignificant. It added a tiny bit of spice, but not much.
He started from scratch when implementing these in the new game. His version of Marauders are hostile to everyone. They will attack any system they deem “weak enough to take,” then drop in from the edge of the gravity well. If they destroy all the defenses, then they start building Outposts, turrets and additional ships. They’re already starting to defend the planet as their own. If you leave the planet alone, the Marauders will keep making outposts, and each outpost will get stronger (ie it will build stronger defensive ships and more turrets).
Once an outpost hits Max Rank, it starts to build Raiders (powerful starships). Once the Marauders have built enough Raiders, they will attack adjacent-through-wormhole systems that they think are “weak enough to take.” If you leave outposts at Max Rank, the marauders will be able to attack more and more often — their “Attack Budget” gets bonuses based on how many Max Rank Outposts there are. Also the Max Budget gets increased every time they capture a planet.
People have been giving lots of balance feedback on the Marauders, as well as positive impressions for that faction on Discord. This also illustrates two pretty key points:
- The marauders are an example of what can be done with the modding tools of AIW2, but which was basically impossible for AIWC even for us as developers. Gives a bit of context as to why making this sequel was important.
- It’s also a really good example of how a “Decent but not exciting” AIWC faction turned into something way cooler in AIW2, so buy AIW2 to get cooler stuff. ;) There are a lot of factions like that (all-new ones and revised ones), even though we’re pivoting the core mechanics to be more like AIWC. For anyone worrying that this is just AIWC HD, please fear not!
The Actual Release
Okay, right: release notes here.
Where to even start? This release is pretty sizeable.
- There’s been a bunch of balance to minor factions.
- Mercenaries got some extra oomph.
- AI Waves were previously capped at 100 units (cough, whoops), but now will gleefully flood your planets properly.
- There are auto-build options for your convenience now available in the game settings.
- The salvage and reprisal mechanics from the first game are added back in.
- Golems are now available again — five of them, anyway!
…and all of that stuff is just what Badger, a volunteer, has put in this release. To say we’re indebted to him is an increasingly sharp understatement with every week. Holy smokes.
On my end of things, I upgraded the game to Unity 2018.2 and mono-.NET 4.6. Some performance improvements were possible from this, and a lot more multithreading options. A few boosts happened out of the gate, and I was able to explore (and then discard) the Lightweight Rendering Pipeline as an option.
I spent a fair bit of time on the multithreading problem, but at this point I’ve been hitting a wall where I can’t get the performance any higher. I’m sure with more time I could figure it out, but in the meantime there are bigger fish for me to fry in terms of performance blockers (namely the front-end vis layer’s extreme performance hits, which I talked about two releases ago).
Multithreading Help Wanted
Last release I asked for some help on the multithreading problem, which was clarified here. At this point, I’ve basically hit a wall in my ability to improve the threading without getting really excessive in my expenditure of time. There are a variety of other things that really need my attention right now, so I’m having to put this on the back burner.
That said, I’ve open-sourced our multithreading code and our core sim loop, so if there are any kind souls who want to take a look at it and help more directly with revisions, that would be super appreciated. I know folks were a bit hampered by being blind to the code before.
How to get at/test code:
- Make sure that Steam has updated you to the latest build of the game (0.749 or later).
- Inside the install folder for the game, open the AIWarExternalCode. There you’ll find a AIWarExternalCode.sln visual studio solution.
- You can open that with visual studio community edition 2015 or 2017, and then it should let you compile directly to the GameData/ModdableLogicDLLs folder.
- Running the game after having compiled a new version into that folder will run it with your changes in place.
- If you want to use a different IDE, or even no IDE and just compile manually, you can do so. Badger has scripts for doing so on linux, for example.
- The actual scripts of relevance are in the AIWarExternalCode/src/Sim folder (and its subfolders), which has a variety of C# files that I’ve added comments to. There are other files that call into and out of those files, but all of the multithreading bits and the main-thread-bits that call them are all there.
- I’ve made a mantis ticket on our bugtracker that has the savegame, plus instructions on how to see the issues.
Any help is appreciated! And I’m happy to answer questions. I have made a forum thread that is probably the best and easiest place for us to discuss this.
Right, Back To The Release
Anyway, that’s enough out of me. This new release is pretty cool.
I again wanted to mention: we have a new Steam Developer Page. If you go there and follow us, you’ll be notified about other upcoming releases (including this one, of course).