The Fair Patch

copx

Chieftain
Joined
Dec 20, 2008
Messages
62
About

The "Fair Patch" is a tiny modmod for FfH which introduces a new difficulty level: "Fair".
"Fair" is like "Noble" except with less AI cheating.

Why? Because I really don't like AI cheating for some reason and I know that others feel the same, so..

Detailed log of changes (compared to "Noble"):

- Removed AI unit supply discount (was 50%)
- Removed AI unit upgrade discount (was 75%)
- Removed AI construction discount (was 15%)
- Removed AI inflation reduction (was 50%)
- Removed AI war weariness reduction (was 30%)
- Removed AI advanced start point bonus
- Removed AI initial city production bonus (was 10 hammers)
- Removed AI anti-human attitude modifier (was -1)

Issues and Future

This is my first CIV modding attempt so it is well possible that I got something wrong. Please test and report any bugs you encounter.

The "initial city production bonus" does not depend on difficulty but is a global effect i.e. my patch actually has a minor effect at all difficulty levels which is something I tried to avoid. I guess it is possible to work around this by adding some Python code which is triggered each time the AI founds a city and then removes this bonus if and only if the current difficulty level is "Fair". However, I have no experience with the CIV code base yet, so I chose the easy road. I might fix this in future.

Right now "Fair" replaces the difficulty level "Settler" (I assume nobody who installs modmods still plays on "Settler") because I have not found a way to make more room on the choose difficulty screen of "Play Now".

I have NOT removed the AI's bonus vs. barbarians because the AI is just too weak. Despite the bonus AI civs occasionally get killed by the barbarians, and I do not really want to see the death rate increase in that area. Once the AI has been improved I will probably remove this bonus too.

Oh, and I was kinda lazy with the installer. It does not feature an "uninstall" option. This is another thing I might fix in future.

Compatibility

Base game: Fall from Heaven II 0.40h

Non-conflicting modmods: FlavourMod

Download

Patch attached. It is an installer stuffed into a .zip archive to get around the upload restrictions here i.e. 1. extract archive. 2. run installer
Note that you need to modify the "Destination folder" if your CIV folder is not in its default location.
 

Attachments

This is a nice idea, but Noble is too easy already WITH the AI cheating, so maybe you should mod a higher difficulty setting (Prince for example, or even Monarch).
 
This is a nice idea, but Noble is too easy already WITH the AI cheating,

Depends on your skill level / play style, you know. In FfH I "roleplay" my civ most of the time instead of minmaxing / aiming for victory by all means necessary. I also tend to play peaceful builders most of the time, and as everyone knows the AI's primary weakness is warfare.
But yeah, it is a little too easy even for me, I certainly hope the FfH team will give the AI a serious boost in future.

so maybe you should mod a higher difficulty setting (Prince for example, or even Monarch).

Unfortunately, in CIV "higher difficulty" mostly means more AI cheating. The AI sucks so hard that this is basically the only way to make the game challenging for a human player who exploits all means available to win.

There are few non-cheaty things which change at higher levels:

- More barbarians

... would actually hurt the AI way more than the player. In fact, the current AI probably won't be able to survive the barbarian hordes on the higher levels without all the insane bonuses it usually gets at those levels.

- Less good stuff from tribal villages.

Mostly irrelevant if you ask me.

- Higher upkeep/maintenance costs

Assuming the AI actually has to pay the same increased costs this change is "neutral" at best. However, increased unit costs would hurt the current AI more than the player, because humans are way better at making most out of a limited number of units.

----

The FfH team has announced they are still working on the AI, so there is at least some hope that it will be more interesting to play against on equal grounds in future. I will probably mod in a "Fair but mean" difficulty (barbs like on higher levels but still no AI bonuses) as soon as the AI is capable of actually handling itself.
 
There are only really 3 approaches to variable difficulty AI.

1 - Design the AI purposefully to avoid paying attention to as many details at lower difficulty: This means the Human is actually cheating because you are blinding the AI.

2 - Design the AI to have a random "flux" at the end of various Value Judgements, meaning that it assigns numerical values to all possible courses of action, then rolls a random and adds/subtracts it to each of the values. The lower the difficulty, the larger the random range, thus allowing abysmal choices to be made on occasion.

3 - Design the game to treat the AI different than it treats the Human (AI cheats)



Either way you go about it, the only approach to a variable difficulty is to have SOMEONE cheating. Either you are blinding the Computer, letting the Computer have extra information, or you are letting the Human or AI directly cheat.

There are a few places in the code where approach #2 is used, but it isn't linked to difficulty in those locations, it is instead based off LeaderHead information to provide "Flavor decisions" or it is a simple random shift with no controls linked to prevent repetition (selection of promotions is one of these locations, 15 point random shift at the end of deciding how valuable the promotion is)
 
Either way you go about it, the only approach to a variable difficulty is to have SOMEONE cheating. Either you are blinding the Computer

What you call "blinding the computer" is not cheating. Cheating in the traditional sense means not playing by the rules, and that's exactly what the AI does right now. You would only "blind" the computer if the AI had only limited access to information to which the human players havs full access. Simply having an AI which is not "smart" enough to process the available information into the optimal action doesn't add up to any common definition of "blinding".

I like difficulty levels who actual make the AI play better/worse. That is perfectly possible, every computer chess program works like that for example. There is even a Civ clone where the AI plays fair: c-evo.org

The only reason why difficulty levels usually aren't implemented like that is that it's insanely hard. A CIV AI good enough to beat the best players would probably be more complex than the game itself..
 
The computer can only see what you tell it to see. It is impossible for the computer to say "My opponent can only build Warriors right now, so I will promote everyone with Shock" unless you tell the computer to CHECK if the opponent is only able to build warriors right now. Failing to tell it such a thing places it beneath the level of a player, and does "blind" it in a very traditional sense of the word.


Another area where the AI is blind right now is the Barbarians attacking cities. People have learned that if you block chokepoints, the Barbarians turn away. This is because they have been instructed to find the city which they can move to the quickest. You make it impossible to move directly to a city and they no longer acknowledge that it even exists.


Most computer chess programs work based on Number 1 in my list, a few utilize number 2 as well to make more variational difficulty levels. Number 1 is applied by having lower difficulty levels only plan for the optimal CURRENT move, and higher levels plan for the optimal move considering the next 5 or more possible moves. Once every possible move has been given a value, then number 2 could be applied by having the computer chose randomly from the top 3 or 4 move options.


Writing an AI that can beat EVERY human is pathetically simple. You have every rule about the game in front of you, you can analyze them and decide what is the best possible path and program the computer to do that every time. A flawless opponent is boring though, an opponent which is not predictable and which makes mistakes sometimes keeps people coming back.
 
The computer can only see what you tell it to see. It is impossible for the computer to say "My opponent can only build Warriors right now, so I will promote everyone with Shock" unless you tell the computer to CHECK if the opponent is only able to build warriors right now. Failing to tell it such a thing places it beneath the level of a player, and does "blind" it in a very traditional sense of the word.

No it doesn't, but I am not interested in pointlessly arguing about semantics here. So let's just say I disagree.

Another area where the AI is blind right now is the Barbarians attacking cities. People have learned that if you block chokepoints, the Barbarians turn away.

Well, whether you call it "blind" or "dumb" (a word I would prefer) it is certainly an area that needs fixing. I have seen the AI has serious trouble with pillagers, too. Most human players realize that you should kill the barbs BEFORE they get close enough to destroy your improvements. The AI often just hides behind the city walls while the barbs wreak its land.

Writing an AI that can beat EVERY human is pathetically simple. You have every rule about the game in front of you, you can analyze them and decide what is the best possible path and program the computer to do that every time.

That is only true for very simple games. You do not really think that writing a CIV AI which "can beat EVERY human" is "pathetically simple", right? Because that is what I was talking about here when I said "insanely hard".
 
Writing an AI that can beat EVERY human is pathetically simple. You have every rule about the game in front of you, you can analyze them and decide what is the best possible path and program the computer to do that every time. A flawless opponent is boring though, an opponent which is not predictable and which makes mistakes sometimes keeps people coming back.

That is only true for very simple games. You do not really think that writing a CIV AI which "can beat EVERY human" is "pathetically simple", right? Because that is what I was talking about here when I said "insanely hard".

Oddly enough - both viewpoints are right, kinda.

Civ uses a fairly advanced form of emergent AI. The AI players are effectively agents that can see certain details of the world around them and work from given triggers to make decisions.

IF atWar THEN buildSomeMoreUnits etc.

It also has a sense of strategy however, which is not strictly an emergent feature. It can decide that sometime in the future, it's going to want to declare war. If that's the case, it will prepare for a while and then move units before actually declaring war.

===

The system that Xienwolf was talking about is an entirely different form of AI known as an Expert System. Chess programs use this form of AI as the rules are very well defined and people have studied the strength of various strategies.

If the same information was available for Civ in a tidy form (clear collection of rules and strengths) then it would be possible to write an expert system for the game. It would be able to look forward several turns and try to predict the actions of it's opponents, then find the ideal solution to their ideal moves. As it recalculates that every turn, it becomes harder for humans to defeat unless they act in ways that the computer finds hard to predict (masking true intentions behind more obvious moves etc).

As there is a random element to the game, the expert system will never be a strong as a chess program - the only random element in chess is the opponent.

====

The main thing that makes an expert system impractical for Civ however is the sheer complexity. With so many options over such a large number of turns, looking ahead for a single choice could take minutes. Given a few million permutations of choices per turn across a playfield which changes per game (which ironically is a strength of Civ and gives it such a great replay value) would lead to an expert system having to play sub-optimally, but still incredibly slowly. The analysis part for any given choice is relatively straightforward (as Xienwolf said), but effectively impossible for any given situation due to the time it takes (as copx said).

====

Looking at it from a different point of view - I don't much care if the AI has certain bonuses. I chose to have a harder game, because an easy game didn't interest me as much. I know full well that the AI start stronger and builds faster - which just makes it more satisfying when you can overcome it.

To be honest though, recent changes in FF have made me drop back a difficulty level and I'm still struggling more than I should. The only change there was to make sure the AI values city defense more and strives to keep additional forces present per city. Small tweak to the decision making resulted in much better emergent behaviour - it made a big difference. The AI also rarely dies to the Barbarians anymore (which is what we were aiming for).

====

(Disclaimer: It has been 5 years since I did my dissertation [Emergent AI in Complex Game Environments - in that case it was actually an agent which played Nethack] so I may be a little rusty on terminology and more current thinking)
 
My main issue with the AI is that it does not seem to be aiming to win. Its only wish is to kill me.
 
My main issue with the AI is that it does not seem to be aiming to win. Its only wish is to kill me.

I've encountered plenty of human players like that.

Though maybe I just bring out homicidal/suicidal impulses in people.
 
My main issue with the AI is that it does not seem to be aiming to win. Its only wish is to kill me.

Maybe we should make it a winning option then. Hand out objectives like kill all Elves to win the game or something similar. :)

Especially if playing against humans you can very frequently see old grudges gain the upper hand over everything else. I've seen people starting wars at the start of a new game, because of unfortunate events, that happened in the game before. :)
 
Back
Top Bottom