Lecture 4 1 Minor Games Programming. Artificial Intelligence for Games Today’s Theory & Demo’s:  Previous Practice A* (A Real Good Algorithm)  Scripting.

Slides:



Advertisements
Similar presentations
Welcome to. Who am I? A better way to code Design Patterns ???  What are design patterns?  How many are there?  How do I use them?  When do I use.
Advertisements

Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
The Assembly Language Level
Lecture Roger Sutton 21: Revision 1.
Uninformed Search Jim Little UBC CS 322 – Search 2 September 12, 2014
Technical BI Project Lifecycle
Microsoft Word 2003 Tutorial 2 – Editing and Formatting a Document.
1 Algorithms & Data Structures for games Lecture 2B Minor Games Programming.
Artificial Intelligence in Game Design Intelligent Decision Making and Decision Trees.
Georgia Institute of Technology Workshop for CS-AP Teachers Chapter 3 Advanced Object-Oriented Concepts.
Programming Creating programs that run on your PC
Chapter 3.2 C++, Java, and Scripting Languages. 2 C++ C used to be the most popular language for games Today, C++ is the language of choice for game development.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Chapter 3.2 C++, Java, and Scripting Languages “The major programming languages used in game development.”
Computer Science - I Course Introduction Computer Science Department Boston College Hao Jiang.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Python Jordan Miller and Lauren Winkleman CS 311 Fall 2011.
Introduction to a Programming Environment
1 Computing for Todays Lecture 4 Yumei Huo Fall 2006.
Cmpt-225 Simulation. Application: Simulation Simulation  A technique for modeling the behavior of both natural and human-made systems  Goal Generate.
ADVANCED MICROSOFT POWERPOINT Lesson 6 – Creating Tables and Charts
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Building Applications.
Activity 1 - WBs 5 mins Go online and spend a moment trying to find out the difference between: HIGH LEVEL programming languages and LOW LEVEL programming.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
A First Program Using C#
M1G Introduction to Programming 2 4. Enhancing a class:Room.
Mobile search engine for a smart phone / navigation system can be used to search and compare hundreds of stores and their products in seconds. © 2001 –
CSC1401: Introductory Programming Steve Cooper
WAES 3308 Numerical Methods for AI
Artificial Intelligence in Game Design Behavior Trees.
Programming Languages: Scratch Intro to Scratch. Lower level versus high level Clearly, lower level languages can be tedious Higher level languages quickly.
What should I do first Young Joon Kim MSRDS First Beginner Course - STEP1.
HelloApps.com What should I do first Young Joon Kim MSRDS First Beginner Course - STEP1.
SE: CHAPTER 7 Writing The Program
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
How Solvable Is Intelligence? A brief introduction to AI Dr. Richard Fox Department of Computer Science Northern Kentucky University.
Artificial Intelligence in Game Design
AI in games Roger Crawfis CSE 786 Game Design. AI vs. AI for games AI for games poses a number of unique design challenges AI for games poses a number.
Chapter 7 The Practices: dX. 2 Outline Iterative Development Iterative Development Planning Planning Organizing the Iterations into Management Phases.
CS 460/660 Compiler Construction. Class 01 2 Why Study Compilers? Compilers are important – –Responsible for many aspects of system performance Compilers.
Artificial Intelligence in Game Design Lecture 17: Goal Oriented Action Planning.
M1G Introduction to Programming 2 5. Completing the program.
Vex Robotics Program four: reversing and turning.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Artificial Intelligence in Game Design Lecture 8: Complex Steering Behaviors and Combining Behaviors.
CSE332: Data Abstractions Lecture 28: Course Wrap-up Tyler Robison Summer
Advanced Task Engine Doing Cool Stuff with Cool stuff!
Laboratory Exercise # 10 – Microsoft Word Additional Topics Office Productivity Tools 1 Laboratory Exercise # 10 Microsoft Word Additional Topics Objectives:
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
UE4 Quickstart IMGD 4000 Due: March 23 rd, 11:59pm.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Raven A Multi-Agent Simulation System. Who Am I? Gamer Amateur Singer Tinkerer Avid Reader Bowler Senior-level CS Student Software Developer of 5 years.
Programming Language Basics. What is a Programming Language? “A computer, human-created language used to write instructions for a computer.” “An artificial.
Victory Lutheran college
Development Environment
CST 1101 Problem Solving Using Computers
Decision Making: Decision Tree & State Machines Session 07
Artificial Intelligence in Game Design
Cse 373 May 15th – Iterators.
What should I do first MSRDS First Beginner Course - STEP1
Artificial Intelligence in Game Design
Prepared by Kimberly Sayre and Jinbo Bi
CSCI1600: Embedded and Real Time Software
Introduction to Python
Programming Language Basics
Introduction to Data Structure
Applying Use Cases (Chapters 25,26)
Applying Use Cases (Chapters 25,26)
CSCI1600: Embedded and Real Time Software
Presentation transcript:

Lecture 4 1 Minor Games Programming

Artificial Intelligence for Games Today’s Theory & Demo’s:  Previous Practice A* (A Real Good Algorithm)  Scripting  Goal-Driven Behavior  SIMS with a Twist  Homework and Next Practice: Robocode 2 Jan Verhoeven

A* Practice See demo Cannibals and Missionaries  A generic A* implementation  How to define your nodes and edges?  In memory?  Runtime build?  How to define an heuristic function? 3

Scripting Chapter 6 in your study book Just study pages 249 thru 255 The rest of the chapter (about Lua Scripting Language) isn’t exam stuff, so you can skip the skript 4

What do we want? Each custom behavior should be able to function in isolation from other custom behaviors, so it is easier to test and manage We want to be able to tweak as easily as possible Behavior should be determined at run- time, rather than compile-time, for the above reason Behavior should be treated as “data”, rather than code, and be managed accordingly Schumaker

Scripting Languages Scripting languages are programming language other than the one actually used to program your game, and are used to write game behavior through an API You pass the scripting language through tools that compile the language into a format that can be loaded on the fly and executed Schumaker

Problems with Scripting Languages Writing one is not for the faint of heart Require an enormous amount of work You have to write a compiler and executer You have to expose an API to them You will want a nice suite of tools, like a development environment, debugger, etc. There will be learning curve since it’s a brand new language May result in unmaintainable spaghetti code if poorly designed Usually at best 1/10 speed of C/C++, so can drag down performance Existing scripting languages (Python, Ruby, Lua) may not meet your needs, there’s still a learning curve, and will still run very slowly Schumaker

Goal-Driven Behavior (see study book: chapter 9) 8  Goal-Driven Agent Behavior  Implementation  Goal Arbitration  Spin-offs  DON’T STUDY CODE EXAMPLES IN THIS CHAPTER … unless you are a Raven fan

Goal-Driven Agent Behavior Instead of states, an agent’s behavior is defined as a collection of hierarchical goals. Goals are:  Atomic (a single task, behavior, action)  Composite (comprised of several subgoals) 9

“Eric the Brave” example The process of decomposing and satisfying goals continues until the entire hierarchy has been traversed. 10

Implementation Using the composite design pattern 11

The Raven bots utilize the following goals: 12

RAVEN: view the goal list of a selected agent 13 Active: in blue Completed: in green Inactive: in black Failed: in red Indenting: how the goals are nested

Goal Arbitration How do bots select between strategy-level goals? This is accomplished by the composite goal Goal_Think, which each bot owns a persistent instance of, forming the root of its goal hierarchy. Goal_Think's function is to arbitrate between available strategies, choosing the most appropriate to be pursued 14

Six strategy-level goals Explore: An agent picks an arbitrary point in its environment and plans and follows a path to that point. Get Health: An agent finds the least cost path to an instance of a health item and follows the path to that item. Get Weapon (Rocket Launcher): An agent finds the least cost path to an instance of a rocket launcher and follows the path to it. 15

Six strategy-level goals Get Weapon (Shotgun): An agent finds the least cost path to an instance of a shotgun and follows the path to it. Get Weapon (Railgun): An agent finds the least cost path to an instance of a railgun and follows the path to it. Attack Target: An agent determines a strategy for attacking its current target. 16

(Next college) The selection of an adequate weapon is handled with use of FUZZY LOGIC the topic of next week (chapter 10) 17

Spin-Offs One great thing about a hierarchical goal- based arbitration design is that extra features are provided with little additional effort from the programmer: Personalities State Memory Command Queuing 18

Personalities You can create agents with different personalities by giving them different goals or different weighting factors 19

State memory examples Example One — Automatic Resuming of Interrupted Activities 20

State memory examples Example Two Negotiating Special Path Obstacles 21

State memory examples Example Two Negotiate Door. Run raven and load map: Raven_DM1_With_Doors.map. 22

Example of Command Queuing You can observe command queuing in action in Raven. You can queue multiple MoveToPosition goals by holding down the "Q" key while clicking on the map. If you release the "Q" key and right-click on the map again, the queue is cleared and replaced with the single new goal. (This would be just as easy to implement with any goal of your choosing though, because the queuing takes care of itself). 23

Q 24

SIMS * with a Twist The Making Of … 25 *

Sims * Example of Goal- Oriented Behavior Use of a Script language Unlimited number of goals and actions In this special edition two main characters: B & K 26

Some samples of goals and actions Goals:  Eat  Sleep  Bathroom Actions:  Get-Snack  Sleep-In-Bed  Visit-Bathroom  Study-Minor-Gaming  Kill-Barbie 27

Attributes Goal:  NameTo identify a goal  ValueThe ranking of a goal (The lower the better)  TickValueEach tick of the clock the ranking value is increased with tickvalue Action:  NameTo identify an action  Goals The goals which ranking values are altered due to this action 28

Example of the script: GOAL EAT GOAL BATHROOM ACTION GET_SNACK EAT(-3) BATHROOM(2) ACTION VISIT_BATHROOM BATHROOM(-8) SIM BARBIE EAT(8,2) BATHROOM(4,5) SIM KEN EAT(12,3) 29

SIMS* 30

SIMS* the engine Main classes: Goal, Action and Character. Character:  Goals the goals he/she wants to fulfill  Execute(action)change the value of all involved goals  ChooseAction(Actions)choose the one action from all actions in the game with the best result for the character 31

How to choose the action? By calculating for each action of a characters the amount of discontentment. The action with the lowest discontentment (also called energy) is chosen Follow the calculations on your school board …. 32

Homework and Practice 33

Robocode 34

Robocode setup Start at: Download and install: Read Getting Started and some tutorials Run some battles Have fun 35

 Homework  Study this presentation  Read Chapter 6 Scripting (selected pages)  Read Chapter 9 Goal-Driven Behavior  Practice preparation (homework)  Install Robocode on your laptop  Run some battles with the sample robot tanks  Learn to program in Java ;-)  Practice  You will be asked to develop your own robot tank given some requirements 36