Targeting Woes: Blair’s First Dev Diary
I’ve decided to write my first diary as an exploration of the reasons behind one of the most insidious and annoying bugs we’ve had throughout this nearly year long beta process. It’s the bug that seems to creep its way into every release in some form or another: fighter, bomber and flak frigate targeting badness.
In Sins we really want to help players execute their battles as efficiently as possible. This isn’t to say we want to eliminate the advantages of handlings things yourself, but more that the artificial intelligence (AI) should really take care of a lot of the really basic stuff leaving you to deal with more creative solutions and higher level decisions or to just allow you to sit back and enjoy the cinematic battles. One of the key ways we accomplish this is to make sure that the default targeting AI for units will choose targets that that unit is most effective against. This is a very difficult problem and there are a lot of constraints and heuristics involved in arriving at a solution so there is a lot of potential for things to go wrong. And when it came to fighter, bombers and flak frigates lots did go wrong.
Let’s start way back in beta 1. The first report was that fighters and bombers (collectively referred to as strikecraft) weren’t attacking at all after engaging their initial target (i.e. they just sat around like lawn gnomes on a sunny day while a huge battle raged all about them). The problem here was that the individual strikecraft are collected under an abstract unit called a ‘squadron’. When the squadron’s previous target became invalid (most likely because it died) it reacquired a new target but failed to propagate this information to the individual units in the squadron. Thus, they didn’t feel they had a target so they sat around. At the same time flak frigates were failing to attack because while strikecraft were considered threats (they did damage) the abstract unit of ‘squadron’ did not. The flak frigate would then dismiss the squadron as a valid target and cull it before being able to determine if any of the specific units in the squadron were actual threats.
In beta 2 we had the problem where bombers would prioritize fighters over other more important targets. We fixed this simply by changing the bomber’s weapon data to say he couldn’t attack fighters. We failed to look further into the cause and it would come back to bite us in beta 3.
In beta 3 we had yet more reports of bad fighter, bomber and flak frigate targeting behavior. However, we couldn’t recreate the issues so I asked for save games showing the badness. The underlying problem was related to why the bombers were choosing to attack fighters in beta 2 and we had just masked it by making it so bombers couldn’t even shoot at fighters. To understand the real problem I’ll have to describe a bit about how some of the Sins targeting works. At a certain level, potential targets are sorted into special lists based on the attacker’s weapon attack type for a given weapon and it’s effectiveness against a specific armor type. Once, targets are organized in this fashion, the attacker processes those targets to make a final selection based on a bunch of other criteria. The problem is that during this list creation problem, strikecraft often ended up in the same list as non-strikecraft units. All other factors being equal, it was therefore just as likely the unit would choose to attack a fighter as it would to choose say a gauss defense gun. That is why you would often see bombers chasing fighters or inversely, flak frigates attacking non-strikecraft. Therefore, the AI for certain ships needed another special list to organize strikecraft and this new list had to take priority over various other criteria like attack type and armor type. Because we felt this was the ultimate underlying cause to the final targeting issues, I issued a statement in the beta 3 patch list that I was a monkey’s uncle if it wasn’t fixed this time…unfortunately for me I learned shortly after that I am indeed a monkey’s uncle.
So welcome to pre beta 4. The final known issue with the fighter, bomber and flak frigate targeting is again, something we needed the beta testers to find for us and send us save games because our trusty beta testing team is much more efficient at uncovering the special situations that expose these kinds of bugs. At the beginning of the game I talked about how Sins has a lot of features like smart targeting that are supposed to help make running an empire in real-time manageable. One of the other systems is the auto-planet-defense AI which kicks in when you aren’t around to manage the defense of the planet yourself. Part of this code instructs certain units and defenses to heavily weight enemy units that can bomb the planet. However, due to a flaw in the recruitment logic, fighters and flak frigates were being told to target the enemy siege vessels even though they were next to completely useless against them. In beta 4, you can expect the auto-planet-defense AI to behave more appropriately.
Perhaps it was a bit technical, I don’t know, but I hope you enjoyed my first dev diary and learned a bit about what goes on behind the scenes of Sins. I also hope you find the unit AI to be more useful and fun in our upcoming releases. We are still working on improving it and we are also including more tactical options to help out as well.
Blair reporting out.