Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bots

Development::Bots Forum for bots.

Reply
 
Thread Tools Display Modes
  #1  
Old 04-25-2016, 12:38 PM
jaspen
Hill Giant
 
Join Date: Apr 2016
Posts: 107
Default Multiple bot questions.

I have recently built up an EQEmu server for me and some friends. We have been playing with bots as well. Here are some questions and potential issues we have. Let me also state I am not a code expert but will try to understand and would love to learn.

Feel free to grab a question below that you feel comfortable answering. Thanks in advance.

1. Where are the scripts that tell the bots how to act and what to do? I use HeidiSQL for editing the database but is the code for their actions in a separate location?

2. Originally I was having problems with Bards playing combat songs. I found a thread that said to increase the type from 8 to 1024. This fixes it for the most part. The problem I have is that the bard appears to struggle at keeping the songs going. Most fade before he starts playing them again. Is there a setting I could look into to modify the refresh or is this a limitation on how the songs are coded?

3. Last bard question. He seems to try and twist 5 songs while out of combat. Is there a way of adjusting this to less so that the important one like health/mana regen are going and not fading?

4. This goes into question one. I would like to set it up where melee classes, except tanks, move to the back of the mob like rogues. I saw someone post the rogue code but I have no idea where the code is. I figured i could copy that for all classes I wanted to move to the back?

5. Back to referencing 1 again. I noticed anomalies like casters not hasting my SK but would other melees and pets. I assume this is a potential flag in the code that tells what valid targets for the spells are? I understand them not wasting the mana to haste a pure casters. Maybe even turn it off for pets as well as I believe most casters have their own personal pet haste?

7. What is the best way to modify spells a bot casts. Is HeidiSQL sufficient enough? I assume if I add or remove a row the id column will automatically adjust the numbering? Checking beforehand so that I don't destroy something.

I know I asked a lot of questions. I didn't want to create a bunch of threads but I know it can be an eyesore having so much in one thread. For those that stuck in there, thanks!
Reply With Quote
  #2  
Old 04-25-2016, 05:01 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Quote:
1. Where are the scripts that tell the bots how to act and what to do? I use HeidiSQL for editing the database but is the code for their actions in a separate location?
Bots are hard-coded into the actual server, though the code will not be included if their option is not enabled when configuring with CMake.

All bots are designed to process variable information loaded from the database, which gives them specialized behaviors.


Quote:
2. Originally I was having problems with Bards playing combat songs. I found a thread that said to increase the type from 8 to 1024. This fixes it for the most part. The problem I have is that the bard appears to struggle at keeping the songs going. Most fade before he starts playing them again. Is there a setting I could look into to modify the refresh or is this a limitation on how the songs are coded?
I submitted the out-of-combat bard song code to badcaptain some time ago..in turn, he implemented the concept.

The idea was to allow bard bots a different set of songs while out of combat..stuff like Selo's and other appropriate songs.
(ref: https://github.com/EQEmu/Server/blob..._OOC_Songs.sql)


Quote:
3. Last bard question. He seems to try and twist 5 songs while out of combat. Is there a way of adjusting this to less so that the important one like health/mana regen are going and not fading?
There is no easy way to limit songs so that previous ones do not elapse. Just limiting to 4 songs may cause other issues and I haven't had time to look into their AI code.
Plus, not all songs have an 'even' duration/recast schedule, so there's always the possibility of a 'missed' song casting.


Quote:
4. This goes into question one. I would like to set it up where melee classes, except tanks, move to the back of the mob like rogues. I saw someone post the rogue code but I have no idea where the code is. I figured i could copy that for all classes I wanted to move to the back?
Pretty sure that code is tied to a lower class than bots and will affect all classes derived from it.

Of course, you could always virtualize the function and create a polymorphic, derived class function for it.


Quote:
5. Back to referencing 1 again. I noticed anomalies like casters not hasting my SK but would other melees and pets. I assume this is a potential flag in the code that tells what valid targets for the spells are? I understand them not wasting the mana to haste a pure casters. Maybe even turn it off for pets as well as I believe most casters have their own personal pet haste?
I can't remember if SK's are considered melee for haste purposes or not... It's either, as you said, a flag (/class check) or another spell is conflicting. (I'm going with class check..)


Quote:
7. What is the best way to modify spells a bot casts. Is HeidiSQL sufficient enough? I assume if I add or remove a row the id column will automatically adjust the numbering? Checking beforehand so that I don't destroy something.
The link I posted above for the ooc bard songs shows where the spells should be added/removed.

You should learn about the priority system as well as the type bitmask before making any changes, however.

You should never delete entries from `spells_new` as that affects every entity that uses the spell data.


EDIT: This query will show the ids of the bot spell lists
Code:
SELECT * FROM `npc_spells` WHERE `id` BETWEEN '701' AND '712'
And this for spells by spell list name:
Code:
SELECT * FROM `npc_spells_entries` WHERE `npc_spells_id` IN (SELECT `id` FROM `npc_spells` WHERE `name` LIKE 'Bard Bot')
And the actual spells from the above query:
Code:
SELECT * FROM `spells_new` WHERE `id` IN (SELECT `spellid` FROM `npc_spells_entries` WHERE `npc_spells_id` IN (SELECT `id` FROM `npc_spells` WHERE `name` LIKE 'Bard Bot'))
(Yes, UNIONS/JOINS are easier...)
__________________
Uleat of Bertoxxulous

Compilin' Dirty

Last edited by Uleat; 04-25-2016 at 07:29 PM..
Reply With Quote
  #3  
Old 04-26-2016, 08:59 AM
jaspen
Hill Giant
 
Join Date: Apr 2016
Posts: 107
Default

Thanks for the reply.

Okay so the bot code has to be modified before compiling the server code? Do you know which files contain the code?
Reply With Quote
  #4  
Old 04-26-2016, 11:19 AM
N0ctrnl's Avatar
N0ctrnl
Discordant
 
Join Date: Jan 2007
Posts: 443
Default

Go digging in the code. There are a few files. Look in the zone directory. It's pretty obvious

Code:
bot_command.cpp
bot_command.h
bot.cpp
bot_database.cpp
bot_database.h
bot.h
botspellsai.cpp
bot_structs.h
__________________
Ender - Lead GM/Developer
Vegarlson Asylum Server - http://www.vegarlson-server.org/
Reply With Quote
  #5  
Old 04-26-2016, 11:33 AM
jaspen
Hill Giant
 
Join Date: Apr 2016
Posts: 107
Default

I am new to all of this. I am not sure where the program does or does not pull from. I have read posts where someone will state that certain directories are no longer used or antiquated yet there will be something there. So even if i find something it isn't obvious to me that it is still valid. While I know trial and error is a great way of learning, it is nice to have a little guidance and you guys have been helping with that. Thanks for pointing me towards that valid information. I will eventually learn. Hopefully, I do not annoy you guys too much in the process of learning
Reply With Quote
  #6  
Old 04-26-2016, 04:27 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

The thing with class Bot, it is derived from class NPC as well as class Mob (and class Entity..and...) .. so, some of the code may be in the other two classes.


You will probably see many cases like this:
Code:
Mob* mob_ptr = <some rvalue>;

mob_ptr->SomeVirtualFunction();
It's probable that the following are declared:
Code:
virtual void Mob::SomeVirtualFunction();

virtual void NPC::SomeVirtualFunction();

virtual void Bot::SomeVirtualFunction();
If <some rvalue> is instantiated as class Mob, then Mob::SomeVirtualFunction() is called.

If <some rvalue> is instantiated as class NPC, then NPC::SomeVirtualFunction() is called.

If <some rvalue> is instantiated as class Bot, then Bot::SomeVirtualFunction() is called.


Now, take away the class Bot virtual declaration:

If <some rvalue> is instantiated as class Bot, then NPC::SomeVirtualFunction() is called.


If you're using visual studio, it has some really good tools that can help.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #7  
Old 06-02-2016, 11:43 PM
cannon
Hill Giant
 
Join Date: Dec 2004
Location: Pittsburgh, PA
Posts: 128
Default

Uleat, I read your post above about the bot spell entries, for the life of me I cannot see where the Shaman bot references casting the spell Scale of Wolf when using the ^sow command. I am trying to change it to Spirit of the Wolf.
Reply With Quote
  #8  
Old 06-03-2016, 05:58 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Bot command spells and bot ai spells draw from two different sources.


AI spells come from the database and probably are not up-to-date.

Command spells, however, come directly from the in-memory spell sub-system: https://github.com/EQEmu/Server/blob...mmand.cpp#L118
- in particular: https://github.com/EQEmu/Server/blob...mmand.cpp#L436


You should get a log report that looks like this:
Quote:
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'RuleI(Bots, CommandSpellRank)' set to 1.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_BindAffinity' returned 14 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Charm' returned 48 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Cure' returned 149 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Depart' returned 157 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Escape' returned 4 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Identify' returned 5 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Invisibility' returned 30 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Levitation' returned 13 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Lull' returned 27 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Mesmerize' returned 42 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_MovementSpeed' returned 21 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Resistance' returned 83 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Resurrect' returned 18 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Rune' returned 21 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_SendHome' returned 2 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Size' returned 4 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_Stance' returned 187 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_SummonCorpse' returned 18 spell entries.
[06-02-2016 :: 19:57:42] [Commands] load_bot_command_spells(): - 'SpT_WaterBreathing' returned 11 spell entries.

If there's an issue with what spells are being chosen, the best place to discriminate would be in the command handler itself: https://github.com/EQEmu/Server/blob...mand.cpp#L3394


Bot command 'size' shows an example of how to discriminate arguments: https://github.com/EQEmu/Server/blob...mand.cpp#L3783


EDIT:

The spell system is designed to use the most level-appropriate spells available - which may not be what is desired in all cases.

An argument to force 'spirit' over 'scale' would probably be the best solution..though, you could completely exclude 'scale' from the spell load by 'continue'ing if its id matches.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #9  
Old 06-04-2016, 09:16 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Did that help?
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #10  
Old 06-05-2016, 07:27 PM
cannon
Hill Giant
 
Join Date: Dec 2004
Location: Pittsburgh, PA
Posts: 128
Default

Yes, Thank you.
Quote:
Originally Posted by Uleat View Post
Did that help?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 01:29 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3