Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

A Star and AI

Sign in to follow this  


A Star and AI

Today I've been working on the a star, as well as the AI code. I made the enemies only attempt to look at 10 nodes per Think() call when planning a path. The A star object keeps the current progress so it can be resumed or aborted at any time. This definitely improves the framerate when the player is in a hard place to path to.

Right now, the enemy AI is within a pretty decent goal/subgoal system, but I have only been playing with the 'Follow' goal in order to test the A star code. Today I have been trying to make it more realistic. For instance, instead of the AI omnisciently knowing where your character is at all times ( which makes for a good a star test case ), I added line of sight checks from the ai to the player. If it has not seen the player in several seconds, it invalidates the Follow() plan, which causes a new top down Goal evaluation by the Brain object.

To do this, I have added 'memory' to the Brain. For instance, how long has the player been hidden from view, how long has he been visible, where was he last seen, and what velocity did he have at that time.

It's going to be an interesting and ongoing experiment to decide how much the AI should remember and analyze about the player.
In some action games, the AI consists of running & shooting at the player. In games with stealth, however, which we plan to
have as a key gameplay element, you need the AI to be somewhat more interesting. For instance, AIs should at times travel
around the map on patrol, so that the player can sneak past them or silently take them out.

Another wrinkle is audio. The AI should be able to hear the player at times. Of course, if they have not been alerted,
and the player is making 'normal' sounds, like opening & closing doors, there is not necessarily a problem. If an enemy is
on higher alert, they might go towards an unusual sound to investigate. If they spot the player, or something else out of
place like blast marks or bloodstains, or they hear something more serious ( like combat ) they go on alert. All AIs that see or hear another alterted AI to also become alerted.

No screenshots this time. AI is not very visual, at least until I add some more visual AI debugging aids.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!