1UPT rules out multicore AI

gladoscc

Warlord
Joined
Aug 5, 2011
Messages
125
The long turn speeds is because of one reason: 1 unit per tile.

In Civ 4, it doesn't matter if there is a unit on tile X. The AI can move units in any order, in parallel, and at the end check for collisions between different armies (combat). Think of it like this:

Core 1: Best move for unit A.
Core 2: Best move for unit B
Core 3: Best move for unit C
Core 4: Best move for unit D

Civilization V:

Core 1: Best move for unit A
Core 2: Cannot calculate, because unit A needs to move first otherwise there will be stacked units
Core 3: Sitting idlely
Core 4: Sleeping

Unit movement speeds have just quadrupled on a four core.
 
...so, which online university did you do your computer science course at?

Moderator Action: if you disagree with a user's post you are welcome to criticize/discuss the content of the post, attacking the user themselves is unacceptable. - ori
Please read the forum rules: http://forums.civfanatics.com/showthread.php?t=422889
 
...so, which online university did you do your computer science course at?

Harsh, but sadly true. OP, there's a thousand things wrong with your presumptions about how Civ IV works.
 
Harsh, but sadly true. OP, there's a thousand things wrong with your presumptions about how Civ IV works.

Really? I only spot one thing wrong with OP's statements. Civ 4 doesn't use multi core processors. The game engine can only handle the one processor.
 
If the AI in CiV worked like the OP thinks it does (and I know enough to know it doesn't), then one could note that his CiV AI could use multiple cores by the simple expedient of each core moving units in different areas of the map.
 
1UPT does make pathfinding require more resources (and therefore longer TBT), but it's not like the AI can't use multicore CPUs and having a quadcore instead of a dualcore will shorten the TBT.
 
One thing I've never understood is how Civ 1 on my Amiga was markedly quicker than Civ 5 is on a speedy PC. I understand that the game is more complex these days, but given the 1,000fold increase in processor power between the two PCs, I don't think the game is 1,000 times more complex.

Is it just laziness from programmers that they think they don't need to optimise things cos computers are so much faster and people are simply used to relatively long turn times?
 
Empirical evidence argues against you. I can set up system monitors that report usage. The NVIDIA drivers seem to have a good report tool. It does show the system using all 4 cores in between turns. I am not saying they are being used efficiently, but they seem to be in use.

Your programming algorithm assumptions seem off to me. If the AI is already aware of a simultaneous turn algorithm for Multi Player, (however badly that may function) then there is nothing that prevents it from using that same code for in between turns on Single Player. Why invent two sets of AI codes?
 
Really? I only spot one thing wrong with OP's statements. Civ 4 doesn't use multi core processors. The game engine can only handle the one processor.

Well for one, the whole idea that he claims to know exactly how Civ's AI is programmed and presumes that one, single supposition to account for the entire turn delay difference between two different games.

But more than that...You don't move units X and Y independently. The best move for unit X often depends on where you're putting unit Y and unit Z. If it worked the way the OP suggests it would, then the AI would be completely incapable of using units in a coherent manner because they would constantly be moving all over the place.

Finally, it assumes that there are absolutely no other tasks at around the same time that could be done in parallel. If the AI is currently moving its units around, then it cannot think about anything else in its turn other than moving those units in that singular location around.


One thing I've never understood is how Civ 1 on my Amiga was markedly quicker than Civ 5 is on a speedy PC. I understand that the game is more complex these days, but given the 1,000fold increase in processor power between the two PCs, I don't think the game is 1,000 times more complex.

Complexity is not a linear thing. Many things will increase the load on the processor exponentially or faster. When's the last time a duel map with 2 civs took any amount of time between turns?
 
Empirical evidence argues against you. I can set up system monitors that report usage. The NVIDIA drivers seem to have a good report tool. It does show the system using all 4 cores in between turns. I am not saying they are being used efficiently, but they seem to be in use.

Your programming algorithm assumptions seem off to me. If the AI is already aware of a simultaneous turn algorithm for Multi Player, (however badly that may function) then there is nothing that prevents it from using that same code for in between turns on Single Player. Why invent two sets of AI codes?

While there are a few threads in Civ5 (game/AI, render, sound) only a single thread is running the AI, each AI action is a decision that depends on the previous ones. What your report tool is showing, beyond the render and sound thread, is the Windows kernel shuffling the AI thread between cores - this is normally a good behavoir (though it reduces the effectiveness of Intel's Speedboost unless there is enough load for all the cores) because it prevents one core from being run hard while the others sit idle.
 
One thing I've never understood is how Civ 1 on my Amiga was markedly quicker than Civ 5 is on a speedy PC. I understand that the game is more complex these days, but given the 1,000fold increase in processor power between the two PCs, I don't think the game is 1,000 times more complex.

Is it just laziness from programmers that they think they don't need to optimise things cos computers are so much faster and people are simply used to relatively long turn times?

Civ1's AI was only quick because it was also abysmally bad. The AI of recent Civ games has not only to deal with much more complex decisions, it also can't get away any more with making as many bad decisions as the Civ1 AI did. Twenty years of computer games development have risen the bar of what's deemed acceptable. Unfortunately, very simple AI improvements may require lots of processing power.

Releasing a strategy game today whose AI adheres to the standards from 1991 ... would be like releasing a shooter with VGA graphics.
 
Man... you would have each core working on a different facet of unit A. After that's done, each core would work on a different facet of unit B.

Or each core would in fact manage several units in tandem since they all have to take each other into account (ideally).

If anything 1UPT would make multicore more beneficial, I couldn't imagine a universe where it would make it less.
 
Civilization V:

Core 1: Best move for unit A
Core 2: Cannot calculate, because unit A needs to move first otherwise there will be stacked units
Core 3: Sitting idlely
Core 4: Sleeping

That's why it can't be done like that. A better way to do it would be more like:

Core 1: Best move for unit A partition 1
Core 2: Best move for unit A partition 2
Core 3: Best move for unit A partition 3
Core 4: Best move for unit A partition 4

That is, divine the path finding problem of an unit to four partitions that each take roughly the same time to finish.

Btw. the whole approach of calculating movement for one unit at a time, independently from movements of other units, is flawed if you want the AI to be competitive (although that is the way it's probably done, and that's why the AI throws its ranged units and generals in front etc.).
 
Man... you would have each core working on a different facet of unit A. After that's done, each core would work on a different facet of unit B.

Or each core would in fact manage several units in tandem since they all have to take each other into account (ideally).

If anything 1UPT would make multicore more beneficial, I couldn't imagine a universe where it would make it less.

As far as I know, Civ, like most games, isn't programmed to take advantage of SMP (Symmetric Multiprocessing). That means that it cannot take full advantage of multicore CPUs.

The main advantage, and the main perceived speedup from running Civ on a multicore machine seems to stem from the fact that hardware interrupts and CPU calls from other processes running in the background are less likely to deprive Civ of a CPU core.
 
A couple of fair points re: the Amiga v Fast PC issue.

Although I will say this - I don't remember the AI being really bad in earlier Civs - especially Civ 1. Of course, I was obviously not as experienced as I am now - but I do remember being shocked and pleasantly surprised when I was playing a game on the highest level and all of a sudden, a supposed friend turned up on my doorstep out of the blue and took out my cities with battleships and tanks. I'm guessing this was because I'd recently shipped my entire army to the end side of the world to take out a mutual enemy.

I realise this isn't really representative, but I've never seen that in the latest CiV!
 
Keep in mind that whenever you add new mechanics, the AI has to be taught to use them. Even back in the 90s, a computer was able to beat one of the best chess players in the world, because Chess is fundamentally a simple game. Even with such a simple game, the AI that beat Kasparov was run on an extremely powerful supercomputer.

Civs 1 and 2 were far simpler, as far as number of mechanics goes, than Civ IV or V. Creating an AI that can properly take advantage of all of these mechanics is going to be way, WAY more demanding on the processor. It's not that the Civ V devs are just incompetent at designing AIs, it's just that there's a limit to what modern processing power can do and any AI improvements need to be done with that in mind. A good human player in a game with as many mechanics and nuances as Civ V is going to rape the face off of any AI that could actually feasibly run on a modern computer. What you're seeing isn't the Civ V devs being incompetent, it's the limitations of AI.


Of course, the AI can still be made better - it can always be made better. It's just that the idea of a truly intelligent AI, being able to compete one on one with an experienced Civ player, is a pipe dream.
 
Keep in mind that whenever you add new mechanics, the AI has to be taught to use them. Even back in the 90s, a computer was able to beat one of the best chess players in the world, because Chess is fundamentally a simple game. Even with such a simple game, the AI that beat Kasparov was run on an extremely powerful supercomputer.
.


This is my biggest concern. Alpha Centauri is often lauded for its depth, but it had a lot of features the AI couldn't handle.

So features discussions always comes with issue on whether the AI can handle it. And the Civ franchise from III on has had a fairly mixed/positive record on this. On one hand, there is a stated commitment to provide symmetry between human and AI, on the other hand, gameplay preferences tend to create things like vassals, religion, right of passage agreements that the AI can't fully handle and can only be forced to use in a very restricted way.

Civ5 have issues where the AI get to do things, like taunt, ask for gifts, that human players can't do.

Those things always annoy me. But I think this will be a struggle we'll have forever as long as Civ is a commercially facing franchise that prioritizes sales and gratification of fans over fairness and total balance (ie: As Soren noted, providing some slack in the AI can give more fun than having a tight game that's restrictive ) But it's definately a balancing act, and I feel there's a tendency in the fan community to go completely for fun features and it's far easier to argue for vassal states,colonies and all that stuff than to say 'no we can't do it; let's imagine those same things more abstractly using known limitations and taking into account what the AI can handle'
 
I don't remember the AI being really bad in earlier Civs - especially Civ 1. Of course, I was obviously not as experienced as I am now - but I do remember being shocked and pleasantly surprised when I was playing a game on the highest level and all of a sudden, a supposed friend turned up on my doorstep out of the blue and took out my cities with battleships and tanks. I'm guessing this was because I'd recently shipped my entire army to the end side of the world to take out a mutual enemy.

Well, the biggest advantage of Civ1's AI is probably that it was played against by people who didn't yet understand AI programming well enough to peek behind the curtain.

Civ1's AI had a line in its code that literally said "If the year is 1900, and if the player is in the lead, attack him." It was very crude. But most players simply didn't have the necessary experience to evaluate an AI and attributed a level of reason to it that was far beyond the real thing. In your example, you "assume" that the AI had a good reason for its decision, when in fact it may just have triggered the very crude line of programming I quoted above. (Actually I doubt that the Civ1 AI had any concept about where the player's armies were, but I'm not 100% sure.)

Another example is that Civ1 tried to bring trailing AIs back into the game by gifting world wonders to it. It's blatant cheating, but as players, many of us assumed that the AI had actually built that wonder, when in fact there was just an algorithm that decided "This AI has fallen behind, I'll grant it a free world wonder so that it can catch up."

If such an AI were released in a modern strategy game, people would criticize it heavily. They would recognize (and rightfully criticize) that an "attack player when he's leading" algorithms devaluates peaceful approaches - no matter what you do, the AI will eventually be out to get you, even if you were partners for millennia, even if it's against the best interests of the AI. They would also identify the "free world wonders" as blatant cheating (in hindsight, it would have been easy to identify in Civ1 too, as the AI often "built" wonders in cities that had no way of providing the necessary amount of shields).

This can actually be seen in players' reactions towards the Civ5 AI, which in several ways was a step backwards to the Civ1 AI (at least on release, I don't know if and how much it has improved by now). But exactly the same things that were okay for Civ1's AI were heavily criticized in Civ5, and rightly so. It simply isn't acceptable to go back to the primitive and crude ways of AI design from 20 years ago (especially not if the AI _still_ takes a lot of time to process its actions, even on modern hardware). ;)
 
This is my biggest concern. Alpha Centauri is often lauded for its depth, but it had a lot of features the AI couldn't handle.

So features discussions always comes with issue on whether the AI can handle it. And the Civ franchise from III on has had a fairly mixed/positive record on this. On one hand, there is a stated commitment to provide symmetry between human and AI, on the other hand, gameplay preferences tend to create things like vassals, religion, right of passage agreements that the AI can't fully handle and can only be forced to use in a very restricted way.

Agreed. Alpha Centauri is a good example for a game that was full of interesting features, but the AI could handle only a fraction of them. Another example in the same vein is "Master of Magic": Great concept, amazingly diverse and complex features, but the AI couldn't grasp them at all and needed absolutely insane bonuses to offer a challenge.

On the other end of the spectrum, you have games like "Galactic Civilizations". The AI in these games works quite well, but the game was designed from scratch with the goal to be manageable for contemporary AI algorithms. As a result, the games end up as favorites of players who want strong AIs, but are criticized by other players for feeling bland and formulaic.

For the time being, if you design an AI, you have to find some middle ground between a game that's rich in interesting features and a game that features a strong, competitive, non-cheating AI. You can't have both. The best way of doing it is (imho) the way that Civ4 chose: Ship with a decent AI, but release the AI code so that the community can improve it. The casual players will be satisfied with the original AI, and the hardcore players (who won't be) are free to improve it.

(Side note: I think that even contemporary AIs _could_ be much better than they are if AI programming was seen as more important by game designers and especially publishers. But this is wishful thinking, as Jon Shafer revealed during that now famous talk round, in which he fully acknowledged that publishers have no reason to invest in a good AI as it wont increase their business. While I do disagree with this statement, it accurately reflects the current line of thinking among the people who finance game development.)
 
Top Bottom