What’s we’re up to

Posted On 3 Aug, 2015
feature06

We released a series of bug fixes in short succession, and now we have been working a bit longer on the next one. Here’s what we are doing.

Jan has a huge batch of artwork that he is making in prep for the big content patch we will be doing months from now. That should keep him nice and busy for a while and it isn’t really the topic of my rant today. Meanwhile I’ve hit a milestone in my effort to eradicate bugs. It got to the point where most of the complaints in the bug reporting forum is about either crew on the player’s team, or errors caused by NPC ships. There’s one thing at the root of all of these bugs and it is something I’ve been meaning to overhaul for a long time: Factions.

Simply put, the code the governs who owns what ship is tragically flawed. I’ve known this for some time now, it was thrown together as an attempt to make enemies move and fight and it has yet to get the time dedicated to it that it deserves. However, I’ve now come to the point where those faction issues are the main source of pain for testers as well as the main thing preventing me from adding the new features I want to add in the next patch, so I’ve started redesigning the whole system.

To give a better idea of what the issue is here:

Ships inside the same sector as the player are fully simulated, they all have collision detection, they all have path finding, they all have crew, air, modules, and maybe fires moving around inside them. Their crew have AI that does its own path finding inside the ship and decision making and the actions taken by those ships is determined not by the faction controller, but by the individual crew members operating the ship attempting to accomplish goals provided by their faction. Once they leave the sector however they become something simpler, a mere symbolic representation of their former selves. They no longer have crew, and instead they obey the commands sent by their faction in a more simplistic manner.

The issues all lie in the conversion. When a player moves from sector to sector, or when a player saves and loads the game, symbols get converted into ships and back into symbols again. You can imagine this is a very complex translation with lots of edge cases and the truth is I never designed a flawless general solution in code, only in my head. As a result, factions have to handle the translation on a case by case basis, and that code is messy and prone to errors. A common example is when you enter an enemy ship and save the game, and then load it again. In the process of saving and loading that ship was turned into a symbol and back again, which is no issue, except some faction code is apparently trying to control the ship by setting the faction of every crew member resulting in players losing control of their allies or in some cases their own character. This bug shouldn’t be such pain to track down, there should be exactly one location where that code happens and that’s what I am making right now: a general solution for faction control of ships.

Once I build this system all faction code will have to be rewritten from scratch, however I suspect that will be the easiest part of the whole ordeal. The new code should be way simpler and more bug free because it will be more highly abstracted with less potential points of failure. More importantly I expect this new system will allow me to start doing more interesting things with the existing factions, which is a big part of what we have planned for the next content patch. Factions are overly simplistic right now, and the biggest reason for that is that they are bogged down by lots of duplicate code. If faction code can be cleaned up I can start giving them the ability to plan complex missions, send dynamic convoys, respond to events, etc. Also, I expect to add in some features for the player to use when controlling their own faction, a process that is especially complicated right now by the fact that the player faction gets special privileges. (like respawning for instance)

Anyhow, I just wanted to come and rant here for a bit so you didn’t think I was ignoring the fact that your crew members disappeared or started attacking you, or that the game gets laggy due to AI stupidly wandering into asteroids all day. I’m working on those issues the long way: by addressing the root cause.