Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

AI, to cheat or not to cheat?

Discussion in 'Scripting' started by Foxxis, Sep 18, 2007.

  1. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    I'm not sure where to stick this topic, so please move it if this is the wrong place.

    I have an ethical question. Is it OK for game AI to cheat and use more information than what's available to the player? I generally answer "no", but what if:

    - the player can be expected to still make better informed decisions
    - the cheating will be impossible to detect and will lead to more intelligent AI behaviour.

    My problem is that I'm stuck with the worst AI problem I know of. I have created an AI that must deal with tactical decisions involving lots of guess work, ie. the information leading to the decision is quite fuzzy. So, I expect the players to always be able to make better informed decisions since it's the kind of decisions where we still beat even excellent AI algorithms.

    By cheating (in this case, allowing the AI to change it's decision more often than the players can), it would probably be a more formidable (and interesting) opponent.

    I'd be thankful for any insight, especially if it's from real world experience along the lines of "I did that, and my players hated me for it". ;)
     
  2. aaronsullivan

    aaronsullivan

    Joined:
    Nov 10, 2005
    Posts:
    986
    2 cents: It's okay for the AI to cheat as long as the player doesn't feel cheated. :)
     
  3. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    When designing AI I try to think in terms of what the player sees and hears, not what is actually going on. For most things letting the AI cheat, have ESP, teleport and other things is just another important part of getting it to look good.

    The gunship in avert fate cheats vigorously and works great. Cheating adds to the effect that the player precives.

    So in your case as long as you aren't doing a hide and seek or tag game where predicting the AI's behavior is part of the gameplay, go ahead.
     
  4. aaronsullivan

    aaronsullivan

    Joined:
    Nov 10, 2005
    Posts:
    986
    dfvdan, how about some specifics? Works well for issues like this.
     
  5. Willem

    Willem

    Joined:
    Mar 9, 2007
    Posts:
    184
    Yeah, AI can cheat - the trick is to make it appear like it isn't. :)
     
  6. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,777
    Agreed with the others: they can cheat, as long as the player has no idea they're cheating.
     
  7. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    All computer opponents I've seen in every game cheat because they're not processing the video and audio as the player would see it. :) Just the fact that the computer opponents can by nature exactly know the game state makes them cheating. So then in most cases you artificially limit what the computer opponents *can* see as far as game information, and that's cheating the computer in its own right.

    So, there's always cheating, just roll with it. :)

    Cheers,
    -Jon
     
  8. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    It will depend on the exact nature of your tactics, of course, but a Bayesian network is good for modelling the AI's belief about what is going on based on evidence available in the game world. And a neural network can often be used to model fuzzy deductions that a human would make but which are difficult to express algorithmically. I can't say much about Bayesian implementations, but I have got serviceable neural networks going with only about 300 lines of code (and I am not exactly what you would call an expert on the subject).

    A game that cheats is often acceptable, but a game that achieves the same effect without cheating could be really fascinating...
     
  9. Brian-Kehrer

    Brian-Kehrer

    Joined:
    Nov 7, 2006
    Posts:
    411
    I think non-cheating AI is very interesting... I understand the appeal.

    However do consider that very simple human behavior, such as determining if I heard something, line of sight, avoidance all requires code that will slow down your game.

    Think of it this way if 'cheating' can reduce the amount of code necessary, you can spend those spare processor cycles on something else, that possibly adds interactivity and game play.

    In fact I might go so far as to say given hardware limitations, cheating AI might feel more real than fair AI.

    I wholeheartedly agree with the previous statement:
    "the trick is to make it appear like it isn't"

    But hey, experiment! If you make a self sustaining AI, it might be awesome.
     
  10. Bampf

    Bampf

    Joined:
    Oct 21, 2005
    Posts:
    369
    Minor point: the need to have a cheating AI look like it's not cheating is game specific. In a game like an RTS, the goal is for the AI to look like a human player, playing the game with the same inputs as the actual human. In a game like Diablo, the goal is for individual monsters to behave in a believable way, and not all charge at the player from a mile away.

    But of course one could have a game where it is perfectly reasonable for the AI to look like it's cheating. If the AI is representing someone much more omniscient than the player for instance.

    So it depends on the game. Rather than always hide it, you can incorporate the cheating into the game sometimes. Perhaps there is a security camera system that let's the computer "cheat" by seeing everything. (Maybe the player could even destroy it to make the AI behave stupidly?)

    Also keep in mind that players will often attribute advanced intelligence to random or simplistic behavior.

    Simple example, an old game called The Colony. Most of the units attacked you when you entered a room (presumably accomplished through scripting or basic line-of-sight calculations.) There was one enemy though that could not be killed, and it v-e-r-y slowly followed the exact same path as the player was taking through the level, until it got close enough and then it would speed over to you.

    Now the AI for that unit was dirt simple. But it was very effective, put me in mind of a sniffer dog on my trail. It kept me me looking over my shoulder, and if I spent too long exploring I'd turn around and AAAH IT'S HERE RUN RUN RUN!

    One more thing to keep in mind. I recall in Spaceward Ho, at the highest level of difficulty the computer knew where your homeworld was. It was blatantly cheating, but experts at the game needed that extra challenge so it was acceptable. If all difficulty levels had been that blatant, players would have felt cheated (and beginners wouldn't have been able to learn the strategy by watching the AI.)

    Moral: players will sometimes knowingly accept some level of cheating. But equally, they will take advantage of scripted or predictable behaviors to "break" the game. Consider the practice in Diablo or skirting a group of monsters, attracting a couple off to kill while the rest just stupidly sit there, ignoring their diminishing ranks.

    So I would say goal one is to give the player a good time. A secondary goal is to maintain a realistic consistency so as not to reward illogical behavior by the players.