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

Development::Bots Forum for bots.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-29-2010, 02:27 AM
lich2594
Sarnak
 
Join Date: Jun 2006
Location: Tennessee, USA
Posts: 77
Default Bot spells...?

I am new to using bots on our server, and I was wondering about the spells they currently use... I was under the impression that the bots would use the spells under the 700'ish category... but they don't?... or do they?

The reason I ask is because the enchanters cast a spell that is not listed under the enchanter bot spell list, Euphoria, when using the command #bot ai mez. Am I mistaken on the spells, or is this set in source code? I checked the code, and only see the call for it, nothing to do with the spell... but I may have over-looked it.

Can someone shed some light on this? This isn't the only issue I have with the bots not casting custom spells, but this is a start in the right direction.
__________________
Reply With Quote
  #2  
Old 08-29-2010, 09:33 AM
bad_captain
Developer
 
Join Date: Feb 2009
Location: Cincinnati, OH
Posts: 512
Default

A lot of the bot commands have hard coded spells that they use depending on level, etc. The bots usually don't have those same spells in their spell lists (or they would try to cast them when they shouldn't). Check in bots.cpp to find the commands for mez, resist buffs, cures, etc. For mez, specifically, the command calls Bot::MesmerizeTarget(Mob* target) which has the spell ids for the mez spells.
Reply With Quote
  #3  
Old 08-29-2010, 02:37 PM
lich2594
Sarnak
 
Join Date: Jun 2006
Location: Tennessee, USA
Posts: 77
Default

Yeah, I did a little more digging last night and see that it loads spells in order by level and mana consumption, directly from the... That's as far as I could see, from the functions. What I want to know is if it is loading spells from the spells_new table, npc_spells, or a bot table?

It's a lot of code to back track through to find what I am looking for, but I may just have to do that. I was just hoping that someone already knew.

My logic is that, if it is loading directly from the spells_new table, then why is their spell sets for the bots? Is the list just obsolete now? Also, if it is loading spells directly from the spells table, shouldn't it automatically use the newest spells that I have created? It just leads me on to more and more questions.

Thanks for your input.
__________________
Reply With Quote
  #4  
Old 08-29-2010, 06:36 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default

I believe the bot lists are hardcoded (?!) to use certain spell list IDs in the 700's. Correct me if i'm wrong though, I haven't touched that code in forever.

It should be in latest PEQ as Bot Enchanter Spell List for example, under npc_spells.

You should be able to add more to the hardcoded lists and they will pick it up. Bots are only coded to know what to do on certain spelltypes though. You'll have to code any custom spelltypes into bots. Their logic is similar, though a bit advanced to NPC Spell logic, and it should be fairly easy to port some stuff into the bot AI logic that isn't present from NPC AI logic.

Also, I didn't bother putting a debugger on them but there's a ton of bot crashes still. I would advise you don't use them unless you are an advanced developer who can fix the bots. Either that or if you are feeling brave, make them a friend class of client.
Reply With Quote
  #5  
Old 08-29-2010, 06:42 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default

It also seems like a lot of the mezzing spells are hardcoded, I assume the same for Enduring Breath spells, etc.

Take this example code for mezzing an NPC:

Code:
bool Bot::MesmerizeTarget(Mob* target) {
	bool Result = false;

	if(target) {
		int mezid = 0;
		int mezlevel = GetLevel();

		if(mezlevel >= 69) {
			mezid = 5520;
		}
		else if(mezlevel == 68) {
			mezid = 8035;
		}
		else if(mezlevel == 67) {
			mezid = 5503;
		}
		else if(mezlevel >= 64) {
			mezid = 3358;
		}
		else if(mezlevel == 63) {
			mezid = 3354;
		}
		else if(mezlevel >= 61) {
			mezid = 3341;
		}
		else if(mezlevel == 60) {
			mezid = 2120;
		}
		else if(mezlevel == 59) {
			mezid = 1692;
		}
		else if(mezlevel >= 54) {
			mezid = 1691;
		}
		else if(mezlevel >= 47) {
			mezid = 190;
		}
		else if(mezlevel >= 30) {
			mezid = 188;
		}
		else if(mezlevel >= 13) {
			mezid = 187;
		}
		else if(mezlevel >= 2) {
			mezid = 292;
		}
		if(mezid > 0) {
			int32 DontRootMeBeforeTime = 0;
			CastSpell(mezid, target->GetID(), 1, -1, -1, &DontRootMeBeforeTime);
			target->SetDontRootMeBefore(DontRootMeBeforeTime);
			Result = true;
		}
	}

	return Result;
}
So yeah, it is level-dependant and somewhat hardcoded as I thought. The spell lists only apply to the AI logic, not a bot command.

What it seems like is that you are going to have to either: Check the spell array on zone bootup, load the bots' spells into memory that is the best spell for them for each level, then just reference the memory every time you cast a spell.

Or: Change the hardcoded spells. Not as flexible but it works.
Reply With Quote
  #6  
Old 08-29-2010, 07:33 PM
lich2594
Sarnak
 
Join Date: Jun 2006
Location: Tennessee, USA
Posts: 77
Default

Thanks (again) for posting. That's what I expected, that it's hard-coded. I started wondering about this after I had created a replica of the Euphoria spell (ID 5520), but the bot wouldn't cast it at all.

I used the enchanter as a reference to my issue, but it does revolve around all function calls like this one (Bot::MesmerizeTarget). The enchanters, druids, ect ect.

Like I was telling you before, I will play around with it (and that I wasn't sure of how it was coded completely yet). I think that it should work a little differently, like search through like the cleric's healing spells do to select the best heal for the job. I believe that it should sort by something like this: level of spell -> mana consumption -> specific spell type (in this case, mez). Then use spell ID that is the highest level spell (unless mana is too low for the spell, then use the next rank down IF mob is within the level range of the spell).

There would need to be checks, just like that of the code that is already in the source... but a more friendly version that would allow a non-programmer to simply add in spells for their custom content (into the bot's primary spell set).
__________________
Reply With Quote
  #7  
Old 08-29-2010, 11:24 PM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

i am curious why can't bots just use npc spell lists for classes.

As far as i see npcs are fairly successful at spell casting... they do occasionally have tendency to overcast redundant spells, but this could be general improvement in AI spell casting
Reply With Quote
  #8  
Old 08-30-2010, 01:13 AM
lich2594
Sarnak
 
Join Date: Jun 2006
Location: Tennessee, USA
Posts: 77
Default

As secrets pointed out, the bot code is more advanced than the NPC's. The problem here, that I am having and that many others will have in the future once content progresses (as a norm), is that when using hard-coded spells like this... you will have to go in and change this every time there is an expansion (or new spells added). Instead of this system, I believe that there can be something more easily accessible to those who don't know how to code.

I am going to see if I can get something working soon, I just have to finish my current project on my server first. :P
__________________
Reply With Quote
  #9  
Old 08-30-2010, 01:24 AM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

thats exactly why bot spells should be in DB , in a structure similar to npc spells, so you don't have to mess with the source every time you need to tune up a spell =)
so instead of having a hard-coded AI for bot spell casting, the AI should be universal to be able to take ANY spell as input by type, and act accordingly - universal for both npcs and bots.

yeah i know its not easy, but its a direction worth investing in.
Reply With Quote
  #10  
Old 08-30-2010, 04:17 AM
lich2594
Sarnak
 
Join Date: Jun 2006
Location: Tennessee, USA
Posts: 77
Default

Yeah, it should solely be like that... but it's not atm (lol). Right now the bots use two sets of spells... one predefined, and also the spells listed under NPC spells (700'ish). Most bots will cast spells from the spells set table, but some, will cast spells from this hard-coded method. It's mostly the function calls, like I have been discussing... I want to simply put those to source through the list, kind of like the cleric bots already do. (From what I can tell.)

I am almost finished with my project, so I should be able to see what I can get going in a few days. I hope all goes well!
__________________
Reply With Quote
  #11  
Old 08-30-2010, 05:07 PM
lich2594
Sarnak
 
Join Date: Jun 2006
Location: Tennessee, USA
Posts: 77
Default

Just an update, I started working on this code today and decided that it would be easier/faster (for me) to code in the additional spells for the bots, instead of recoding the current code... Since we only have a few functions that aren't working properly, it would just be more simple to hard-code our custom stuff in too... (Also, like putting in SoE for druids ect)

I have been thinking about this for a few days now, and it probably won't be as beneficial to recode the system, since it's not that hard to update it. However, it will be hard for those who don't know anything about coding...
__________________
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 09:25 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