Home

Awesome

Unity Badge FPS CSharp Badge Issue fork star LicenseWiki Badge <a href="https://baponkar.github.io/zombie-ai"> <img src="ScreenShots/share_icon.png" alt="Share icon" width="20" height="20"> </a>

<img src="ScreenShots/Social_pic.png" alt="Social Picture Banner" width="300" height="auto">

Zombie NPC or Zombie AI for Unity Game Engine

See following demo videos :

Roughly It has following Characteristics:

Screenshots:

<img src="ScreenShots/screenshot_with_weapon.png" alt="Screenshot 0" width="150" height="150"><img src="ScreenShots/Screenshot1.png" alt="Screenshot 1" width="150" height="150"><img src="ScreenShots/screenshot_with_multiple_zombie.png" alt="Screenshot 2" width="150" height="150"><img src="ScreenShots/screenshot_4.png" alt="Screenshot 2" width="150" height="150">

Flowchart of State Transition

<a href="https://colab.research.google.com/drive/14w90fm0O1CPNVTPYqNnic9xqHehyHnAs?usp=sharing"> <img src="ScreenShots/flowchart.png" alt="Flowchart of State transition" width="300" height="auto"> </a>

You can make your own custom transition then you need to update the state csharp script files according to your logic.

Behavior Tree:

I have dropped this feature. <img src="ScreenShots/behavior_tree.png" alt="Behavior Tree" width="300" height="auto">

Documentation :


  1. Add following layers in the following orders
  1. NPC : Change Default layer of Zombie/Romero Prefab into NPC, and also Change Tag of Zombie/Romero Prefab into NPC.

  2. Change Layer of Player into Character which will be seen by NPCs, and also Change Tag of Player with "Player".

  3. Change Layer of all prefabs indicator plane into "Mini Map" Layer.Which will be seen only by Mini Map Camera.

  4. See NPCVisionSensor Script which attached with npcs i.e. zombie/Romero prefabs and change its Occulation Layer with corresponding Ground Layer i.e. if ground plain be Defult then change into Defult Layer.

  5. See NPCVisionSensor.cs Script which attached with npcs i.e. zombie/Romero prefabs and change its Target Layer into Character Layer which is the Layer of Player.So NPCs can see the player by vision sensor.

  6. Bake Navmesh with Humanoid Agent which should be in NavMeshAgent(Which attached to the Zombie Prefab).

  7. Now put zombie prefab and player prefab in your scene.Player has attached a Health script which is damageable by Zombie/Romero.

  8. Zombie also has attached a Health Script which can be damagable by external player which has a weapon which can be used to damage zombies health.

  9. Change or tweak zombie behavior by setting up zombie config scriptable object.

  10. To Change custom sensor detection layer edit 'NPCSensoryMemory.cs' file

  11. If you don't see the npcs then you need to add 'NPC' layer into the culling mask section of FPSCamera which have attached to theplayer prefab

Zombie sensor sense Character Layer for this NPCSensoryMemory.cs Script.

Find "NPCSensoryMemory.cs" Script inside Scripts folder.

   ...
   public void UpdateSenses(NPCVisionSensor sensor)
   {
      int targets = sensor.Filter(characters, 'TargetLayer');
      //Here put the player layer name in 'TargetLayer'
      //Here I have use 'Character' as Player Object Layer is that.
      ....
   }
<img src="ScreenShots/set_sensor_layer.png" alt="Changing Target Layer" width="300" height="300">

License:

Credits 😊:

  1. I have get ideas from Youtuber 'Kiwi Coder's tutorials 1 2

  2. I have get ideas from Youtuber 'Dev/GameDevelopment's tutorials

  3. Unity Learn - BehaviorTree

  4. Sound Effect from <a href="https://pixabay.com/sound-effects/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=music&amp;utm_content=6419">Pixabay</a>

  5. Mixamo Character

Dependency

  1. This Assets depend on 'Zombie assets by Pxltiger'. So You need to download this package from Unity assets store along with this Zombie_Enemy_AI assets.
  2. Standard-Assets-Characters I am using Audio files for footstep sound.
  3. Rifle by Game-Ready Studios
  4. Unity Simple FPS by me.
  5. My Behavior Tree by me.
  6. Traffic-System by me.
  7. Kiwi coder Behavior Tree by Kiwi Coder.

Unity Version

Unity 2020.3.15f2 or higher version.

Contact:

Gmail X LinkedIn YouTube


Copyright © baponkar 2024