Mastering Action AI for Survival Shooter

Mastering Action AI for Survival Shooter

Table of Contents:

  1. Introduction
  2. Creating the Player Action AI
  3. Setting up the Qualifiers 3.1. Qualifier: Heal 3.2. Qualifier: Throw Bomb 3.3. Qualifier: Reload 3.4. Qualifier: Shoot
  4. Adding Actions to the Qualifiers 4.1. Action: Heal 4.2. Action: Throw Bomb 4.3. Action: Reload 4.4. Action: Shoot
  5. Setting up the Acquire and Shoot Composite Action 5.1. Action: Set Best Attack Target 5.2. Action: Fire Attack Target
  6. Implementation of Actions
  7. Conclusion

🎯Table of Contents🎯

  1. Introduction
  2. Creating the Player Action AI
  3. Setting up the Qualifiers 3.1. Qualifier: Heal 3.2. Qualifier: Throw Bomb 3.3. Qualifier: Reload 3.4. Qualifier: Shoot
  4. Adding Actions to the Qualifiers 4.1. Action: Heal 4.2. Action: Throw Bomb 4.3. Action: Reload 4.4. Action: Shoot
  5. Setting up the Acquire and Shoot Composite Action 5.1. Action: Set Best Attack Target 5.2. Action: Fire Attack Target
  6. Implementation of Actions
  7. Conclusion

Introduction

Welcome to this Tutorial on creating the action AI for the survival shooter demo. In this tutorial, we will be focusing on how to create the AI logic for the player character's actions, such as shooting and throwing bombs.

Creating the Player Action AI

To begin, we will create a new AI called "Player Action AI." This AI will handle the decision-making process for the player character's actions. We will reuse some of the logic from the AI created in the previous video, specifically the first selector that determines whether the player character should do something if there are enemies nearby or do nothing if there are no enemies.

Setting up the Qualifiers

Next, we will set up the qualifiers for the different actions that the player character can perform. These qualifiers will help us determine which action should be taken based on certain conditions and scores.

Qualifier: Heal

The first qualifier we will set up is for healing. We want the player character to heal if their health is below a certain threshold and if they have band-aids available. We will set the threshold to 35 and give it a high score of 200.

Qualifier: Throw Bomb

The next qualifier is for throwing bombs. The player character should throw bombs if they are too close to enemies. We will use a proximity test to determine if there are enemies nearby, and if so, give it a score of 200.

Qualifier: Reload

The reload qualifier will check if the player character's gun needs to be reloaded. If the gun is not loaded, the player character should reload it.

Qualifier: Shoot

Finally, we have the shoot qualifier. This qualifier will determine if the player character should shoot their gun. The player character should only shoot if the gun is loaded.

Adding Actions to the Qualifiers

Now that we have set up the qualifiers, we can add actions to them.

Action: Heal

The action for healing will simply call the "use band-aid" method on the player character to heal them.

Action: Throw Bomb

The action for throwing bombs will call the appropriate method to throw a bomb.

Action: Reload

The reload action will trigger the player character to reload their gun.

Action: Shoot

The shoot action is slightly more complex. It will select a target to attack and then start firing at that target.

Setting up the Acquire and Shoot Composite Action

The shoot action requires a composite action called "acquire and shoot" to function properly. This composite action consists of two actions: setting the best attack target and firing at the target.

Action: Set Best Attack Target

The set best attack target action selects the best enemy target for the player character to attack. It considers factors such as enemy proximity and whether the target is currently being attacked.

Action: Fire Attack Target

The fire attack target action actually performs the shooting at the designated enemy target.

Implementation of Actions

Now that we have set up the actions and qualifiers, we can implement the logic for each action. These implementations involve calling the appropriate methods on the player character based on the action being performed.

Conclusion

In this tutorial, we have learned how to create the action AI for the player character in the survival shooter demo. We have set up qualifiers for different actions such as healing, throwing bombs, reloading, and shooting. We have also added actions to these qualifiers and implemented the logic for each action. With this AI in place, the player character will be able to make intelligent decisions and perform the necessary actions in the Game.

🌟Highlights🌟

  • Creation of the Player Action AI
  • Setting up qualifiers for different actions
  • Adding actions to the qualifiers
  • Implementation of action logic
  • Composite action for acquiring and shooting targets

FAQ:

Q: How does the AI determine when to heal? A: The AI checks the player character's health and whether they have band-aids available. If the health is below the threshold and band-aids are available, the AI triggers the healing action.

Q: How does the AI decide when to throw bombs? A: The AI uses a proximity test to determine if there are enemies nearby. If enemies are nearby, the AI triggers the bomb-throwing action.

Q: Does the AI consider if the player character's gun needs to be reloaded? A: Yes, the AI checks if the gun is loaded. If it is not loaded, the AI triggers the reloading action.

Q: How does the AI select the target to shoot at? A: The AI uses a set of scores to evaluate different enemy targets. It considers factors such as enemy proximity, whether the target is alive, and whether the target is the current attack target. The AI selects the best target based on these scores.

Most people like

Find AI tools in Toolify

Join TOOLIFY to find the ai tools

Get started

Sign Up
App rating
4.9
AI Tools
20k+
Trusted Users
5000+
No complicated
No difficulty
Free forever
Browse More Content