How would one optimise 3D turn based strategy games for faster turns?

I’ve noticed an annoying trend in turn based strategy games and I was wondering if anyone else had, it doesn’t matter whether it’s Civilization VI or the newer Total War: Warhammer 2 every single one of these modern turn based strategy games with extremely pretty graphics have one thing in common. They all have unbearably long turn times as the AI computers make their moves.

I gave a timestamp of a recent Let’s Play by creative assembly that shows exactly what I’m talking about, I doubt these will be on pathetic computers either, many games developers go with the i7 quad cores and 1080 graphics cards so there’s no way they should play like this.

Now you might think “But Lethn, even if it’s a minute, it’s not that long considering the size of the maps and the amount of computer players in games like this”. I agree, I suppose it isn’t, maybe I’m just impatient with that sort of thing but the only game I’ve found remotely acceptable when it comes to these turn times is Xcom 2 and I suspect that’s because it’s just you vs a single computer.

However, when you’re playing a particularly long game like this as I’m sure you know, it starts to grate, the problem sometimes even gets worse and worse the more units are put on the map because you have to rebuild your forces and constantly end the turn before you get curb stomped by the cheating AI and the wait times just get annoying. I know this is a bit of a rant but I’m wondering would there be a way to fix this type of thing in Unity? Or is this just a case of developers overextending their games and not optimising correctly for their computers? It seems to me the only logical option would be to reduce the amount of polygons in the game which would immediately fix turn times but of course reduce the graphics quality in return.

This would have less effect on improving optimization than other options.
Unity does provide a profiler and other ways to see what is taking up so much processing time/effort. So to answer the question - yes - Unity has systems in place to improve optimization.

1 Like

For starters, if you haven’t done so already, you should move the actual turn processing logic into a second thread. Once you have any effect the graphics will have on the game’s turn processing performance will be largely, if not completely, eliminated.

Second, the only logical thing to do in these situations, as mentioned by @theANMATOR2b , is to use the profiler. Guessing where your performance is being affected is a waste of time. You’ll often find yourself optimizing portions of code that have less impact than if you had listened to the profiler.

2 Likes

I totally felt the same way about the two Total War games that I’ve played. The shorter these boring AI turn times are the better.

I’m very certain that would do nothing.

I suspect the root of the problem isn’t even performance, but that they have stuff linked to an animation system that they can’t fast forward quickly enough. Eliminating that dependency and decoupling the animation from the gamestate can be a huge task.

1 Like

Ultimately you just have to deal with the fact that the simulation takes a long time to run. Even in a headless mode with no graphics.

Things to consider

  • The AI can make decisions while the player is having their turn.
  • Animations the player never sees shouldn’t be played.
  • The simulation should cheat as much as possible.

I bet the high end games mentioned in the OP are already doing all of this.

3 Likes

Modern editions of Heroes of Might and Magic have simultaneous play where the AI and the players are allowed to take their turns at the same time and this only changes once the game deems it feasible for them to interact with each other.

Like it has already been said, I don’t think graphics are the problem. More than likely the cpu is being eaten up by evaluating multitudes of possibilities and states far into the future. Unfortunately the fun of playing against an AI strategist is probably correlated to how much information it can process.

One of the biggest problems in AI is how to store the results of information-gathering in such a way that it not only doesn’t have to be evaluated from scratch each cycle, but remains relevant through unexpected changes in the game state (e.g. player behaviour) - and not only that but also efficiently re-evaluated in case of some state-changing event. I would imagine that many games simply re-evaluate everything from scratch to avoid game-breaking bugs, and suffer performance consequences.

2 Likes

Yep, this thread pretty much covers it. Even “simple” games like chess can have noticeable turn timers when it comes to higher difficulty partners.

Thanks guys, that’s pretty interesting, I was mainly asking this because I’ve noticed that these developers all do the same thing, I do think that Creative Assembly in particular have done very little optimisation on their AI because you can actually see them all taking their turns with the animations playing and so on rather than just warping across the map.

Just one of those things I’ve been observing when learning about games development, if you don’t believe me, the classic problem of Total War games has been with those accursed agents, it was really bad in Rome: Total War and they would constantly play their animations each turn when trying to assassinate your generals etc.

It wasn’t so bad in the previous games because the graphics weren’t a resource hog, but now they’ve upped the graphics even more than usual it’s getting to the point where I can’t even be bothered playing these types of games anymore.

There’s always stuff we can learn as games developers I’ve noticed from the games industry on how absolutely NOT to develop games because some of the stuff I’ve seen is ridiculous. For instance, I remember watching a video and I’m trying to remember the exact subject, but it was about making sure your particles pre-warmed and so on properly and this youtuber had actually found in Far Cry Primal of all places a bug where the developers simply hadn’t bothered making sure their particles were set right, this meant you’d have waterfalls taking a moment to start off before anything went on.

Seems to be a similar sort of thing here, they just haven’t properly checked for things and optimised.

That’s probably a deliberate design decision, not an oversight. You’ll did few things happen by accident in games.

There are a couple of plausible reasons to make this design choice.

  • Players need to know what the AI is doing to play the game.
  • The AI calculation goes on for a long time, so you might as well watch it animations in the meantime.
  • The designer is deliberately slowing down to control the pace of the game.

It’s very hard to believe that devs are unaware of basic optimisation techniques and just forgot to turn off animations that were off screen.

4 Likes

This has like nothing to do with graphics and everything to do with CPU power and animations.

Try turning the graphics down to the lowest settings and playing the game. See if that changes the time.

Endless Legend (Unity game by the way) has simultaneous turns through the entire game—certain units are locked in place during cases where moving them would cause interference—but there’s still an end-of-turn delay. It’s usually not very long though.

And yeah, graphics quality has basically nothing to do with it.

–Eric

1 Like

^^^

In general though - I would classify slow turns as either a design or programming failure. It’s very unlikely that any AI really needs to crunch enough data to slow down a modern cpu.

Paradox titles, which likely have some of the most data that needs processing play in real time, although there are noticable lags sometimes when the game does heavy crunching (end of each year in ck2 iirc).

Even in this game, this is a programming failure, since it should be distributed/multithreaded in that case with some processing each frame instead of a 5 second batch process.

I would imagine that “The designer is deliberately slowing down to control the pace of the game.” is the main reason for big budget games.

I would in most cases classify this as bad design though, but customers are conditioned to accept it because of a long history of strategy games.

1 Like

Some game possibility spaces are huge, though.

I too suspect that it’s also largely a design thing. I need to know what my opponent is doing, so I want to see their move as if I were playing them on a real tabletop, and doing that also makes it feel more like I’m playing against a real opponent.

Edit: clarification.

1 Like

I’m not certain this is the case.

If this were the case, one would think that a competitor would jump on it and release a product without the waiting time.

It’s also very noticeable in games like civ that the wait time scales with world complexity. If it was a design choice, I wouldn’t expect to see this happen.

I can’t see it as a artefact of showing off screen animations either. If civ played all animations, it would take a couple of hours.

Ultimately I think it’s just a massive search space.

2 Likes

It depends on what is being done, especially in terms of the resolution of information-gathering. For example let’s say that you have a terrain that’s broken up into 1024x1024 grid and you are evaluating line-of-sight from each point on the grid to everything else, it’s not hard to tank a cpu that way, especially if a highly-repetitive calculation isn’t optimised.

Generally I’ve found that AI decision-making in itself is rather light, but gathering information that might be considered good enough to make a reasonable decision under all circumstances, not so much.

1 Like

Sure it would. Design choices don’t only mean choices in the positive sense, design also works with the negative space: what not to prioritize.

There are a lot of ways to optimize LoS calculations for example, and if you aren’t using any of those in a situation that matters to game play, then this is bad programming.

In games like civ, I would expect that they don’t think that turn times are worth shortening, that the tempo of gameplay feels better with a bit of a wait. Because of that, they don’t bother with additional optimization past a certain point.

I just watched the clip Op provided - thats like 13 seconds of wait time.

Would you really call that unbearable?

There are modern games like “city of mordheim” that have truly unbearable turn times, I think that example is really pretty reasonable!

2 Likes

It would change nothing at all, whatsoever. The GPU completes it’s task in tiny fraction of the time vs the 10 or so seconds you’re complaining about.

The solutions for speeding that up will range from having cookie cutter strategies the AI can employ (known sequences in chess for example) to just offloading a fair bit of AI to the GPU (yes letting the GPU also do AI).

I would, yes. I would reduce the game parameters or play something else, but that’s me, I like Civ 5 on Deity but vs 3 other civs in a small/medium area, for example, and I like to complete within 1-2 hours.

2 Likes

Sure, my point is simply that a lot of AI stuff has to do with working on very large data sets that might have changed unpedictably over time and have to be re-chewed, and LoS is just one thing.

Yeah I wouldn’t be surprised, it would definitely help the characterisation of the enemy civilization and the whole aesthetic of a tactical confrontation if it did not make its move a nanosecond after the player finished theirs.