Brad Wardell's views about technology, politics, religion, world affairs, and all sorts of politically incorrect topics.

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.

image

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.

image

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

image

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.

That’s all for now.


Comments (Page 2)
on Nov 24, 2016

Please keep these dev diaries coming -- I really enjoying reading them, thank you!

on Nov 24, 2016

Love dev journals like this

Glad to hear you got some performance updates out of the "ol'" engine. Guess I should return to my massive galaxy shortly then, still looking for "my" planet.

 

on Nov 24, 2016

Frogboy

Lol.  

Of course the game's been optimized over the past 18 months.  But we all have different thresholds of what represents "good enough".

Go play some Civilization VI and come back and tell me about long turn times and long load times.  They had a massive budget and the game has immensely long turn and load times with a fraction of the data we have to deal with.  The reality is, slow turn times, slow load times and great AI don't affect game sales. 

BTW, I'm not doing optimization.  I'm doing architectural re-design which is a very different thing.

In every industry there are specialists.  At the risk of being even more unprofessional, there's no one else in the game industry with more experience than I have in this area.  I've been optimizing and doing AI for longer than any other person (over 20 years in the industry doing this).  It's a non-trivial thing.  I wrote the very first commercial multithreaded computer game. And that was mainly because so few developers care about that kind of thing.    

Thanks for the clarification, I love that you find ways to improve the performance.  Good luck on your journey....  

on Nov 24, 2016

My pleasure. 

The really short explanation is: A lot of this is more of an art form than a science and unfortunately, there is no substitute for experience.

What bugs me, as a gamer, may be completely different than what bugs someone else.

For instance, I've spent 3 hours today trying to make that twirling galaxy animation go smoothly when loading up a game.  Because of the way it's implemented, it's really really hard to make that smooth (I thought I could just throw it in a thread, I was wrong).  But it bugs me a lot that it isn't smooth when loading.  But someone else would say, "Meh."

 

 

on Nov 24, 2016

Frogboy

My pleasure. 

The really short explanation is: A lot of this is more of an art form than a science and unfortunately, there is no substitute for experience.

What bugs me, as a gamer, may be completely different than what bugs someone else.

For instance, I've spent 3 hours today trying to make that twirling galaxy animation go smoothly when loading up a game.  Because of the way it's implemented, it's really really hard to make that smooth (I thought I could just throw it in a thread, I was wrong).  But it bugs me a lot that it isn't smooth when loading.  But someone else would say, "Meh."

I always thought this was an indicator of it making progress loading.  I thought it would be nice especially on larger maps or in larger galaxies in MP (as it takes a while to load) to have a progress bar of some sort to let the player know that the game is still working but, I havent seen the load times I did at one time.

on Nov 24, 2016

Frogboy

For instance, I've spent 3 hours today trying to make that twirling galaxy animation go smoothly when loading up a game. Because of the way it's implemented, it's really really hard to make that smooth (I thought I could just throw it in a thread, I was wrong). But it bugs me a lot that it isn't smooth when loading. But someone else would say, "Meh."

 

I feel your frustration,

I spent several hours today implementing and testing a 'drag and drop tech stats' feature for my tech tree editor, only to remember that stats prerequisites are not unique and can effect several trees. So I had to shelve it.

 

se la vie

on Dec 14, 2016

Sounds good, but...

 

Shouldn't this kind of "low hanging fruit" type of optimization have been done during development, like ages ago?

 

I know Frogboy is the man and all but I'd hope they had a few people working on the game that had some clue about writing code and writing reasonably efficient code!

on Dec 14, 2016


Sounds good, but...

Shouldn't this kind of "low hanging fruit" type of optimization have been done during development, like ages ago?

I know Frogboy is the man and all but I'd hope they had a few people working on the game that had some clue about writing code and writing reasonably efficient code!

Perhaps you would like to read what Brad has stated, he didn't optimize the code.

Frogboy

Lol.  


Of course the game's been optimized over the past 18 months.  But we all have different thresholds of what represents "good enough".

Go play some Civilization VI and come back and tell me about long turn times and long load times.  They had a massive budget and the game has immensely long turn and load times with a fraction of the data we have to deal with.  The reality is, slow turn times, slow load times and great AI don't affect game sales. 

BTW, I'm not doing optimization.  I'm doing architectural re-design which is a very different thing.

In every industry there are specialists.  At the risk of being even more unprofessional, there's no one else in the game industry with more experience than I have in this area.  I've been optimizing and doing AI for longer than any other person (over 20 years in the industry doing this).  It's a non-trivial thing.  I wrote the very first commercial multithreaded computer game. And that was mainly because so few developers care about that kind of thing.    

 

on Jan 24, 2017

...and what constitutes "low hanging fruit" is dependent on the capabilities of the person making the comment.