Download - Weapon Selection

Transcript
Page 1: Weapon Selection

04/22/23 1

Weapon Selection

CIS 488/588Bruce R. MaximUM-Dearborn

Page 2: Weapon Selection

04/22/23 2

Weapon Properties• Definitely affect weapon behavior

– Melee or range– Projectile speed– Rate of fire– Damage– Spread angle– Damage rate

• In a game world the designer’s creativity and the game’s entertainment value can be more important than physical constraints

Page 3: Weapon Selection

04/22/23 3

Weapon Applicability

• Relative positions of combatants to one another

• Evolving nature of a particular battle• Status of player and enemies• Environmental layout

– Obstacles affecting trajectory or splash damage– Cluttering objects affecting weapon efficiency

• Balance in exploiting enemy vulnerabilities• Player skill at handling a weapon

Page 4: Weapon Selection

04/22/23 4

Training Zone Attributes

• Representative terrain• Lots of ammo and weaponry available• Can allow bot to choose weapons arbitrarily

or train them extensively with selected weapons one at a time

• Provide diverse combat scenarios

Page 5: Weapon Selection

04/22/23 5

Mr. Versatility

• Capable of using all game weapons• Has weapon specific shooting skills• (not found yet)

Page 6: Weapon Selection

04/22/23 6

Weapon Evaluation

• Relevant game features can be modeled using symbols or numeric values

• Player features may also be modeled• These features can be used as inputs to an

evaluation function that returns a numeric value representing weapon fitness

• The function can contain any simple or exotic algorithm for doing selection (including RBS or trained NN)

Page 7: Weapon Selection

04/22/23 7

Weapon Selection

• The AI control algorithm works though a O(n) process of applying the fitness function to each available weapon and selects the one with the best fitness score

• The fitness function suffers from the same information loss weaknesses and credit assignment problems as does the static evaluation in the mini-max algorithm

Page 8: Weapon Selection

04/22/23 8

Role of Deduction

• Human can make use of deductive reasoning to break a decision down into easily solved sub-problems

• This requires the ability to extract key features of a situation and induce the weapon properties that are necessary

• This process can be modeled by the the production rules in a RBS

• Building production rules takes time

Page 9: Weapon Selection

04/22/23 9

Role of Experience

• Humans can make use of memory to avoid repeating costly trial and error experiments

• This requires extensive combat history if these banked decisions are to be worthwhile

• Simulation can be used to help agents acquire this kind of history

• People can share this history with each other and look for trends that may be relevant to new or unknown situations

Page 10: Weapon Selection

04/22/23 10

Hybrid Approaches

• Deduction requires heavy reasoning on simple knowledge

• Experience used no reasoning but requires lots of knowledge based on history

• A combined strategy might seek to extend knowledge gathered by experience by using logic to extend it further

• There is a tradeoff between time needed to acquire data and the accuracy of the estimates

Page 11: Weapon Selection

04/22/23 11

Weapon Selection Criteria

• Decisiveness– One a weapon is selected by the AI it should not

be swapped unless there will be an easily recognized improvement in AI shooting effectiveness

• Justifiability– Players observing the weapon used by the AI

should be able to explain the choice of the weapon for use in the current situation

Page 12: Weapon Selection

04/22/23 12

Case Study

• Weapon choices could be ranges– Long distance (prefer precise weapons)– Medium distance (prefer splash damage)– Close distance (high spread fast projectiles)

• Fight flow of control– Powerful weapons when NPC is desperate– Precise weapons when NPC is under control

• Weapon change time limited to 5 seconds during combat

Page 13: Weapon Selection

04/22/23 13

Joyce

• Contains weapons selection component in its architecture

• Scans possible weapons and calls a fitness evaluation function to aid in selection

• Evaluation is done using RBS• Best weapon returned via interface• (not found yet)

Page 14: Weapon Selection

04/22/23 14

Context

• Weapon model may be the most important aspect of context, but does not need to be very detailed (e.g. could a symbol)

• 3D animated models are relied on to translate symbol manipulation in weapon changes and firing behavior

Page 15: Weapon Selection

04/22/23 15

Environment

• Only local terrain information is required to predict player and projectile movement

• Weapon selection has impact that often extends beyond a single “turn”

• Weapon selection may also require information on tactical space for movement around enemy

• Might be sufficient to return distance to obstacles near enemy

Page 16: Weapon Selection

04/22/23 16

Player State Information

• Heads up display (HUD) provides human player info on his health, weapon, and armor

• AI has access to same info in HUD• Enemy NPC state is harder for animat to

determine without “cheating” via direct queries

• Many times indirect evidence (sounds and projectile impact) can be monitored by NPC’s like human players would do

Page 17: Weapon Selection

04/22/23 17

Representing Weapon Properties

• Declarative– Can represent them as a set of rules– Separates data and code

• Implicit– Weapon properties induced by observing their

effects of the environment• Query

– Provide dedicated interface to return precise weapon properties at run-time

Page 18: Weapon Selection

04/22/23 18

Actions

• Selecting a weapon could be done using a single procedure call

• Selection can be done by cycling through the list of weapons using a series of scripting commands

• There may be some delay between selection and the time the correct animation frame sequence is activated

Page 19: Weapon Selection

04/22/23 19

Specification

• Symbols will be defined for each of the ten weapons

• AI can find out about weapon availability from new inventory interface

• Weapons properties will need to be induced during game play

• A high-level query will return information about space constriction near target

Page 20: Weapon Selection

04/22/23 20

Interfaces - 1

• Weaponbool Select(const Symbol& weapon);

• Inventory (self)void WeaponsAvailable

(vector<Symbol>& weapons);

• Health (self)int Heath( );

Page 21: Weapon Selection

04/22/23 21

Interfaces -2

• Constriction (enemy)float GetSpatialRestriction( );

• Damage (to enemy) – event callback void OnDamage(const Event_Damage& e);

Page 22: Weapon Selection

04/22/23 22

Code Skeletonvoid Think( ){

// determine available weaponsvector<Symbol>& weapons;personal->WeaponsAvaliable(weapons);// extract situation propertiesfloat f = vision->SpatialRestriuction( );int h = personal->Health( );// make weapon decisionweapons->Select(weapons[i]);

}

Page 23: Weapon Selection

04/22/23 23

Sir Obvious

• Checks inventory to find weapons and corresponding ammo available

• Health changes and terrain constraints are also noted

• Prints finding on debug console• (not found yet)

Page 24: Weapon Selection

04/22/23 24

Scripting Languages - 1

• Not AI, but commonly used in games• Loosely typed or dynamically typed• Syntax easier to use than programming

language• Compact and powerful statements• Allow for rapid prototyping• Scripts translated to byte code when loaded• Interpreter executes each statement as it is

encountered in turn

Page 25: Weapon Selection

04/22/23 25

Scripting Languages - 2

• The scripting environment can be embedded in the application

• Alternatively the programming language could be integrated with the scripting language as a means of extending it

• A high-level interface can be used to pass all needed data to a script before it runs

• It is also possible to allow the scripting language to use input/output interfaces to interact with the world as it executes

Page 26: Weapon Selection

04/22/23 26

Python Weapon Evaluationdef EvaluateWeapon(type, ammo):

if ammo > 0:if type == “railgun”: return 2return 1return 0

• External function calls are easy to handle• If function parameters and return values are

required you will need to provide overloaded functions in the interface

• You will need to define generic functions to set and query global variables of each type

Page 27: Weapon Selection

04/22/23 27

Voting System Overview

• Deductive reasoning– Decisions deduced from initial facts

• Declarative property specification– AI knows about firing rates and expected damage

• Voting system used to ranks weapon properties

• Properties will receive potentially many votes from many features

• Votes used to determine weapon fitness

Page 28: Weapon Selection

04/22/23 28

Weapon Properties

• The relevant weapon properties are obtained from WWW for Quake2– Rate of fire– Damage per shot– Damage per second– Speed of Projectile– Precision

• Properties will be store in a data file to allow for easy editing and modification

Page 29: Weapon Selection

04/22/23 29

Voting System

• Features will be used to decide which weapon property is required most and vote for it

• Votes are scaled by their importance (less than 1 and greater than 1)

f(w) = P1(w)*V1 + … + Pn(w)*Vn

w = weaponPi(w) = ith weapon property weight

Vn = total votes for property

Page 30: Weapon Selection

04/22/23 30

Page 31: Weapon Selection

04/22/23 31

Collecting Feature Votes

• Expert needed to make judgments regarding feature importance in particular situations

• Experts will assign weights to votes and fitness function will compute the dot product of the number of votes and their weights

Page 32: Weapon Selection

04/22/23 32

Timing Restrictions

• Prevent changing weapons if last change occurred a few seconds prior

• No weapon switching while firing at enemies possessing ammunition (wait for cover or until enemy stops firing)

Page 33: Weapon Selection

04/22/23 33

Picky

• Contains script that implements a voting system used to select the best weapon

• Can query world interfaces directly to gather information

• Selected weapon is returned via higher-level interface

• (seems to have a Python problem)

Page 34: Weapon Selection

04/22/23 34

Evaluation - 1

• Experimentation phase requires lots of tweaking or votes and weapon property weights

• When play is observed to be bad features are isolated to see what the problem is

• Offending feature is adjusted until votes become reasonable

• When votes seem balanced, the property weights are adjust to correct the fitness value

Page 35: Weapon Selection

04/22/23 35

Evaluation - 2

• This system is easy to extend and easy to adjust

• System does well at selecting weapons and mirrors human behavior with all its flaws

• Adjusting the voting system by trial and error by hand does is not very satisfying

• Supervised learning might be good alternative


Top Related