CIS 487/587 Bruce R. Maxim UM-Dearborn

Slides:



Advertisements
Similar presentations
Using Microsoft PowerPoint in the Classroom
Advertisements

EZ Grade Pro Becky Koss French & Spanish Teacher Lake-Lehman Sr. High School.
Vocabulary Interactive
Chapter 1: Introduction. Contents Whats New in Dreamweaver CS4? The Dreamweaver CS4 Interface Setting Up a Site Creating a Web Page Adding Text to Your.
Microsoft Expression Web-Illustrated Unit J: Creating Forms.
 Use the Left and Right arrow keys or the Page Up and Page Down keys to move between the pages. You can also click on the pages to move forward.  To.
Skater World: Part One By Deborah Nelson Duke University Under the direction of Professor Susan Rodger May 29,
Microsoft Word 2010 Lesson 1: Introduction to Word.
5/24/20151 Torque Constructor CIS 487/587 Bruce R. Maxim UM-Dearborn.
Google Earth How to create a Google Earth Tour and place it in your Wiki.
Highly Confidential – for UCRE Affiliate Use Only 2015 Regional Training Class Embedding maps on the listing page of your United Country office website.
Copyright 2007, Information Builders. Slide 1 Maintain & JavaScript: Two Great Tools that Work Great Together Mark Derwin and Mark Rawls Information Builders.
Hello World In C++ and Microsoft Visual C++. Directions to begin a project 1. Go to All Programs 2. Open Visual Studio C++ 3. Click on New Project 4.
Copyright 2007, Information Builders. Slide 1 WebFOCUS Maintain – Enhancing Objects with JavaScript Mark Derwin Information Builders Information Builders.
Intro to C++. Getting Started with Microsoft Visual Studios Open Microsoft Visual Studios 2010 Click on file Click on New Project Choose Visual C++ on.
PRACTISCORE MATCH SET UP
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 5 Enhancing Forms with OLE Fields, Hyperlinks, and Subforms.
Click your mouse for next slide Dreamweaver – Creating New Pages Creating new pages is easy Choose the File menu and choose New file Or Hold down Ctrl.
Open a editor Write/Type the program Save the program with “.c” extension Compile the program (alt + F9) Run/Execute the program (ctrl + F9) Check the.
Microsoft Access 2010 Chapter 8 Advanced Form Techniques.
The Cisco Binary Game INSTALLING THE GAME Extract Set-up File Double click Binary_setup.zip Save to computer Launch Set-up Click binary_setup.exe Follow.
Slide Show: Using Idea Machine Templates
Landscaper 101. Time Code AMC AMCNET HELP!!! Where do you go for help? –Upper right corner has a ? for the online help –This presentation.
How to Back Up In 10 Easy Steps. Step 1: Double click on My computer. You should see something like this. WatchWatch.
Smart Center. Welcome to Smart Center Please logon with your Medical Domain Account.
An Introduction to Alice By Jenna Hayes under the direction of Professor Susan Rodger Duke University, June 2009 Updated June 2014 by Ellen Yuan.
1 Getting Started with C++ Part 1 Windows. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Microsoft.
If you don’t have Google Earth downloaded already, you can go to to get it.
1 Microsoft Access Security Warnings Note: This presentation was created with "Access 2002". You might have slightly different warnings with other versions.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Index Background Costumes Making object walk smoothly Controlling an object with the keyboard Control an object with the mouse Changing costume when hit.
 Motion Tween allow us to move a shape on the stage from one place to another.  In order to use motion tween, the shape to be moved must be converted.
Fundamentals of Windows Mouse n 4 Basic Operations: –Pointing –Clicking –Double Clicking –Dragging.
Power Point Tutorial Power Point is a powerful presentation program but a relatively easy system to use. The menu of functions is much the same as in MS.
First Day in Lab Making a C++ program
EEC-693/793 Applied Computer Vision with Depth Cameras
INTRO to PIXLR.com.
Learning PowerPoint A Tutorial.
Create a Halloween Computer Game in Scratch
Professor Susan Rodger
Setting up Categories, Grading Preferences and Entering Grades
An Introduction to Alice (Short Version)
EEC-693/793 Applied Computer Vision with Depth Cameras
Attendance Tracking Module
Recording Your Script and Creating Your Podcast
Cameras & Pictures Shaw STEM Lab 2014
Enhancing Forms with OLE Fields, Hyperlinks, and Subforms
Assignment 8 Chess Game.
GETTING TO KNOW YOUR KEYBOARD
Cameras & Pictures Shaw STEM Lab 2014
Windows Operating Systems (Cont.)
EEC-693/793 Applied Computer Vision with Depth Cameras
MS PowerPoint 2010 Week 2.
Chapter 7 Advanced Form Techniques
CIS 487/587 Bruce R. Maxim UM-Dearborn
CIS 487/587 Bruce R. Maxim UM-Dearborn
COURSE INSTRUCTIONS Minimum Requirements Microsoft Windows 2000
An Introduction to Alice
Introduction to PowerPoint
CIS 487/587 Bruce R. Maxim UM-Dearborn
CIS 487/587 Bruce R. Maxim UM-Dearborn
EEC-693/793 Applied Computer Vision with Depth Cameras
Directions are in slide notes. You can view them in two ways
Recording Your Script and Creating Your Podcast
Running a Java Program using Blue Jay.
Unity Game Development
Creating a Simple Game in Scratch
WEB Data Mining.
Adding signatures to outgoing in Webmail and Microsoft Outlook
Presentation transcript:

CIS 487/587 Bruce R. Maxim UM-Dearborn Enemy AI CIS 487/587 Bruce R. Maxim UM-Dearborn 11/21/2018

Slides based on the Code from Advanced 3D Game Programming by Kenneth Finney 11/21/2018

Stationary Guard - 1 Requirements Visually detects potential threats Determines friend or foe Determines threat level Scans assigned area Engages hostile players Detects when being engaged by hostile players 11/21/2018

Stationary Guard - 2 Attributes Maximum vision range (differs for each guard) Minimum vision range (guaranteed detection distance) Alertness (some are better and some are worse) Attention level (gets worse with no activity) Aggressiveness (not always the same for each guard) 11/21/2018

AIDropPoints Execute the fps.starter demo and open the World Creator Interface On lower right side, drill down and click on MissionObjects/System/SimGroup Call the object AIDropPoints and switch to the World Editor Inspector (F3) Make AIDropPoints an instant group using the Alt key and left mouse button 11/21/2018

Guard Switch to the World Creator (F4) On lower right side, drill down and click on MissionObjects/System/SimGroup Call the object Guard and switch to the World Editor Inspector (F3) Make Guard an instant group using the Alt key and left mouse button 11/21/2018

SpawnSphere - 1 Exit the Mission Editor (F11) and enter camera fly mode (F8) Find a good location for an AI character and place it 20 feet off the terrain Switch back to the Mission Editor (F11) and enter World Creator (F4) Drill down to Shapes/Misc on lower right and click on SpawnSphereMarker Place at least two more in the world 11/21/2018

SpawnSphere - 2 Switch to World Editor Inspector (F3) Select all 3 SpawnSpheres in upper left (Ctrl and left mouse click) Click on expand all Changes the radius field to 10 and press Apply button 11/21/2018

SpawnSphere - 3 Select all 3 SpawnSpheres in upper left (Ctrl and left mouse click) Add the following dynamic field and values to each aggression 100 range 100 attention 100 alertness 100 Save the mission and exit to the desktop 11/21/2018

Code Modifications Add this line to the server\script\game.cs function onServerCreated exec(“./aiGuard.cs”); At the end of the startGame() function in the same game.cs file add this line to start the bot placement process Schedule(3000, 0, “CreateBots”); Save game.cs and copy the file aiGuard.cs to the server\script folder 11/21/2018

checkForThreat function AIGuardDB::checkForThreat(%this,%obj) { DebugPrint( "%this:"@%this@"~AIGuardDB::checkForThreat (from:"@%obj@")", "checkForThreat"); if(!isObject(%obj)) return; // modified to allow firing %idx = %obj.getClosestEnemy(); if (%idx < 0) return 0; %target = ClientGroup.getObject( %idx ); 11/21/2018

checkForThreat if ( !%obj.CheckArcOfSight(%target.player) ) %testRange = %obj.range / 2; else return; if ( %obj.GetTargetRange(%target.player) < %testRange) { return %target.player; } DebugPrint( "no threat (from:"@%obj@")", "checkForThreat"); return 0; 11/21/2018

Testing Guard AI When the player avatar gets close enough for the Guard to see it, the player will be attacked until killed or the player moves out of range The Player is not able to inflict any damage on the Guard (a definite need in real game) 11/21/2018

PathedAI The fps.starter contains the script server\scripts\aiPlayer.cs Add the following to the end of aiPlayer.cs function InsertPathedAI() { %player = AIPlayer::spawnOnPath("Follower","MissionGroup/Paths/PathB"); %player.mountImage(CrossbowImage,0); %player.setInventory(CrossbowAmmo,1000); %player.followPath("MissionGroup/Paths/PathB",-1); } 11/21/2018

Path Definition - 1 Find a relatively flat area where it will be easier to create a path and hit F11 to open the Mission Editor and switch to "World Editor Creator" mode. Expand the tree in the lower right half of the screen by clicking the "Mission Objects" entry. Expand it out like so: "Mission Objects->Mission" 11/21/2018

Path Definition - 2 In the "Mission" directory, you should see several entries to choose from. Click the entry labeled "Path" just once to create a new Path object. Name the Path object, “PathB". In the "MissionGroup" tree, which is in the upper right hand side of the editor, expand out the tree and find the node labeled "PathB". 11/21/2018

Path Definition - 3 Make this node the current selection by holding down the "Alt" key while clicking it with the mouse. If done correctly, the selection color of the "PathB" entry should change from white to gray. Make sure the path markers get grouped under our new Path object. Return to the tree control in the lower right hand corner and click the “PathMarker” in the "Mission" directory. 11/21/2018

Path Definition - 4 Name the new PathMarker, “wp1" and check to make sure it was correctly grouped under "PathB" in the "MissionGroup" tree control. Repeat the process to create two more PathMarkers called, “wp2, and “wp3". Make sure to place them far enough apart so you can see your bot run around. Save the mission file and exit to the desktop 11/21/2018

Test PathedAI Run the test application again. Move the player avatar to a location near the path defined by PathB Open the console and type InsertPathedAI( ); Close the console window and watch it go 11/21/2018

PathedAIShooter Define another path called PathA Insert the following line of code in the aiPlayer::aimAt function %this.setAimLocation(%object.getPosition()); after the line %this.setAimObject(%object); You will also need to add the function InsertPathedAIShooter to the file aiPlayer.cs 11/21/2018

InsertPathedAIShooter - 1 function InsertPathedAIShooter() { %player = AIPlayer::spawnOnPath("Shooter","MissionGroup/Paths/PathA"); %player.mountImage(CrossbowImage,0); %player.setInventory(CrossbowAmmo,1000); // Maxim added code %player.followPath("MissionGroup/Paths/PathA",-1); %player.pushTask("playThread(0,\"celwave\")"); %player.pushTask("followPath(\"MissionGroup/Paths/PathA\")"); %player.pushTask("aimAt(\"MissionGroup/target\")"); %player.pushTask("wait(10)"); 11/21/2018

InsertPathedAIShooter - 2 %player.pushTask("fire(true)"); %player.pushTask("wait(1)"); %player.pushTask("fire(false)"); %player.pushTask("wait(10)"); %player.pushTask("playThread(0,\"celwave\")"); %player.pushTask("done()"); } 11/21/2018

Testing Shooter Open the World Creator and place a logo some where near PathA Label the logo “Target” and save the mission Start demo and open the console window Type the following to test the shooter once the player avatar can view PathA InsertPathedAIShooter( ); 11/21/2018

Combining Them It is possible to have a moving enemy that also shoots at you I have not finished my version yet, but you might try looking at the AI Guard Unit on the Torque web site (this will require recompiling Torque to add a new class) Finney’s version does not require recompilation of Torque 11/21/2018

Chasing Add the following code where setAimObject is called if (%theRole !$= “Guard”) { %obj.setMoveSpeed($MAX_CHASER_SPEED); %obj.setMoveDestination(%tgtPlayer.getPosition( )); %obj.nextBlockCheck = %this.schedule($MAX_SCAN_GAP*2), “unblock”, %obj); } 11/21/2018

Unblock // used to help AI when they get stuck function AIGuardDB::unblock(%this,obj) { if (!isObject(%obj)) return; cancel(%obj.nextBlockCheck); %this.setRandomDestinatioin(%obj); } 11/21/2018