So many crashes, so little time.
Well, not really. Not on the time part anyway. I have a crazy amount of time.
I hate to say this guys but I enjoy your crash reports. I’ve mentioned before that this is the first game I’ve been lead developer on since…I think The Corporate Machine which was like 1999. Thanks to the sale of Impulse, I can…indulge myself here.
So anyway, here is why your game crashes (most of the time).
Unlike with War of Magic, Fallen Enchantress is very very multithreaded.
That means, that lots of things are happening at the same time. But it also means a lot of things can be changing variables at the same time.
If we weren’t stuck with DirectX 9, I’d be able to do some crazy insane things with the threads (with DirectX 10+, I could send a lot of my AI onto the GPU and let’s face it, you guys know I’d totally do it because I have a disease when it comes to computer AI).
Now, with FE, I’m dealing with Kumquat which was architected under a very different set of circumstances. So it wasn’t designed to be as multithreaded as I’ve been making things. This means I have to use what are called critical sections to keep thread A from changing something that thread B is currently looking at.
If I miss one, the game crashes. If I put in the wrong critical section, the game will hang hard (like lock up).
Here’s a classic example:
Thread 1:
for I = 1 to Number_Of_Cities
City = ListofCities[i]
Thread 2:
if CityConquered THEN Number_Of_Cities++
So you can end up where thread 1 ends up looking at a piece of data that is literally garbage and trying to do something with it. The result, a crash.
Now, you might say, why have all these threads?
I can only respond by suggesting the loading up of War of Magic v1.4 and playing through a late game. Nearly all the performance gains in FE are from multithreading. Your CPU probably has 2 to 4 “cores” on it. That means they can do a lot of cool stuff at once.
And in the future, when we ditch DirectX 9, I’ll be able to spin your graphics adapter into splitting up its drawing (#1 reason to look forward to an XBOX 720 is that it’ll probably be DirectX 11 based and that’s a very big deal).
It is a non-trivial effort to nail all these down. The good news is, it’s not hard. It just requires a lot of testing and evaluation which is what we’re doing. Your crash reports have made a world of difference.