AI “I have always tried to teach the AI the same successful strategies that I use in playing a...

Preview:

Citation preview

AI

“I have always tried to teach the AI the same successful strategies that I use in

playing a game”. – Brian Reynolds (Civilisation II & Alpha Centauri)

Source

• Rouse, R., (2005) Game Design, Theory and Practice (2nd ed.), Wordware Publishing Inc., Plano Tx USA, chapter 9.

Turing Test:

• Humans are provided with terminals

• They type sentences

• A machine provides responses on screen

• If humans believe that responses provided by human, the machine has passed the Turing test.

Depth of AI

• In games, AI tries to make the game fun

• Game’s AI may be completely random

• Game’s AI may be completely logical

• Bigger challenge to design behaviours and movement patterns

• E.g.: Tetris selects the next block at random.

Depth of AI

• Degree of AI depends on the game

• In RPG (role playing game) expect high level of AI

• In Sims, the AI is the game

• (NPC = non-playing character = AI driven)

Rules of AI

• AI must not do silly things

• High standard expected from “human” characters (the Uncanny Valley effect)

• Non-humans don’t need to be so clever

• Nevertheless, dumb behaviour destroys the game experience

Making AI Appear Human

• AI must be unpredictable

• Humans are unpredictable

• If game behaviour is predictable, the fun stops

• Players need surprise

• Surprise can be as simple as a random number generator

Making AI Appear Human

• Players attribute intelligence even if actions random, “What’s it trying to do?”

• Fuzzy logic: randomness weighted so as to make good strategies more likely

• Or small amount of randomness added into cold logic to add surprises

• Try not to let randomness get in the way of enemy strategy

Storytelling

• AI assists storytelling• Better to show than to tell• CAN show that citizens frightened in a cut-

scene• BETTER: program citizens to avoid the

player• Dynamic storytelling: NPC responds to

how you treat it – either helps you or opposes you.

Storytelling

• AI can create a living world

• There are NPCs which are part of the game

• Other NPCs simply set the scene – make the player feel less lonely.

The Sloped Playing Field

• Humans are usually smarter than AI

• Not realistic to give each a fair chance, so:

• There are more of them than us, They never need to reload, We have to shoot them while they only need to touch us

• Victory against insurmountable odds is far sweeter!

AI and the Environment

• Stupid NPCs sometimes get stuck in corners

• Need to match the design of the level to ability of NPC to navigate - compromise

• Levels and NPCs are usually designed by different teams, so it doesn’t always work first time

• If the NPC is on the player’s side, make very sure it won’t let her down.

Scripted Behaviour

• If there is something really tricky for an NPC to do (swing on a rope?) – script it.

• Don’t use too much scripting – it looks and is predictable

• Can switch between scripts, randomly or intelligently

• Common to script “human” guides who lead and advise at various points

• Guides tend to be big talkers!• If a guide leads, program the end-point but use

AI to decide the route

Policy and Programming

• Game itself is anthropocentric (revolves around human player

• NPC interacts with human player:

– Simple reactions (eg shoots back when shot at)

– General attitudes (behaviour depends on how treated)

– Complex intentions (agenda of own)

Where to put the intelligence

• The more restrictive the game world is, the more complex the NPCs need to be

• eg: If the game world allows NPCs to walk into a fire, we need to programme the NPC not to

• If the game world prevents anyone from walking into the fire, NPC programming becomes easier

Humanness and Stance

Humanness:• NPCs are limited in humanness – so multiplayer

games can look far more realistic• Even minor displays of emotion can make a

character look more human• Humans unconsciously try to read humanness

into character actions• If the game world is interesting to watch, it will

also be enjoyable to participate in

Humanness and Stance

Humanness:

• There are games which don’t have human players (eg: Sims, Singles)

• Humans remain as non-participating observers

• Enthusiastic watchers: parents and coaches watching protégés and own children

Humanness and Stance

• Stance:–Enemy

–Ally

–Observer

Humanness and Stance

• Stance: Enemy

• Traditionally NPC is an enemy

• Must show intelligent or at least purposeful behaviour

• Illusion that NPC is at same level as the human player

Humanness and Stance

• Stance: ally

• Reconnaisance officer must provide data in a visually accessible format

• Human players require consistency, even at the expense of complete data.

• NPC allies can even take on tasks for player

Humanness and Stance

• Stance: neutral• NPC is observer (camera operator,

commentator)• NPC is referee (football)• Can simply be part of the story• An extra• There to provide atmosphere• Assist immersion

The MVC Model

Model - View - Controller

The Role of the Computer

• Coordinating the game process (eg realising a participant’s move in a chess game according to the rules

• Illustrating the suituation ( e.g. displaying the chessboard and pieces on the screen)

• Participating as a fellow player

The MVC Model

• Developed by the Smalltalk community and adopted by the object-oriented world.– The underlying application domain

(Model)– The way the scene is presented to the

viewer (View)– The way the user interacts with the

game (Controller)• These should be kept separate.

Model

• Includes software components that do coordination: evaluate rules, uphold game state

• Rules and basic entity information (eg gravity and other physical laws) form the core structures

Model

Core structures need not cover all rules as they may be instantiated:

• Core structures cover basic mechanism and properties of eg playing cards

• Instance data provides additional structures needed for game (eg ranking of hands, stake handling, resolving ties)

View Section

• Handles the presentation of the game state to human and synthetic playeers

• Rendered view goes to output device for human players. Sometimes customisable. Includes audio. Can include sensory feedback (rumble)

• Synthetic view goes to synthetic (AI) player. Has coordinates and mathematical data - more useful than rendered form.

Controller

• Controller allows human and synthetic players to input moves into the game

• Controller can exclude illegal moves suggested by the player

• usually human input enters controller through an input device and driver software.

• Configuration component initialises the game.

Extensions of MVC model

• Diagram only shows one player and one AI synthetic player. There may be many

• The model may be distributed over many computers

Directed study:

• Download Doom95 and play it

• Note especially the behaviour of the monsters

• What do they do when they aren’t engaged?

• When do they engage with you

• What do they do while engaged?

• Do they help each other?