슬라이드 1
Upcoming SlideShare
Loading in...5
×
 

슬라이드 1

on

  • 406 views

 

Statistics

Views

Total Views
406
Views on SlideShare
406
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

슬라이드 1 슬라이드 1 Presentation Transcript

  • GA를 활용한 게임 에이전트 동작-CIG Competition PacMan-
    YonseiUniv Soft Computing Lab
  • 1/34
    NOT YOUR FAULT!
  • 2/34
    다음 중 GA 를 사용하여 풀기에 적합한 문제는?
    7차 방정식
    사용자 상태 추론
    게임에서의 최적화 경로 찾기
    하드웨어 설계
    게임 전략 생성
  • 3/34
    1. 탐색범위가 넓은 문제!
    2. 반드시 제일 좋은 해를 구할 필요가 없는 문제!
  • 4/34
    DO YOU BELIEVE IN GA?
  • 동기
    5/34
    실제 동물은 물리 환경에서 최적화된 움직임을 하고 있을까?
  • 문제 설계
    6/34
  • 문제 설계(유전자)
    7/34
    Time(1.5 sec)
    Angular motor를 이용 각 관절의 각속도를 제어한다.
    Motor의 속도는 5단계(-2, -1, 0, 1, 2 )로 구성되어있다. 여기서 (-)값은 음의 방향의 각속도를 말한다.
    Joint Degree(38)
  • 유전자 평가
    8/34
    0
    1
    1
    0
    1
    1
    1
    0
    0
    0
    0
    1
    0
    0
    0
    1
    0
    0
    1
    1
    64
    361
    169
    576
    얼마나 전진했는가?
    적합도
    염색체
  • 실험결과
    9/34
  • 확인
    10/34
    동영상!
  • 확인
    11/34
    이런 모양도!
  • CIG
    IEEE Symposium on Computational Intelligence and Games
    Tutorial
    Session Presentation
    Competition
    http://www.ieee-cig.org/competitions/
    Competitions Chair: Simon M. Lucas
    12/34
  • CIG Competition
    13/34
  • Unreal Tournament
    Sponsored by 2K Australia
    The competition task is to create a computer game bot
    Indistinguishable from a human player
    major prize of A$7,000 cash
    Trip to 2K Australia's studio
    DeathMatch game type for the FPS
    Chatting will be disabled.
    Some aspects of the game play will be modified in a way not known to competitors.
    14/34
  • TORCS
    Car Racing
    Daniele Loiacono, Julian Togelius and Pier Luca Lanzi
    Learn (or otherwise develop) a controller
    The distance raced in a fixed amount of time
    Best few controllers will race against each other
    Mac OS X, Windows and Linux, using Java and C++
    Neural networks, Fuzzy logic, Force fields, Expression trees
    15/34
  • Ms Pac-Man
    Non-deterministic game
    The world record for a human player currently stands at 921,360
    Can anyone develop a software agent to beat that?
    the best software controller for the game of Ms Pac-Man
    Screen-capture to get the current state of the game
    16/34
  • AI for CS different than AI for Games
    17/34
    • Must be smart, but purposely flawed
    • Loose in a fun, challenging way
    • No unintended weaknesses
    • No “golden path” to defeat
    • Must not look dumb
    • Must perform in real time (CPU)
    • Configurable by designers
    • Not hard coded by programmer
    • “Amount” and type of AI for game can vary
    • RTS needs global strategy, FPS needs modeling of individual units at “footstep” level
    • RTS most demanding: 3 full-time AI programmers
    • Puzzle, street fighting: 1 part-time AI programmer
  • Goals
    Games are entertainment
    Important that things behave naturally
    Not necessarily perfect
    “things’ are not always creature
    Follow(the game’s) natural laws
    And avoid cheating
    Characters should be aware
    18/34
  • Game Agents
    19/34
    Act
    Sense
    Think
    • Most AI focuses around game agent
    • think of agent as NPC, enemy, ally or neutral
    • Loops through: sense-think-act cycle
    • Acting is event specific, so talk about sense and think first, then a bit on act
  • Game Agents – Sensing (1 of 2)
    Gather current world state: barriers, opponents, objects, …
    Needs limitations: avoid “cheating” by looking at game data
    Typically, same constraints as player (vision, hearing range, etc.)
    Vision
    Can be quite complicated (CPU intensive) to test visibility (ie- if only part of an object visible)
    Compute vector to each object
    Check magnitude (ie- is it too far away?)
    Check angle (dot product) (ie- within 120° viewing angle?)
    Check if obscured. Most expensive, so do last.
  • Game Agents – Sensing (2 of 2)
    • Hearing
    • Ex- tip-toe past, enemy doesn’t hear, but if run past, enemy hears (stealth games, like Thief)
    • Implement as event-driven
    • When player performs action, notify agents within range
    • Rather than sound reflection (complicated) usually distance within bounded area
    • Can enhance with listen attributes by agent (if agent is “keen eared” or paying attention)
    • Communication
    • Model sensing data from other agents
    • Can be instant (ie- connected by radio)
    • Or via hearing (ie- shout)
    • Reaction times
    • Sensing may take some time (ie- don’t have agent react to alarm instantly, seems unrealistic)
    • Build in delay. Implement with simple timer.
  • Game Agents – Thinking (1 of 3)
    Evaluate information and make decision
    As simple or elaborate as required
    Generally, two ways:
    Pre-coded expert knowledge
    Typically hand-crafted “if-then” rules + “randomness” to make unpredictable
    Search algorithm for best (optimal) solution
    Ex- MinMax
    22/34
  • Game Agents – Thinking (2 of 3)
    23/34
    • Expert Knowledge
    • Finite State Machines, decision trees, … (FSM most popular, details next)
    • Appealing since simple, natural, embodies common sense and knowledge of domain
    • Ex: See enemy weaker than you?  Attack. See enemy stronger?  Go get help
    • Trouble is, often does not scale
    • Complex situations have many factors
    • Add more rules, becomes brittle
    • Still, often quite adequate for many AI tasks
    • Many agents have quite narrow domain, so doesn’t matter
  • Game Agents – Thinking (3 of 3)
    24/34
    • Search
    • Look ahead and see what move to do next
    • Ex: piece on game board (MinMax), pathfinding (A*)
    • Works well with known information (ie- can see obstacles, pieces on board)
    • Machine learning
    • Evaluate past actions, use for future action
    • Techniques show promise, but typically too slow
  • Game Agents – Acting (1 of 2)
    25/34
    • Learning and Remembering
    • May not be important in many games where agent short-lived (ie- enemy drone)
    • But if alive for 30+ seconds, can be helpful
    • ie- player attacks from right, so shield right
    • Implementation - too avoid too much information, can have fade from memory (by time or by queue that becomes full)
  • Game Agents – Acting (2 of 2)
    26/34
    • Making agents stupid
    • Many cases, easy to make agents dominate
    • Ex: FPS bot always makes head-shot
    • Dumb down by giving “human” conditions, longer reaction times, make unnecessarily vulnerable, have make mistakes
    • Agent cheating
    • Ideally, don’t have unfair advantage (such as more attributes or more knowledge)
    • But sometimes might “cheat” to make a challenge
    • Remember, that’s the goal, AI lose in challenging way
    • Best to let player know
  • Game Agents – AI
    Deterministic AI
    Preplanned, predictable events
    Set by rules
    Walk forward ten steps then backwards
    If player is within 5 squares move closer
    Go to town … take the shortest path using shortest path algorithm
    Attack player with least health/most damage potential/etc
    Non deterministic AI
    Unpredictable movement
    Random selection of directions
    React to environment to learn movement
    Player nearby, go slower
    Got shot going around corner last time, then take a wider path this time
    27/34
  • Base Environment
    http://cswww.essex.ac.uk/staff/sml/pacman/PacManContest.html
    Java
    Image Detector, Simulator, Game
    http://sclab.yonsei.ac.kr/courses/09AgentGame/Reference_Code.zip
  • 문제 설계
    29/34
    Sensing
    Thinking
    Acting
    IF then
    IF then
    If then
    .
    .
    .
    If then




  • 문제 설계
    30/34
    1. 죽지 말자
    2. 제일 가까운 고스트를 피하자
    3. 고스트는 나를 기준으로 어디에 있는가?
    4. 고스트의 반대방향으로!
  • 문제 설계
    31/34
    팩맨의 움직임
    고스트의 위치








    좌상
    우상
    좌하
    우하
    탐색범위?
    256
  • 문제 설계
    32/34
    Evaluating!
    문제를 잘 이해하는 게 관건!
    많이 해보자!
  • 문제 설계
    33/34
    Expert Rule Based System(High Priority)
    GA Rule(Middle Priority)
    Expert Rule Based System(Low Priority)
  • 정리
    34/34
    1. GA 활용예
    2. CIG Competition 소개
    3. 게임의 범용 AI 설계법 소개
    4. Pac_manAI 코드 소개
    5. Pac_manAI를 위한 GA 기초설계