weapon selection

Download Weapon Selection

Post on 23-Feb-2016




0 download

Embed Size (px)


Weapon Selection. CIS 488/588 Bruce R. Maxim UM-Dearborn. Weapon Properties. Definitely affect weapon behavior Melee or range Projectile speed Rate of fire Damage Spread angle Damage rate - PowerPoint PPT Presentation


  • Weapon SelectionCIS 488/588Bruce R. MaximUM-Dearborn

  • Weapon PropertiesDefinitely affect weapon behaviorMelee or rangeProjectile speedRate of fireDamageSpread angleDamage rateIn a game world the designers creativity and the games entertainment value can be more important than physical constraints

  • Weapon ApplicabilityRelative positions of combatants to one anotherEvolving nature of a particular battleStatus of player and enemiesEnvironmental layoutObstacles affecting trajectory or splash damageCluttering objects affecting weapon efficiencyBalance in exploiting enemy vulnerabilitiesPlayer skill at handling a weapon

  • Training Zone AttributesRepresentative terrainLots of ammo and weaponry availableCan allow bot to choose weapons arbitrarily or train them extensively with selected weapons one at a timeProvide diverse combat scenarios

  • Mr. VersatilityCapable of using all game weaponsHas weapon specific shooting skills(not found yet)

  • Weapon EvaluationRelevant game features can be modeled using symbols or numeric valuesPlayer features may also be modeledThese features can be used as inputs to an evaluation function that returns a numeric value representing weapon fitnessThe function can contain any simple or exotic algorithm for doing selection (including RBS or trained NN)

  • Weapon SelectionThe 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 scoreThe fitness function suffers from the same information loss weaknesses and credit assignment problems as does the static evaluation in the mini-max algorithm

  • Role of DeductionHuman can make use of deductive reasoning to break a decision down into easily solved sub-problemsThis requires the ability to extract key features of a situation and induce the weapon properties that are necessaryThis process can be modeled by the the production rules in a RBSBuilding production rules takes time

  • Role of ExperienceHumans can make use of memory to avoid repeating costly trial and error experimentsThis requires extensive combat history if these banked decisions are to be worthwhileSimulation can be used to help agents acquire this kind of historyPeople can share this history with each other and look for trends that may be relevant to new or unknown situations

  • Hybrid ApproachesDeduction requires heavy reasoning on simple knowledgeExperience used no reasoning but requires lots of knowledge based on historyA combined strategy might seek to extend knowledge gathered by experience by using logic to extend it furtherThere is a tradeoff between time needed to acquire data and the accuracy of the estimates

  • Weapon Selection CriteriaDecisivenessOne a weapon is selected by the AI it should not be swapped unless there will be an easily recognized improvement in AI shooting effectivenessJustifiabilityPlayers observing the weapon used by the AI should be able to explain the choice of the weapon for use in the current situation

  • Case StudyWeapon choices could be rangesLong distance (prefer precise weapons)Medium distance (prefer splash damage)Close distance (high spread fast projectiles)Fight flow of controlPowerful weapons when NPC is desperatePrecise weapons when NPC is under controlWeapon change time limited to 5 seconds during combat

  • JoyceContains weapons selection component in its architectureScans possible weapons and calls a fitness evaluation function to aid in selectionEvaluation is done using RBSBest weapon returned via interface(not found yet)

  • ContextWeapon 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

  • EnvironmentOnly local terrain information is required to predict player and projectile movementWeapon selection has impact that often extends beyond a single turnWeapon selection may also require information on tactical space for movement around enemyMight be sufficient to return distance to obstacles near enemy

  • Player State InformationHeads up display (HUD) provides human player info on his health, weapon, and armorAI has access to same info in HUDEnemy NPC state is harder for animat to determine without cheating via direct queriesMany times indirect evidence (sounds and projectile impact) can be monitored by NPCs like human players would do

  • Representing Weapon PropertiesDeclarativeCan represent them as a set of rulesSeparates data and codeImplicitWeapon properties induced by observing their effects of the environmentQueryProvide dedicated interface to return precise weapon properties at run-time

  • ActionsSelecting a weapon could be done using a single procedure callSelection can be done by cycling through the list of weapons using a series of scripting commandsThere may be some delay between selection and the time the correct animation frame sequence is activated

  • SpecificationSymbols will be defined for each of the ten weaponsAI can find out about weapon availability from new inventory interfaceWeapons properties will need to be induced during game playA high-level query will return information about space constriction near target

  • Interfaces - 1Weaponbool Select(const Symbol& weapon);Inventory (self)void WeaponsAvailable (vector& weapons);Health (self)int Heath( );

  • Interfaces -2Constriction (enemy)float GetSpatialRestriction( );Damage (to enemy) event callback void OnDamage(const Event_Damage& e);

  • Code Skeletonvoid Think( ){// determine available weaponsvector& weapons;personal->WeaponsAvaliable(weapons);// extract situation propertiesfloat f = vision->SpatialRestriuction( );int h = personal->Health( );// make weapon decisionweapons->Select(weapons[i]);}

  • Sir ObviousChecks inventory to find weapons and corresponding ammo availableHealth changes and terrain constraints are also notedPrints finding on debug console(not found yet)

  • Scripting Languages - 1Not AI, but commonly used in gamesLoosely typed or dynamically typedSyntax easier to use than programming languageCompact and powerful statementsAllow for rapid prototypingScripts translated to byte code when loadedInterpreter executes each statement as it is encountered in turn

  • Scripting Languages - 2The scripting environment can be embedded in the applicationAlternatively the programming language could be integrated with the scripting language as a means of extending itA high-level interface can be used to pass all needed data to a script before it runsIt is also possible to allow the scripting language to use input/output interfaces to interact with the world as it executes

  • Python Weapon Evaluationdef EvaluateWeapon(type, ammo):if ammo > 0:if type == railgun: return 2return 1return 0External function calls are easy to handleIf function parameters and return values are required you will need to provide overloaded functions in the interfaceYou will need to define generic functions to set and query global variables of each type

  • Voting System OverviewDeductive reasoningDecisions deduced from initial factsDeclarative property specificationAI knows about firing rates and expected damageVoting system used to ranks weapon propertiesProperties will receive potentially many votes from many featuresVotes used to determine weapon fitness

  • Weapon PropertiesThe relevant weapon properties are obtained from WWW for Quake2Rate of fireDamage per shotDamage per secondSpeed of ProjectilePrecisionProperties will be store in a data file to allow for easy editing and modification

  • Voting SystemFeatures will be used to decide which weapon property is required most and vote for itVotes are scaled by their importance (less than 1 and greater than 1)f(w) = P1(w)*V1 + + Pn(w)*Vnw = weaponPi(w) = ith weapon property weightVn = total votes for property

  • Collecting Feature VotesExpert needed to make judgments regarding feature importance in particular situationsExperts will assign weights to votes and fitness function will compute the dot product of the number of votes and their weights

  • Timing RestrictionsPrevent changing weapons if last change occurred a few seconds priorNo weapon switching while firing at enemies possessing ammunition (wait for cover or until enemy stops firing)

  • PickyContains script that implements a voting system used to select the best weaponCan query world interfaces directly to gather informationSelected weapon is returned via higher-level interface(seems to have a Python problem)

  • Evaluation - 1Experimentation phase requires lots of tweaking or votes and weapon property weightsWhen play is observed to be bad features are isolated to see what the problem isOffending feature is adjusted until votes become reasonableWhen votes seem balanced, the property weights are adjust to correct the fitness value

  • Evaluation - 2This system is easy to extend and easy to adjustSystem does well at selecting weapons and mirrors human behavior with all its flawsAdjusting the voting system by trial and error by hand does is not very satisfyingSupervised learning might be good alternative