Comments

Log in with itch.io to leave a comment.

Interesting example. I have not looked at the code yet... I would suggest, however, that you add more states: Instead of going immediately back to it's patrol route upon losing the target (player), it performs a small search algorithm to try to find them again. "Small" meaning something simple, such as go to each position that would extend line of sight beyond the obstacle blocking it -- but only the positions visible at the time/position it lost the player. (I.E., a hunt and seek algorithm, but only one iteration before it "gives up".)

Perhaps even add a control to set how many iterations it will attempt -- with an infinite number effectively making it roam the entire playing field rying to find and chase the player again.

It would be interesting to see how the "AI" handles these modifications.

(1 edit)

A search state is an interesting idea. I didn't think of that because something like that is not necessary for my projects (this AI demo is already verging on too smart for the sort of game I'm making, and I wouldn't want the enemies even harder for the player to evade) but something like you suggest would be great for a stealth game.

(2 edits)

For the demo, at least, you could make it configurable. For the game, you can do the same: Let the player select some options/states to make it easier/harder. I considered the idea because I found it was much too easy to evade the AI by running around more than one corner as quickly as I could. But if the AI tried to check a little further, it would have had a 50% chance of finding me again for two corners, 33 1/3 % for three corners, etc.

Edit to add: A fuller AI could even be made harder by using learning and predictive algorithms. So for a harder stealth type game, it can learn things like the player is more likely to try using a corner that is closer and gives them more space/corners to try hiding again.