Creating SMART enemies from scratch! | Devlog
Summary
TLDRIn this video script, the creator discusses the complexities of enemy behavior in game development, particularly the challenges of adding intelligence to their interactions. Starting with basic states like 'idle' and 'pursuing,' the script explains how enemies move towards the player. It then addresses the complications introduced by environmental obstacles and the need for line of sight (LOS) checks to prevent enemies from getting stuck or ignoring obstacles. The creator introduces a tile tracking solution to help enemies navigate when LOS is lost, allowing them to find the best path to the player. This approach not only improves the development process but also enables community mod support.
Takeaways
- 👾 **Enemy AI Complexity**: Designing enemy behavior in games is challenging due to the need for intelligent interactions with the player and environment.
- 🛡️ **Basic Enemy States**: Enemies typically have at least two states: idle and pursuing, which are fundamental for basic interaction.
- 🔍 **Line of Sight (LOS)**: Implementing LOS checks to ensure enemies only attack when they can see the player, adding realism to their behavior.
- 🚫 **Obstacle Interaction**: Obstacles in the game environment can complicate enemy movement, requiring logic to navigate around them effectively.
- 🔄 **State Transition Logic**: The transition between idle and pursuing states is crucial and must account for obstacles and LOS.
- 🗺️ **Tile Tracking**: Utilizing tile tracking to help enemies find paths to the player when direct LOS is lost, enhancing their navigational abilities.
- 🔄 **Dynamic LOS Checks**: Tiles around the player perform LOS checks to provide data that helps the enemy decide its next move when the player is not directly visible.
- 🏠 **Patrolling Behavior**: Enemies can be programmed to patrol between tiles that have LOS with their 'home' point, adding variety to their idle behavior.
- 🎯 **Targeting Strategy**: When LOS is lost, enemies can use nearby tile data to determine the best direction to pursue the player.
- 🔧 **Mod Support and Development**: The reworked enemy AI makes it easier to create new enemies and supports community modding, streamlining the development process.
Q & A
What is the primary challenge in developing enemy behavior in games?
-The primary challenge in developing enemy behavior in games is adding intelligence to the way they interact with the player and the world around them, beyond just having basic animations and health.
What are the two basic states given to enemies in the script?
-The two basic states given to enemies are 'idle' and 'pursuing'.
How do enemies determine when to switch from idle to pursuing state?
-Enemies switch from the idle to pursuing state when the player gets too close, triggering a change in animation and movement towards the player.
What complication arises when obstacles are introduced into the game environment?
-When obstacles are introduced, the simple logic of moving directly towards the player becomes unreliable, as enemies may get stuck or ignore the obstacles.
What is the purpose of implementing Line of Sight (LoS) checks?
-Line of Sight (LoS) checks are implemented to ensure that enemies only attack when they can see the player, and to prevent them from getting stuck or moving through obstacles.
How does the enemy react when it loses Line of Sight with the player while pursuing?
-When an enemy loses Line of Sight with the player while pursuing, it may revert to the idle state to avoid getting stuck or causing other issues.
What is the solution proposed for enemies to find the player when Line of Sight is lost?
-The solution proposed is for enemies to use tile tracking, where each tile around the player performs its own LoS checks to determine viable paths to reach the player.
How do enemies decide which direction to go when they don't have Line of Sight with the player?
-When enemies don't have Line of Sight with the player, they look at nearby tile data to find tiles that have LoS with both the player and the enemy, indicating a clear path to the player.
Why is it important for tiles to frequently recalculate their LoS data?
-Tiles need to frequently recalculate their LoS data because the player is always moving, and if the tiles are no longer close enough or lose LoS, the enemy might run out of options.
How does the idle state of an enemy differ with the introduction of tile tracking?
-With tile tracking, the enemy's idle state involves wandering around with a home point and a list of tiles that have LoS with that home point, allowing it to patrol and cover more space.
What benefits does this rework of enemy behavior bring to the development process?
-This rework of enemy behavior simplifies the creation of new enemies, improves the development process, and makes community mod support possible.
Outlines
此内容仅限付费用户访问。 请升级后访问。
立即升级Mindmap
此内容仅限付费用户访问。 请升级后访问。
立即升级Keywords
此内容仅限付费用户访问。 请升级后访问。
立即升级Highlights
此内容仅限付费用户访问。 请升级后访问。
立即升级Transcripts
此内容仅限付费用户访问。 请升级后访问。
立即升级浏览更多相关视频
Classic Hardcore WoW: A New Experience
Let's Play Tomb Raider III: Das verlorene Artefakt Remastered – Teil 8 – Shakespeare-Klippe
How You Can Easily Make Your Code Simpler in Godot 4
How To Make An 8-Directional Movement System With Animations! | Scratch Tutorials
Java Game Development TUTORIAL - Episode #27 - Waves!
How To Make a Topdown RPG in Godot 4: Adding Combo Attacks and an Enemy(Part 2)
5.0 / 5 (0 votes)