# "The Bad Sequel": Sullla's Analysis of Civ5

Discussion in 'News Updates' started by Ginger_Ale, Jan 12, 2011.

1. ### LordTCWarlord

Joined:
Nov 30, 2003
Messages:
241
Location:
Toronto
Actually workers aren't so bad, the number of tiles in your own territory is a fairly small number. The number of improvements you can put on a tile is fairly small as well. You're probably only looking at 100,000 or so possibilities in a typical setting.. the AI uses a function to score each of them, and picks the improvement that gives the maximum score to build. The score can depend on factors like worker-distance, a benefit value of the improvement, whether it replaces an existing improvement, or pretty much anything at all really. Computing the actual function scores for each tile improvement probably takes less than 1 millionth of a second, so doing all 100,000 and picking one, probably takes about 1/10th of a second. Even if there are 40 AI workers in the game, and you recalculate these values all the time, the workers are largely staying improving their current improvement, so you only have to calculate lets say 15 workers a turn, which takes probably 1.5 seconds at worst.

It's not actually exponential because it's not critical to consider what worker A is going to do, when you are deciding what to do with worker B. You don't have to consider all possible orderings of all possible workers to assign tasks.

Joined:
Aug 23, 2007
Messages:
2,520
The above is obviously true, that is basic 101 complexity theory (as you already say yourself).

I am not arguing it is not exponential, I am saying the number of feasible combinations which have to be checked is considerably less than the number of available combinations you mentioned in your post.

Also, since your argument seems to be about movement order, not pathfinding, I do not see this as a big problem. Rarely do I have many units so close together that movement order actually has to be considered. If the units are far enough apart that order does not matter, the problem also is linear in Civ 5.
For units which are close together, there are some fast rules which cut out plenty of options (e.g. move the unit in front before you move the unit in the back). It clearly does not stay linear because of that, but it also doesn't grow so fast as to take forever / very long to resolve.

Also, not getting the absolute best option is not that bad, making it easier / faster yet again. The end result is that you should be able to most of the time get a pretty good result without spending a lot of calculation time.

3. ### LordTCWarlord

Joined:
Nov 30, 2003
Messages:
241
Location:
Toronto
Defining front is tricky if you're for instance splitting up a group of units to send them to 2 different areas for 2 different objectives. Yes, you can get away with a reasonable linear approximation some of the time, but there can be problems. It also gets pretty horrible if you look at some modern era maps where the map is almost coated with units. If you get anywhere close to these situations, there is no basically linear due to sparse placement of units.

Also, you're suggesting the AI should prefer to have units be relatively far apart, which is strategically awkward for any war objective as easy paths from far apart result in it being harder to provide valuable tactical support like flanking bonuses,etc.. The fact that there is no splash damage to neighboring tiles basically suggests you want tight lines of units whenever you're actually fighting, and these tight lines are creating the precise problems I'm suggesting.

4. ### m4gill4King

Joined:
Aug 8, 2007
Messages:
772
Location:
CA
That's not fair. He was asked to rework that specific article. The long-winded original was long-winded because he presented lots of data and evidence for his arguments. That may seem superfluous to those of us who already agree with his thesis (which you summarized nicely), but there are others who for one reason or another will be reading more critically, and he has to have solid arguments to overcome their predisposition and get them to consider the thesis.

1UPT
It breaks the game, simple as that. Sullla lays it out with the help of Luddite, but I can distill it down a bit further:

WHEREAS
1. There are only so many land hexes on the map. That is the practical limit for all military forces in the game, due to 1UPT (although in theory you could fill the sea as well).
2. Having a military unit on every single tile in the game is not desirable (see Carpet of Doom)
3. To prevent this, production must be regulated by external limits. Lower tile yields are the main technique of limiting production.
4. Buildings can't be too good so as to improve the city's production to the degree that unit spam (and therefore CoD) can ensue.
5. It is a delicate balancing act to slow everything down like this to prevent unit spam clogging the map, without making a game that is boring because nothing happens for dozens of turns at a time.

THEREFORE:
It is not 1UPT in and of itself that is not fun. It can be fun, in a vacuum it's a perfectly fun concept for a strategy game. But there are inevitable consequences of 1UPT as a battle system that can only hinder an empire building game. Any fun gained by the increased tactical depth offered by 1UPT comes directly at the expense of the rest of the game mechanics which suffer for it greatly.

It is only through irritating external restrictions that these irreconcilable forces can be shoehorned together to something vaguely resembling an empire management game like civ IV. These unnatural and contrived external restrictions include global happiness, low tile yields, the continual nerfing of buildings and social policies via patches, anything to prevent the player from building too much stuff. The result is that there is nothing remotely fun to do except go to war.

Joined:
Aug 23, 2007
Messages:
2,520
I didn't suggest that, all I said was that frequently (esp. earlier) there is a lot of space between units, making this a non-issue.

Keeping them far apart is not a solution, if you have many units, they do need to be close to each other on the frontline - and I agree that this is the scenario in which move order becomes complex.

Even at that time, the troops still getting to the front usually travel alone or in small groups however, so there still are units for which movement is easy, so the problem / complexity where it does become exponential is confined to a few locations on the map and the units lined up there.

So while it is somewhere between linear (order does not matter) and 'truly exponential' (everyone steps over each other), I expect it to tend more towards the linear end of the scale, i.e. low exponential, even though it if 'worst-case exponential'.

6. ### LordTCWarlord

Joined:
Nov 30, 2003
Messages:
241
Location:
Toronto
I don't think you care as a videogame company if 99 out of 100 turns the AI is quick and 1 turn out of 100 it takes a huge amount of time. You need it to be more consistent than that, especially if the huge amount of time is potentially in the 10 minute range.

If the AI takes forever whenever it needs troops for a war (bogged down tight movement at the front), etc. then there are problems. If it takes forever whenever it decides it needs to pull back 1 set of units to one battle while keeping another set of units at the front to fight the other battle you have major problems.

With 1UPT, basic movement becomes a major headache of an AI problem that can potentially ruin the game either through bad decisions (like archer blocks in 4 pikeman because it was his turn to act and he didn't consider other units- this happens pre and post patch in civ V)) or through bogging the game down to a crawl.

7. ### cephaloDeity

Joined:
Jul 26, 2007
Messages:
2,058
Location:
Missouri, USA
I think you're making mountains out of molehills with the AI possibilities. The scenario you mention here is fairly trivial to solve simply by examining the tiles that are under enemy threat and breaking up the AI processing into various phases. There's no reason why each unit must complete its turn in one pass. That's maybe how its being implimented, but it doesn't have to be that way.

If the available archers can eliminate the enemy threat that turn by firing, they should shoot. If that is unlikely, then they need to do nothing for the initial phase and preserve their MPs. The Civ5 rules allow units to trade places without an extra 'storage' cell, so if there's a pikeman behind an archer somewhere, he can simply swap with the archer. It's unlikely there would be an unresolvable traffic jam in this case. After the front line units have taken their positions in the threatened tiles, and the archer has movement left, he can move to available safety if he is still under threat or keep his place behind the pikeman and engage in any opportunity fire.

It's easy to designate the 'front' as tiles that can be attacked vs. tiles that cannot be attacked.

8. ### scratchthepitchKing

Joined:
Feb 13, 2010
Messages:
798
A very simple way to remove a lot of the pathing problems with 1up is to allow friendly units to pass through other friendly units and to increase the number of hexes. Pathing has always been a weak area in Civ. In the first 4 editions, you literally had to hold the hand of a unit and walk it tile by tile to its destination.

9. ### CyrinnoWarlord

Joined:
Oct 20, 2010
Messages:
253
Civ4 wasn't perfect for me, I hated the combat system and serious graphical issues, since launch units attacking each other would completely bug out graphically sometimes going on a continous walk across the world. Half the time the promotions also didn't seem to work.

Where in Civ4 colonisation all the promotions seemed to work fine. Which was confusing since it's the same engine.

Seems Civ5 multiplayer is the victim of this new facebook game, why create competition for own product. Make issues with Civ5 multiplayer so we all get onto this civ world.

Civ5 is a good base to me, it does have issues definately, I especially hate the mods not working in multiplayer and no unit animations in multiplayer. I find it easier to run larger empires in this game then pervious civ games. Buildings could be more interesting in this version of civ, thats for sure and building doesn't bring as much satisfaction as other civs.

10. ### LordTCWarlord

Joined:
Nov 30, 2003
Messages:
241
Location:
Toronto
The point is anything that considers units as related to other units rather than in a vacuum very quickly explodes. The AI needs to recognize that it should swap with the pikeman, and to do that when the AI is deciding what to do with units, it needs to consider all other nearby units. This very quickly gets unwieldy and slow. The problem isn't needing to make multiple passes which would still be linear, its needing to consider other units than just the unit you are moving which causes the problems.

It may be the case that previous civs had some awkward pathfinding, but that wasn't a problem inherent to the system(1UPT) it was a problem with the actual algorithm. I could easily write a good pathfinding algorithm for a Civ IV type game where its pretty easy to determine all the barriers, obstacles, and movement costs, I mean the only thing that's complicated there is deciding what to do about roads that will finish building by the time you get to them but aren't currently built (and handling that), you know what all the costs are, and where all the unpassable tiles are, modulo where enemy units will end up on future turns. But in Civ V, the AI has problems with pathfinding even within a single turn.

As for number of hexes, the problem is still a problem on huge maps, which aren't the most consistent in terms of stability and turn-length.

I also think that if you can make an X-units per tile system work, the optimal X is not going to be 1, in fact I'm partial to 9UPT with CTP like army battles. Far fewer collisions, no silly firing over the English Channel with ancient bows, the player can control more units, and move them more easily, you don't have to break anything significant to make 9UPT work (only allow 8UPT in cities that are currently building a unit and do normal end of turn production (rather than beginning of turn).

11. ### LordTCWarlord

Joined:
Nov 30, 2003
Messages:
241
Location:
Toronto
You've basically reduced the problem to identifying every single way in which the AI can screw up and give it custom instructions for each of them. If there is anything that comes up that you haven't anticipated the AI will either use really bad fast instructions, or will bog down horribly trying to work out what to do.

Yes for any specific problem you can give a specific solution, the problem is getting a general algorithm for all problem instances, that provides good solutions.

12. ### MkLhKing

Joined:
Jul 18, 2008
Messages:
903
Location:
Finland
Moving units to desired locations optimally is probably an extremely difficult problem.

If and when we don't need to do it optimally, it's an easy task. Just like a human can do it without much thinking - send each unit to its desired position, for those units that get blocked, try again.

It may be a difficult task to create a decent combat AI for a game like Civ5, but I don't think pathfinding is the core problem in it.

13. ### scratchthepitchKing

Joined:
Feb 13, 2010
Messages:
798
If creating an AI for a 1up game is well neigh impossible, as LordTC seems to be suggesting here, I wonder how SSI was able to do it with their Panzer General series, their Tanks game, their Steel Panthers series, their earlier land warfare games, such as War In The Pacific and their series of naval games, all of which came out during the 90's. Granted, AI isn't a strong point for SSI, but they did it, and they did it much better than Firaxis ever managed to do in their combat simulations. In Panzer General 3, SSI took it even further and used staged movement, where units got to move 2-3 times during their turn. The AI seemed able to do it OK, not great, but passable to the point where in the several games I tried of this version, the AI was down right annoying at times. In Civ, the only thing I found annoying about the AI was the constant cheesy cheating.

1up AI is not impossible and it's not impossible to do well enough that it becomes a challenge to a player. It's been done. It's been done even by developers who are not that great at AI programing. The problem with Civ5 was not 1up. It was trying to adapt the very limited 20 year old Civ AI to use it. Civ5 should have had a new AI program developed, but the suits would not give their approval, so the 20 year old dinosaur was forced into doing stuff it wasn't designed for and was way too primitive to accomplish.

Blaming 1up for Civ5 woes is stupid. That's like blaming Evolution for Creationism's short comings.

14. ### BlueTemplarPrince

Joined:
May 14, 2006
Messages:
392
So then, how the other 1UPT games do it? Wasn't Civ 1 1 UPT by the way?

15. ### Le SageEmperor

Joined:
Apr 24, 2009
Messages:
1,522
Location:
Digging up your garden
Sullla is spot-on. I stayed around at the beginning of Civilization 5 and I even modded it a little. But I am not playing it anymore, nor have I played more then three games through (not counting the ones with my own mod applied). It is a really bad game and I feel fooled on my hard-earned fifty euros. i haven't even tried out the patch we got around Christmas. Why ever would I do that when it doesn't fix any problems?

I will never trust Firaxis or 2K Games again and I will probably also be skeptic when I see the name "Sid Meier" pasted onto any game. Not that this is his fault though (this would probably have been a great game if he had been in charge), as he had only delegated the game design to others. I sure as taxes won't buy any game with "Jon Shafer" pasted on it.

I am not going to mod, play or support a game I do not like. I am not going to give it my energy and effort. I am modding and playing other stuff right now. Civilization 5 was the greatest debacle in this otherwise excellent series' history. It was a stressed release of an unfinished game. Thank God we get Elder Scrolls Skyrim instead later this autumn. Now there's something to look forward to.

16. ### HailSatan's minion

Joined:
Apr 25, 2009
Messages:
746
Gender:
Male
Location:
Mother Russia
A very simple way to remove a lot of the pathfinding problems with 1up is to allow civilians to stack and create a transport mode for the military units. in transport mode military units turn into civilians and gain +0/1/2 movement (like in PG when infantry turns into a truck and gains lots of movement points)

for every worker look at every tile in cultural borders: for every tile look at every improvement and...

secondly, considering there was(is) a bug, that the AI considers any tile it sees(e.g. vision > 0) to be in it's cultural borders

so yeah, Actually workers aren't so bad

pathfind talk below
Spoiler :

it is indeed true that in civ4 pathfinding is much simpler, than in civ5.

what i disagree with is combining war movements(what moves where and what attacks what) and pathfinding into one problem. they are different. war movements should be executed by some tactical layer AI, while pathfinding has nothing to do with the AI.

your first paragraph about big numbers(that i dropped it in the quote) views the pathfinding algorithm as a director that orchestrates all units' movement at the same time(the same turn that is) to ensure that all units reach their destinations so that the sum of unit movement times is a minimum. not only such goal cannot be reached in a timely fashion, but is prohibitive in a god-style game because not all units have equal value to the player.

pathfinding is concerned exclusively with units(one unit at a time) reaching their destinations. of course it should somehow note hexes that are(current turn)/will be(on the following turns) blocked. but more importantly the pathfinding algorithm must not move any other units.

for example let's imagine this 2 hex mountain chokepoint occupied by units A and B respectively. and suppose the player wants unit A to move to some tile in the area beyond unit B. what should happen? the pathfinder can move unit B out of the way and then advance unit A. but that would break "cannot move other units" rule. therefore the only sensible solution is to state that unit A's destination is unreachable(because of unit B) and let the player manually resolve this issue.

17. ### LordTCWarlord

Joined:
Nov 30, 2003
Messages:
241
Location:
Toronto
Dividing turns into phases makes the problem easier.
Fixing the maximum number of units on the map by a starting number of units makes it easier.
Not having units that have 5 moves in a single step makes it easier.
Playing a defender rather than an attacker also makes it easier.
Playing fixed scenarios with fixed objectives makes it easier.
(i)If the AI expects to be fighting on one front in this game, and without any peek ahead forewarning or planning it gets attacked from another flank it will collapse horribly from poor decisions.
(ii) The nature of the fixed unit composition and scenario objectives makes it easier to give the AI specific instructions that work. "You have these units, you aren't getting any new units, the enemy has these units, they aren't getting any new units, you need to accomplish X to win, they need to accomplish Y to win".

Other issues like the level of bonuses for formations can make errors less costly as well, I don't think any formation errors in those games were as punitive as say a 15% flanking bonus and a 15% discipline bonus (admittedly these can be/have been lowered).

I'm not suggesting its neigh impossible I'm suggesting that it is much harder to do well, and uses more resources like CPU time. And as for blaming 1UPT for Civ 5's problems it is nothing like blaming evolution for creationisms problems, evolution and creationism are not components of each other, 1UPT is a central component of Civ 5.

As for 20 year old AI, that's a complete absurdity, the AI has been rewritten with every version of the game, ask any civ IV modder about the AI in civ IV, it's written in a different language from the original civ I for starters.

18. ### LordTCWarlord

Joined:
Nov 30, 2003
Messages:
241
Location:
Toronto
It depends how badly you want to do it. If you're trying to do no worse than say spending 120% of the optimal amount of movement points all the time (5/4) then I think the problem is quite hard. If you don't care if you spend 150% of movement points I think you'll do fine.

I think the bigger issue is what happens if the tactical AI is guiding your units to end in positions with terrain bonuses, but the pathfinding AI screws up the timing to get there and as a result you leave units out in open terrain.

Also if you need pathfinding feedback to the tactical level of the AI, and choose to ignore unit order I think you'll do some pretty silly things at the tactical level as well.

Joined:
Aug 23, 2007
Messages:
2,520
You only have to evaluate each tile once, not per worker. Then you figure out which tiles are most important and which workers are closest, so should move there.
Not really difficult at all.

a bug should be fixed, it is not a reason to have a different approach. It also has minimal impact on the amount of effort needed for this evaluation.

agreed, they really aren't

20. ### André AlfenaarWarlord

Joined:
Oct 21, 2002
Messages:
274
A lot of Sulla's criticism is addressed in this patch. Maybe you should give it a try.

Sulla's criticism is obsolete for a lot of issues, which have been addressed in the latest patch. I wonder how Sulla thinks about CIV V after the patch.