1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

How does the AI cheat (Fog Of War - anything else?)

Discussion in 'Civ4 - General Discussions' started by Ondskan, Jun 20, 2012.

  1. Ondskan

    Ondskan Emperor

    Joined:
    Dec 31, 2007
    Messages:
    1,133
    Hello


    I'm currently playing a mod called Realism Invictus but I have noticed similiar behavior in the past. What I have is near proof of the AI seeing through the fog of war.

    Several times, using ships, I've spotted enemies and then purpously saved, moved, goten attacked, reloaded, moved differently, goten attacked and so forth.

    I wonder if PERHAPS the AI "one" and see's what ever all the computer "AI's" see but even this couldn't explain some of the events.

    I am playing mostly on Monarch/Emperor levels. What experience of the AI cheating do you have? I've been googling around alot but due to search engine optimization, it's seclussion of short words like "AI" and many other issues it's not very easy to find accurate information on google anymore.

    So let's start a discussion!

    Also please list what level you play on so that we can determine if it's a difficulty thing.


    Also this has goten me thinking. In the game I am playing now I am REALLY trying to to reload each time I loose something crucial. But events like this make me think twice about hat yoat.Isn't it wrong that the AI can cheat but you shouldn't?
     
  2. God-Emperor

    God-Emperor Deity

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    It's been mentioned before...

    The visibility issue has a cheat done for the AI because doing it right is harder. As it is, the AI has no memory of where units were on the previous turn and it can not see the animations that show enemy units moving around. Therefore its ability to figure out where a unit went, which it saw last turn (but does not really remember where) and can not see this turn, is exactly 0. The AI's unit may be set to intercept (or whatever it calls it) your unit but has no real idea of where your unit was last turn or what direction it went. To help overcome this issue the AI controlled units can see as far as they can move, or something like that (it might be as far as they can move + as far as they can see, or it might actually be twice as far as they can move; I don't remember). Due to the large distances ships can move, especially the late game ships, this is more of an issue for them than it is for most land units (helicopter gunships are obviously the best land unit for them in this respect - you won't be evading them easily either). As far as I know, this is only for units to help them like this and does not actually reveal the map in those larger areas that the units can see via the cheat so while a naval unit may technically see that there is a nice island off in some direction via this cheat, unless the unit moves to within normal visual distance those plots are not revealed on the AI's map for other purposes (like "I should settle over there") and won't show up as revealed if you buy their map either. Unlike the human player, the AI can use information for one purpose and be completely unaware of it for other purposes.

    It is not particularly wrong if the AI cheats a little to help overcome its limitations, although not having a list of how it does so may be a bit irritating. The difficulty levels are done by "cheats": low difficulty levels give the human player bonuses (or "cheats", if you prefer), high difficulty levels give the AI bonuses.

    The AI does always get half cost upgrades on every difficulty level, although this is just another value set by the difficulty level XML they chose to have it set to 50% for all of them.
     
  3. Ondskan

    Ondskan Emperor

    Joined:
    Dec 31, 2007
    Messages:
    1,133
    I am under the impression that they denied these cheats at the start of the sale of the game?
    Is this true?

    Obviously if the AI lacks the capacity to remember anything it should cheat but that's an other problem; that it lacks the capacity to remember.

    Although I have noticed some weird things.
    Despite having the setting that the seed should be the same, sometimes when I reload a game the AI diplomacy will react differently to me: Even on the same turn, EVEN without moving anything. It's quite striking really.

    Maybe I am just imagining things...
     
  4. Te_Wheki

    Te_Wheki Chieftain

    Joined:
    Jun 14, 2012
    Messages:
    52
    I've noticed when I set a unit to explore at the start I get a lot more goodie huts than usual.
     
  5. Ondskan

    Ondskan Emperor

    Joined:
    Dec 31, 2007
    Messages:
    1,133
    What you mean that the AI finds them better than you?


    Or that the Ai "finds" them better than you?
     
  6. Te_Wheki

    Te_Wheki Chieftain

    Joined:
    Jun 14, 2012
    Messages:
    52
    Impossible to say really without trillions of tests and I enjoy early exploration too much to always defer to the AI, probably a bit of both.
     
  7. Manco Capac

    Manco Capac Friday,13 June,I Collapse

    Joined:
    Mar 1, 2010
    Messages:
    8,051
    This is quite an interesting assumption. :sad:
     
  8. r_rolo1

    r_rolo1 King of myself

    Joined:
    May 19, 2006
    Messages:
    13,818
    Location:
    Lisbon, Portugal
    Given that the auto explore routine is basically " let's push randomly into the black void", he is basically saying that his search pattern is worse that a weighted random walk :/
     
  9. karadoc

    karadoc AI programmer

    Joined:
    Oct 3, 2005
    Messages:
    1,568
    Location:
    Australia
    Well, all of the AI is exposed for scrutiny in the dll source code; so in that sense we don't really need to speculate and guess about whether or not the AI can cheat in any given circumstance - all we have to do is check to code.

    ... unfortunately, the code is large and bloated and not really easy to follow a lot of the time. But I've spent a fair bit of time messing around with the AI, so I already know a few things about it.

    I can tell you this: it doesn't not cheat to find goody huts. The function responsible for seeking out goody huts is called CvUntiAI::AI_goody; and if you look at the code for this function, you'll see that it checks "isRevealedGoody", and if you look at the code for that you'll see that it does what its name implies: ie. it checks whether the AI has actually seen a goody hut at a particular plot. So there is apparently no cheating involved in the search for good huts.

    In general, the biggest way the AI cheats is that it always knows the position of any unit in range to be attacked. For units with just 1 movement point, this doesn't make any difference, because they can see that far anyway, but for units with a bunch of movement points this can be a pretty significant cheat. For example, you can't really sneak boats past the AI's defences, because even if you take special care to only move in the AI's fog, the AI will still find you if they happen to have any of their own boats nearby.

    (So far, this particular form of cheating has not been removed in K-Mod; but several other AI cheats have been removed. For example, K-Mod stops the AI from automatically knowing the locations of all enemy cities; and it stops the AI from evaluating potential city sites in areas that have not been explored; and stuff like that.)

    Difficulty level has no effect on how much the AI cheats. The effect of difficulty levels is completely specified in the xml; mostly in CIV4HandicapInfo.xml.
     
  10. Manco Capac

    Manco Capac Friday,13 June,I Collapse

    Joined:
    Mar 1, 2010
    Messages:
    8,051
    I love your posts, Karadoc!
    Especially if you dive into code stuff.
     
  11. Lemon Merchant

    Lemon Merchant Hall Monitor Super Moderator

    Joined:
    Jun 27, 2008
    Messages:
    8,638
    Gender:
    Female
    Location:
    Red Sector A
    Yes. I get the vapors from it, too. Very informative. ;)
     
  12. karadoc

    karadoc AI programmer

    Joined:
    Oct 3, 2005
    Messages:
    1,568
    Location:
    Australia
    I'm glad to be appreciated such. :) Thanks, you two.
    but now I feel kind of bad for now having anything interesting to say...

    Hey, here's something unrelated to AI which you may or may not know:
    If you're exploring the ocean looking for land, you can actually trick the game into telling you were the land is without exploring... Just press 'g' (to activate go-to mode with your boat), and then point somewhere way out into the fog of war. If the path through the fog is straight, then there probably is no land there. If the path wiggles around, then there is land. This is because although you can't actually see what's there, the pathfinder tries to put the path onto tiles which have a defense bonus, such as forest, hills, and coast. So if there's nothing but ocean, then the path will be straight, but if there is some variation in the terrain then the path will move around. (This exploit trick thing has been removed in K-Mod.)
     
  13. TheMulattoMaker

    TheMulattoMaker Dictator of RF

    Joined:
    May 28, 2008
    Messages:
    1,483
    Location:
    Far-GO!
    Apparently you can also use it to show you the shape of unexplored continents.
     
  14. Manco Capac

    Manco Capac Friday,13 June,I Collapse

    Joined:
    Mar 1, 2010
    Messages:
    8,051
    karadoc, you shouldn't have. You are going to make me even more abusive. In XOTM competitions, knowing where the landmasses are even before exploring them surely helps on many stages. Earlier tech trades and conquests/domination.
     
  15. Ondskan

    Ondskan Emperor

    Joined:
    Dec 31, 2007
    Messages:
    1,133
    I can show you a save that shows that the AI knows where I am more than 1 move ahead.
    At least I think I can.
     

Share This Page