Category: Technical Discussions

Swizzle Lists! A nonintuitive data structure for AI War 2.

It really seems like there ought to be a quicker explanation for this, but to explain the fundamental goals, the pitfalls, and the usage constraints of this data type… well, data types are hard to explain if they’re off the beaten path. This one is really useful, but also pretty strange.

edit: Aaaand Badger figured out the bug, which was not in this code, while I was making the video. Hopefully someone else finds this useful or interesting. ;)

Using Mantis Bugtracker, And What Everything There Means

Primarily for new moderator/admin Dune, but we know a lot of folks find this sort of thing interesting, so here it is for everyone.

If any other indies are using a bugtracker, this isn’t a bad approach to take, incidentally — we’ve handled almost 20,000 reports over the last 7 or so years in this. The first two years were spent with bug reports going through our forums — yuck! Definitely glad not to be doing that anymore.

Goodbye, Alloy, But Thanks For Teaching Us A Lot

As of our upcoming version 0.610, we’re removing the Alloy Shader framework.

The above is a tutorial for Blue, our artist, though if any modders who are creating custom models are also using substance painter, this shows you how to set up your setup, too. You can also infer pretty easily how to do combinations manually using Photoshop channels to create packed maps, too.

Anyhow, we’re moving away from the Alloy Shader Framework to instead use custom shaders that give us an equivalent look with a vastly reduced workload and with definite compatibility with future unity versions, and this tutorial covers Blue’s side of what needs to change.

The above is a tutorial for Cinth, but this also is useful for any modders who are creating custom graphics for the game.

As noted in this video, this saves us a ton of manual work. A ton.

Also in this video I randomly stumbled across a visual improvement to the custom player ark Rorqual Hegira, so you can see how that evolved a bit thanks to the extra flexibility of this new shader set.


Notes For Keith – “Ship Buttons” in AI War 2

Working notes, and a bit of a tutorial of sorts (as well as a request for help) for Keith. Also includes essentially some working notes for Blue, our artist. And there’s some technical tidbits that an avid modder could pick up here, if they’re so inclined.

Tutorial – Skinning UGUI Dropdowns For AI War 2

Notes for Blue (or modders), given that we’ve switched to a completely new GUI system (the unity built-in one) for this project, and there are some hidden settings that are easy to overlook.

Tutorial: Building Starward Rogue And AI War 2

For the various folks that work on one or both of the games, showing how to get both of them compiled and ready for people to use.  AI War 2 is waaaaay more complicated, which is pretty interesting to see.

Tutorial – Using Mesh Baker Pro In AI War 2

April 25th, 2017 – Notes for Cinth on how to use Mesh Baker Pro to do our atlasing instead of Pro Draw Call Optimizer. Pros and cons and troubleshooting galore, although it all works out in the end. Good tool, bad interface, great results. Translation: long tutorial.

AI War 2 Video – Debugging Shot Lerping With Chris

Just thought that this was a fun video to do, since a bug in the shot lerping made this an ideal case to show what the shot lerping IS and how it makes a difference in the final visuals of the game.

The video came out longer than I had intended, but it’s a neat look into some of the math challenges behind having a “liar liar” 3D battlefield representation above an underlying coarser 2D simulation.

None of these are intractable problems, by the way, but if I waited to take a video after I fixed the problems, it would be a lot harder to see the innards of how this works. :)

As a reminder, we have a video playlist for our AI War 2 dev diary, which includes a variety of videos that are marked as unlisted on our main channel video listing.

Tutorial – New “Simple Culling” Feature In LOD System

March 22nd, 2017 – Notes for Cinth (or modders!) on how to use the new functionality in our custom LOD system that allows for you to do simple culling on child renderers that already dynamically batch from LOD0 onwards.

Tutorial – New “Base Offset Positions” On Model LODs

March 22nd, 2017 – Notes for Cinth (or modders!) on how to use the new functionality in our custom LOD system that allows for you to compensate for bad anchor points in models (meshes). You can always update the mesh itself, or now you can do this too.

Tutorial – New IBL Shader Process For AI War 2

March 21st, 2017 – Detailed notes for Cinth (or modders!) on using the custom IBL shaders that we’re now transitioning the ships in the game to using. The visual look evolves!

IBL in AI War 2!

Pics lower down. :)

The Problem I Wanted To Solve

One of the frustrations I’ve had with the ship graphics in AI War 2 is that it’s hard to make sure that they’re both vibrant AND nicely reactive to the environmental colors and similar while being so hugely restricted in terms of how many truly-PBR techniques we can use because of limitations caused by having SO many realtime objects to light in that sort of scenario.

I’ve gotten around that with a variety of tricks that have evolved over the last months, and it’s been working well with Blue’s cel-shaded clean ship albedo/diffuse coloring.  It wasn’t perfect, but I knew I’d have time to improve it later — the main issue I had was that specular highlights tended to trend to white on all models.

Part of the recent evolution in the look of ships was to give them more of a metallic-on-cel-shaded look, which allows for a lot more flexibility in the sort of visual effects we can then do.  My first approach to that was to think of PBR, and so that’s what we recently converted to — the Unity Standard shader, which is heavily PBR.

There were a variety of challenges with that, though — I couldn’t control the amount of specular whiteout as much as I wanted while still having a ton of metallic feel to it.  Cinth kind of set me on the path of chasing the metallic look to marry that to the cel-shaded look that Blue sent me chasing, and I really wanted to get those working together.

The New Approach!

Experimenting a bunch last night and then today, I’ve settled on an IBL approach that is using Blinn-Phong again, back to what my custom rim-lighting shader was doing before we went to the standard shader (sorry, no link on that one — it’s somewhere on the forums or kickstarter, though).

Anyhow, the big benefit of this approach is that I’m able to handle reflections via a cubemap that has nothing to do with the larger scene, and then tint the reflections as needed, along with using a fresnel effect on them.  Then beyond that I’m faking a metalness map in some cases (such as for the fighter and bomber) by additively using the inverse of that data in the diffuse channel.

It’s All About The Motion

Bear in mind that the result is a lot more dramatic in motion, because as ships move around you get a lot more of them shimmering and glinting in the light as a school of fish might.

Even so — in still screenshots I think that it looks a bit better now.  But in motion it’s night and day.

Also: Lighting

Also!  Bear in mind that based on the lighting of the planet in question, you’ll get pretty drastically different results from what I am about to show.  In one case I was frustrated because the serial number on the fighter wasn’t showing up properly… only to realize that in fact it was acting appropriately in the lower-direct-lighting environment it was in at the time.

The basic rule of thumb is that the ships wind up varying in appearance more from planet to planet in terms of the characteristics of light on them, which is a big part of the goal.


The above is what I had before, using the Standard shader and a metalness map.  I was particularly unhappy with that one.

Now a few shots of what the new one looks like from various angles:

You’ll notice that in the two different angles give a really different feel to the color, even within one lighting profile.  That has a lot to do with the fresnel effect and cubemap for the reflections, but also just the specular highlights based on the view angle toward the light, too.

In a couple of angles that makes it looked a little more washed out in the cool orange parts, but very metallic — and then in other angles it looks rich and deep like the original cel-shading work that Blue did.  I’m really pleased with how these feel like they’re a living and interesting part of the scene, rather than just a flat piece of junk that always looks the same no matter where you see it or from what angle.  Perish the thought. ;)


So the above is again the “before shot,” prior to today’s IBL work.  I was actually really happy with this one already.  Then here are a few angles of what it looks like now:

In some lighting angles, you can see that this one is really dark on some of the surfaces.  But there’s also a very metallic sheen to it.  From other angles the main color comes right back out, and from yet others there’s this kind of bluish shimmer that passes over it as the camera or the ship turns, either way.

I might need to make the cockpit a little brighter, I dunno.  Minor tweaks.

More To Come!

At any rate, the space dock and Ark and warp gate and planet controllers also really got a huge upgrade out of all this.  All the rest of the ships are still using the PBR approach, which looks similar-enough but not quite the same by any stretch.

This wasn’t really on my list of things to work on this week originally, but with Cinth having some major health issues and there also being some major health issues with a couple of my extended family members, it’s been a week where I wanted to focus on some things that were productive, but not quite as mentally taxing.  This was a tricky problem to solve, but not as tricky as some.

Anyway — enjoy!  Thanks for reading.


AIWar 2 – “AIW2ModdingAndGUI” Modding Tutorial

This video is directed at external modders, for whom we’ve now set up a unity project that comes with the game and which makes it easy for you to add your own ships, models, sounds, visual effects, and more.

This does NOT cover code additions or changes, and data changes like balance statistics, etc. Those are handled through the AIWarExternalCode visual studio project, and the GameData/Configuration xml files, respectively.

Actually creating content for any of the above is beyond the scope of this particular video, which is more about how to get set up and find what you need. There is an ongoing series of videos that I’ve created that does cover all sorts of topics related to this, however.

And in the future I’ll create more videos that are more concisely focused on specific modder-oriented topics.

This video requires you be on version 0.109 or later of the game.

Thanks for watching!

Tutorial – Mesh Importing And Setup From Maya

March 7th, 2017 – Quick notes for Cinth (or modders!) on importing models and then getting them properly combined and atlased. Unfortunately if you want to use the same tools that we are for the atlasing and the combining, you’ll have to purchase licenses for those for yourself. But there are tools in Blender and other locations that do similar things for free.

The tools shown in use in this video were:
Mesh Simplify
Pro Draw Call Optimizer

Thanks, Amazon…

We’ve been using for years (since 2011 I think), and I can count the number of times they’ve had downtime on one hand…ish.

But today, the day after our alpha starts… naturally we get this:

Keith notes: “I’m particularly fond of We have now repaired the ability to update the service health dashboard.” From the AWS side.

Not sure how that’s going to impact our ability to get a new build out today; we’re still working away at things, but we can’t check in code or share it between us as of about 3 hours ago, and this outage is lasting longer than usual.