samedi 23 février 2019

Fuzzy Logic : What the best weapon to pick

Introduction

Fuzzy logic is artificial intelligence use in video game. The specificity of the fuzzy logic is to compute a desiraiblity value for very specific case instead of normal checking to enable state

Here is an example where the fuzzy logic can useful

Project : Which weapon choose again player ?

In a shooter game, an AI actor can have multiple weapons, but which weapon choose to fight efficiently again player

For this project, I create 3 weapons

- Shotgun : Very efficient on a close combat insofar as the spread of weapon, but useless for long distance because the shell spread so the damage is minimal form afar

 - Rocket Launcher : Very efficent on mid combat, not  efficient close because the damage explosion can hurt the player , and not efficient form far because the rocket is slow so the enemy can avoid the rocket

- Sniper Rifle : Very efficient for far combat , efficient on middle. Not efficient on close combat, because the time of reloading a sniper is very long

The selection of the weapon will using 2 data

- Distance from the player
- Munition in the weapon

For each of the 2 data, multiples rules will be create

- Target Close & Lot of ammo, Target Close & Correct amount of ammo, Target Close & low ammo
- Target Mid & Lot of ammo, Target Mid & Correct ammount of ammo...

Diagram

Here is 2 diagrams for the 2 datas

Distance
The target is

- Close : 0 : 25 meters
- Middle : 25 300 meters
- Far 150 1000

You can note that a target can middle and far at the same time ! But that is the fuzzy logic is not stuck in one state, but give values for each state

Ammo

 The target is

- Low ammo: 0 : 10 ammo
- Correct ammo : 10 30 ammo
- Lot ammo 30 100

 Demonstraction

On this project the user can enter the distance of the target and the munition of each weapon (rocket,shotgun , sniper)

Here are the result



For a ditance of  50 meter to the target the best weapon is the shotgun



For a distance of 150 meter to the target the best weapon is the rocket launcher



For a distance of 300 meter to the target the best weapon is the sniper rifle

Link to this project : https://github.com/NicolasBunn/FuzzyLogic


Aucun commentaire:

Enregistrer un commentaire