This is my attempt at smart monster brains. It is lightly commented, but they're more like notes...
Thanks to Theodis for the awesome pathfinding library, and Lummox JR for his get_general_dir() proc!
The intention of making this artificial intelligence was to further my own learning of bit flags, and make something useful in the process. What I've put into the AI was what I thought was common RPG-esque AI styles.
chase you down
chase npcs down
get close, and not quite next to you
engage you in combat
call for help
help if it's friend is being attacked
and*, walk back to its spawning location
*not necessarily in that order, eliminating steps as necessary
v1 - first release
v2 - fixed runtime error; renamed all bit flags
- added friendly monsters
- made a demo
v3 - made monsters able to call for help
- fixed some minor bugs
- made "step_limit"
v4 - fixed an error with wandering monsters not wandering
- fixed an error with the files that were
being downloaded, the correct files should now download.
v5 - small adjustments with the AI; fixed a small error which made monsters not trigger.
v6 - made the monsters smarter in terms of chasing monsters (they will go much faster if they are chasing someone down, than if they're wandering, for example.