Sign in to follow this  
Budda

CreatureAI Javadocs

Recommended Posts

With the current beta version that is out now, there have been a few changes to the CreatureAI and CreatureAIData files, as well as two new files included - GenericCreatureAI and GenericCreatureAIData. All of these should be able to be easily extended and used as a custom AI system for any creature you want to create. Starting with the GenericCreatureAI files would be best if you want a general creature that has basic movement (moving along a path, moving towards an opponent or someone attacking them - with optional preference for targeting players over creatures, random movement and optional pathing towards something else interesting when not under attack) with optional tethering to a point so they can't wander too far. After extending you'll have to override other existing methods like pollAttack to actually give it proper combat capabilities and all that, but it also have access to a lot of hooks so the creature can act as you want it to.

 

To actually use this system instead of the basic creature stuff for a creature, you will have to call setCreatureAI(CreatureAI) on the creature's template. Just as an added note, all of the polling on these is called every second - so if you are implementing this on a creature where there will be thousands of them on a server, just keep in mind how often things are being polled and called - depending on how you use it could cause some lag.

 

As a quick example of how this can work, on my WU server I have creatures that spawn in tethered to an item's location that then have various abilities when they are fought like temp invulnerability, healing themselves, summoning more creatures to help them, and doing large AoE attacks.

 

Unfortunately I can't give you the base source files with all comments included, but the files are pretty well documented, so I've generated Javadocs for the relevant files. The 4 mentioned files above as well as UtilitiesAOE are included, and list all the methods and fields available and what they are currently used for or where they are called from.

 

You can grab the Javadocs from here: https://drive.google.com/file/d/0BzAde1avZPjKUV9wYm9oOXNXT0E/view?usp=sharing

  • Like 9

Share this post


Link to post
Share on other sites

Thanks Budda, this is awesome.  Hopefully this is setting the stage for more javadocs being released in the future!

Share this post


Link to post
Share on other sites

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
Sign in to follow this