Sign in to follow this  
gattra

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

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!

Share this post


Link to post
Share on other sites

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.. :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.