Published on Tuesday, November 22, 2016 By Draginol In GalCiv III Dev Journals

So tomorrow is my first day on GalCiv III. It’s been a long break for me. It’s very nice returning to my baby. GalCiv III is the first GalCiv game I didn’t design or get to spend much time on.

A few observations

The engine is fancy

I basically have unlimited memory to work with. However, it uses a lot of memory. This isn’t terribly surprising given how complex the ships can get.

But it is still a problem.

I spent a little bit of time with this. If we require DirectX 11 and leave the DirectX 10 folks behind, we can, literally, halve our memory use in texture compression.

The Job System needs to be updated

GalCiv III’s engine is both its strength and its weakness. The strength is that it has incredible potential as a 64-bit, multi-core, high performance engine. The weakness is that these features can (and are) abused.

A high performance engine means it has the ability to be really really fast. But there’s another way of looking at it: It’s also very very forgiving of non-performance tuned code.

Not all cores are created equally. Notice that one of them is pegged. Now, imagine if you’re playing a 2-core CPU (like a laptop). This would be an issue.

A few examples is that there are a lot of calls for high precision timers in the gameplay code when, in fact, we only need the current time in seconds. Things like that add up faster than you might think.

Performance Tuning

Before I can even contemplate writing AI code for GalCiv III, the performance has to be a lot better. I can’t afford to wait 30 seconds between turns. It’s late game AI performance that needs help. But I can’t spend 3 days playing a game to make a few changes. The turn times have to get drastically faster.

Now, mind you, even today, GalCiv III is, to my knowledge, the fastest 4X at doing turns. That is, late game, waiting 30 seconds for 20 players on a large galaxy to do their thing is actually pretty impressive. But it can be a lot better.

And so that’s what I did yesterday and today: I made it a lot faster. A lot faster. Loading up the game is about half the time it was. Turn times are about a quarter the time they were. But there’s a caveat to my performance tuning: If you’re running 2 cores, you won’t notice any difference. If you have 4 cores, you’ll probably notice. If you have 8 cores, it’s massively better. That’s because I solved many of these problems through improving the task system.

Instead of an AI player going through all its ships one at a time to do its pathfinding, I just split it off into the N-1 cores at a time to do it. That is, if you have an 8 core PC, it’ll do 7 ships simultaneously.

Just warming up

Don’t get too excited. My check in (which you should have shortly) should make the game faster and more stable and use a lot less memory. But this is nothing. This is one day’s worth of effort. There’s a ton of low hanging fruit.

If I hadn’t checked in an update to Ashes of the Singularity: Escalation (if you don’t have it, do me a favor and go get it! <G>) to update their high level units, I’d have been able to fix that damn animation on loading thing that bugs the hell out of me (the galaxy should spin smoothly but there’s a call in its thread that sucks up too much CPU at a time).

This is for the base game

I will be getting to the expansion pack AI as well. But I want the base game’s AI and general performance to reach a place that are more satisfying.