PDA

View Full Version : New BOT AI Framework


WildcardX
01-09-2010, 08:00 PM
I am coding a new AI for the bots as I type this post and I'm genuinely excited about it! I believe I am creating a new framework that will not only prove superior to the legacy AI system in terms of bots being able to respond appropriately to changing situations, but it'll also be easy for other coders out there to expand upon it and customize it.

I have radically departed from the old process that was essentially finding the first spell of a certain spell type and casting it, with limited logic. The new system will first asses the situation the bot faces for a specific spell type and then it will decide based on the situation the best spell to cast. This should mean healers will actually choose between casting a heal over time, a fast heal spell or a percentage heal all based on combat conditions and health ratios! I also expect that enchanters will be able to perform crowd control duties without being told what to mez!

For sure, when I commit the first draft of this new framework there will be bugs that will need to be addressed but I am confident server ops and players will find this new AI framework to be a great enhancement to bots!

As of right now, I believe I'll have this ready to be committed to the repo sometime early next week.

pfyon
01-09-2010, 10:19 PM
Sounds exciting. I'm all for more extensible code :D

WkimWes
01-11-2010, 04:16 PM
Sounds awesome! I'm all for the enhancement of the bots, great work Wildcard.

WildcardX
01-12-2010, 11:47 AM
Earlier this morning, I commited r1091 to the repo, which is the new spellcasting ai I've been working on. This is largely done, but there are a couple features that I have not tested or finished yet, but I decided to commit the code I had because of the amount of code I had written so far and the fact that a couple other developers have showed interest in assisting me so I decided to put this in the repo now so people can start to look at it and contribute to the rest of it.

This ai is focused around how bot spellcasting behaves in a single group and does not have any logic that is specific to raids. You'll find that if you go after a raid mob, that your success will largely be based on wether your client character is the cleric or the raid mob is weak or you just zerged it with an army of bots. After I feel the ai is working as best as possible for bot groups, I will be moving on to the much request bot raid logic.

Here are the known issues so far with this new ai spellcasting logic:

1. I have not implemented logic to select which nuke spell a wizard bot ought to use. Right now the wizard bot is just grabbing the first nuke spell on it's list.

2. I have code in place to support enchanter bots to identify an "add" mob and mez it, but this code is incomplete and untested at all.

3. I have not tested or done anything with bot bards. If they work at all, I'll be happy until I can get some help to make them what they ought to be.

4. Hybrids heal more than I'd like to see them healing.

Needless to say, a server op should evaluate r1091 before decided to replace their play server with this version of bots. If you are unsatisfied with it, then you are best waiting until the code is more settled.

Ansley1
01-12-2010, 12:57 PM
Any servers running r1091? I wanna play/mess around with it.

pfyon
01-12-2010, 01:40 PM
Just updated to r1091 and got the following error when compiling on Ubuntu server 9.04 (I think?):

make -C zone
make[1]: Entering directory `/home/eqemu/source/svn/trunk/EQEmuServer/zone'
gcc -o zone .obj/EQPacket.o <snip>
client.o: In function `memset':
/usr/include/bits/string3.h:82: warning: memset used with constant zero length parameter; this could be due to transposed parameters
/usr/include/bits/string3.h:82: warning: memset used with constant zero length parameter; this could be due to transposed parameters
bot.o:(.data.rel.ro._ZTV3Bot[vtable for Bot]+0x21c): undefined reference to `Bot::AI_EngagedCastCheck()'
bot.o:(.data.rel.ro._ZTV3Bot[vtable for Bot]+0x220): undefined reference to `Bot::AI_PursueCastCheck()'
bot.o:(.data.rel.ro._ZTV3Bot[vtable for Bot]+0x224): undefined reference to `Bot::AI_IdleCastCheck()'
bot.o:(.data.rel.ro._ZTV3Bot[vtable for Bot]+0x238): undefined reference to `Bot::AICastSpell(Mob*, unsigned char, unsigned short)'
bot.o:(.data.rel.ro._ZTV3Bot[vtable for Bot]+0x23c): undefined reference to `Bot::AIDoSpellCast(unsigned char, Mob*, int, unsigned int*)'
collect2: ld returned 1 exit status
make[1]: *** [zone] Error 1
make[1]: Leaving directory `/home/eqemu/source/svn/trunk/EQEmuServer/zone'
make: *** [all] Error 2


Edit: this is after running a make clean as well.

Derision
01-12-2010, 01:55 PM
Did you add botspellsai.o to your zone/makefile.common ? It's a new file in this revision, and that is where those methods the linker can't find are defined.

pfyon
01-12-2010, 03:13 PM
I did not. Added it and it's compiling fine now.

Also wtf with edit time limits, now I can't edit out that hugeass line making my window scroll sideways :(.

WildcardX
01-15-2010, 05:00 PM
Looks like one of the final pieces needed to get the best spell heal casting performance out of your healer bots is we will need to create a "default bot class" spell list for bots to use instead of re-using the "default class" spell lists. I've done some analysis of my word database from PEQ and I've found that there are a lot of spells that are inappropriate for an NPC to cast that have been left out of the spells lists, but are needed for bots. Once such example is the healing spells a level 65 cleric bot has to select from. At level 65 and using the PEQ world database, a bot cleric has only 2 healing spells to select from.. a Heal over time spell and Complete Heal. If you look at the bot ai spell casting logic, you'll see that this creates a significant gap in the healing logic. I'm a little surprised the bots are keeping tanks alive as well as they are, even! For now, you can create your own spell lists for bots to get around this issue until Gaeorn and I can come up with a new sql script file to install a stock default bot class spell list set.

If anyone come creates any 100% complete class spell lists that bots can use, please submit the SQL insert commands to me. Creating these spell lists is a large tedious task so any help with it is appreciated.

prickle
01-15-2010, 07:11 PM
Maybe I'm misunderstanding what you're saying, but I use the PEQ database as well. I thought the bots already had their own spell lists. I usually edit spell list 701 for my cleric bot, and it seems to work. For example, the default 701 cleric bot spell list doesn't allow Group HP and single Target HP buffs to over lap in levels. I updated my 701 cleric spell list by allowing single target HP buffs and group HP buffs to overlap and setting the Single target HP buff as lower (higher numerically) priority.

I did this because the default spell list resulted in the cleric not HP buffing me if I die and they didn't.

With my change to the cleric spell list, the cleric will cast the single target HP buff on me, if they still have the group HP buff on.

Granted the current bot spell lists aren't "complete", but I find them more than satisfactory (cleric wise). Though, I did remove all cleric nukes from my cleric's spell list.

Congdar
01-15-2010, 07:26 PM
The bots don't use the "default class" spell lists for npc's if that's what you mean by default. I know what you mean about it being tedious since I made the bot spell lists. The default npc lists are 1 through 12 in the npc_spells table but the bots are 701 though 712 in that table. If I missunderstood what you meant by default then nm. Anyway, it would probably be easier to start with what I have and edit/modify rather than start from scratch. Yes the cleric only has 2 spells for healing, but that's just because I modified the ai to use one HoT and one Real Heal... CH being the best choice. Certainly an ai written to handle more heals would be better.

Here's a link to my sql. Bot Spells (http://www.cerebus.net:8080/downloads/botspells.zip)

WildcardX
01-15-2010, 07:37 PM
Perhaps I wasn't clear. What I meant by the default class spell lists are the ones in my database are the ones with the spell id' in the 700 range. These spell lists are inadequate for the bot logic that now exists and need to be expanded upon but done so independent of any world database.

Yes, what is there now is a good start, but many spells need to be added to this spell list and then made independent of the world database.

For example, the current spell ai is capable of assessing various situations that might lead it to conclude a normal heal is a better choice than a HoT or a CH line of heal. Enchanters are going to be able to assess the need to mez add's and cast their DoT spells.

bad_captain
01-16-2010, 04:57 PM
Wildcard, here is some spell work I did while working on my healing fixes.. I'm going off of Congdar's bot_spells.xls that I downloaded in April last year, so I'm not sure if it's the latest version or not. This should get bots up through 70. If we need post 70, let me know and I can pull all of them together. I can take a look at other classes, but I mostly played a Magician and Paladin, so some classes I may not be too familiar with.

First, I set max level for superior healing so it can be cast instead of CH until next healing spell at 53, as well as a priority fix for chloroblast (I'm not sure if you even use the priority anymore - I had changed my priorities to distinguish between fast heals, complete heals, group heals, etc..) I also increase the max level for Choloroblast so it can work alongside Kragg's Mending (% heal) until the Shaman gets Tnarg's Mending. I like your way of distinguishing between types of healing spells better of course :) Regular heals will be inserted with a priority of 2.

Then, insert the new spells

UPDATE npc_spells_entries SET maxlevel = 52 WHERE spellid = 9 AND npc_spells_id = 701; -- Cleric (Superior Healing)
UPDATE npc_spells_entries SET priority = 2 WHERE npc_spells_id = 706 AND spellid = 1290; -- Shaman (Chloroblast was priority 3? Should have been 2)
UPDATE npc_spells_entries SET maxlevel = 61 WHERE spellid = 1290 AND npc_spells_id = 706; -- Shaman (Chloroblast)

INSERT INTO npc_spells_entries (npc_spells_id, spellid, type, minlevel, maxlevel, priority) VALUES
-- Fast heals to be used when very low on HP... - Cleric
(701, 1518, 2, 51, 60, 2), -- Remedy
(701, 3465, 2, 61, 65, 2), -- Supernal Remedy
(701, 5251, 2, 66, 255, 2), -- Pious Remedy

-- Regular Heals to be used instead of CHeal in certain situations - Cleric
(701, 1519, 2, 53, 57, 2), -- Divine Light
(701, 2182, 2, 58, 62, 2), -- Ethereal Light
(701, 3480, 2, 63, 64, 2), -- Supernal Light
(701, 4880, 2, 65, 67, 2), -- Holy Light
(701, 5265, 2, 68, 69, 2), -- Pious Light

-- HoT Heals - Shaman
(706, 4899, 2, 65, 69, 1), -- Breath of Trushar
--(706, 3398, 2, 65, 69, 1), -- Quiescence (replaced by Breath of Trushar)
(706, 5416, 2, 70, 255, 1), -- Spiritual Serenity

-- Mini (%) CHeal - Druid
(707, 2179, 2, 58, 63, 2), -- Tunare's Renewal
(707, 3232, 2, 64, 69, 2); -- Karana's Renewal

prickle
01-16-2010, 05:48 PM
Perhaps I wasn't clear. What I meant by the default class spell lists are the ones in my database are the ones with the spell id' in the 700 range. These spell lists are inadequate for the bot logic that now exists and need to be expanded upon but done so independent of any world database.

Yes, what is there now is a good start, but many spells need to be added to this spell list and then made independent of the world database.

For example, the current spell ai is capable of assessing various situations that might lead it to conclude a normal heal is a better choice than a HoT or a CH line of heal. Enchanters are going to be able to assess the need to mez add's and cast their DoT spells.

hmmm... I think i understand now. However, what "priority" should regular heal spells be? same as CH (priority 2) or same as HOT's (Priority 1)? Or does it even matter?

bad_captain
01-16-2010, 05:54 PM
I will take a look at home later the latest DB version to check on spells, as with a quick glance, PEQ doesn't appear to have Kragg's Mending, which means the Shaman bot doesn't have a healing spell from LVL 57 to 62, when it gets Tnarg's Mending. I didn't realize it because it is in Congdar's bot_spell.xls file, but didn't make it into the .sql file to load into the DB.



EDIT- Kragg's Mending insert

INSERT INTO npc_spells_entries (npc_spells_id, spellid, type, minlevel, maxlevel, priority) VALUES
-- Mini (%) CHeal - Shaman
(706, 2435, 2, 58, 62, 2); -- Kragg's Mending

bad_captain
01-16-2010, 05:55 PM
hmmm... I think i understand now. However, what "priority" should regular heal spells be? same as CH (priority 2) or same as HOT's (Priority 1)? Or does it even matter?

I think with the new code, it doesn't matter. But priority 2 would be regular heals.

WildcardX
01-16-2010, 06:46 PM
It doesnt matter anymore. we dont cast spells strictly out of a "queue" anymore. The bot considers the situation first.

prickle
01-30-2010, 06:07 PM
Good work so far!

Have you started on the Enchanter crowd control logic yet? Mainly asking because I want to know if I should be expecting my enchanters to mez automatically..

thanks