Jump to content

Creating a "ray" around an enemy for enhanced AI?


gattra
 Share

Recommended Posts

I am currently building the AI for some baddies in a simple video game I'm making. The levels are mostly horizontal with some floating platforms here and there. 

 

Using `enemy.state` as an attribute to keep track of what the enemy is doing and by tracking the x and y distances between the player and the baddies, I am able to create a semi-working AI system. 

 

But there are still glitches. For example: if the baddie is on a hovering platform and the player is directly below that platform, the baddies doesn't know to walk off the platform to get to the player. 

 

Are there ways to create "rays", like with Unity? Essentially, a "ray" is an orb that surrounds the object and detects its relation to other things around it. This way the object can navigate levels in a human-like way.

 

Anything along those lines, or any AI tips and techniques/tutorials would be greatly appreciated!

Link to comment
Share on other sites

  • 2 weeks later...

Have you looked at Astar? Seems to me if you're already tracking when a player is within proximity, you could then trigger a-star's pathfinding for that enemy toward the player.  Depending on how 'smart' you want your AI to be, you may need it to give up the chase at a certain point lest you end up with all the baddies tracking toward your player like heat-seeking missles.. :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...