Jump to content

Playerbot (archive)


Recommended Posts

@sirzufall: what exactly do you mean by 'more' bots and more 'stable' I just got one crash in the last week and it was about the changings in LockedQueue - which is fixed by now. Maybe you could provide stack dumps? On Linux you can enable core dumps with 'ulimit -c unlimited'. The win32 version should provide stack traces by itself.

Here we go, ppl! Did a bit of work the last days. So here's my update so far:

ChangeLog:

- added new function to handle quest turn ins of bots

- added support for quest giving gameobjects

- reimplemented call to HandleMasterIncomingPacket (emotes and quest stuff works again)

What it means:

There are many gameobjects like chests which are crucial for quests. They complete a part of a quest line and start another part. Those objects now can be used by bots. This will lead me to make lootable gameobjects usable to bots. Think this will be in my nextr patch. Last thing would be giving bots exact orders which usable gameobject to use. This would be important in i.e. Uldaman at Archaedas Hall

Have fun folks

Link to comment
Share on other sites

  • Replies 1.8k
  • Created
  • Last Reply

Top Posters In This Topic

@runsttren et all

i believe i have worked out the implementation of rogue opening maneuver, but it requires some significant changes to the way combat and movement is handled in playerbotai

here is a patch against the latest playerbot http://pastebin.com/m39da6cc

in this patch:

- moved function call playerbotai::Docombatmovement to each class specfic function (for example playerbotrogueai::Donextcombatmaneuver)

- implemented bot initializing attack your target when you whisper to it "attack"

- rogue opening maneuver: bot cast stealth, moves to combat range, then casts cheapshot

im still working on other maneuvers, please test if you want

Link to comment
Share on other sites

heres a snip of my warrior charge opener attempt:

void PlayerbotWarriorAI::DoNextCombatManeuver(Unit *pTarget)
{
   PlayerbotAI* ai = GetAI();
   if (!ai)
       return;

   // Damage Attacks

   Player *m_bot = GetPlayerBot();
   Unit* pVictim = pTarget->getVictim();
   m_bot->SetInFront(pTarget);
   float targetDist = m_bot->GetDistance(pTarget), x, y, z;

   ai->MovementClear();

   m_bot->Attack(pTarget, true);    

   if (targetDist>=8.0f && targetDist<=25.0f)
   {
       pTarget->GetPosition(x,y,z);
       if (!m_bot->HasAura(BATTLE_STANCE, 0))
           ai->CastSpell(BATTLE_STANCE, *m_bot);

       if(CHARGE > 0)
           ai->CastSpell (CHARGE)

       return;
   }

what works: bot casts charge on target if in range, or moves within range then casts

what doesn't: bot location is not updated so what happens is spell is cast successfully, with animation and effect on mob, but bot has not moved from coord where charge was initialized.. i've tried calling playerbotai::MovementUpdate() to try refreshing position but no change

thought: how is spell (charge) handled in mangos, does it require another function like relocate() or monstermove() to work?

Link to comment
Share on other sites

Player Pingu is being teleported to map 0

../../../src/game/Map.h:457 in getNGrid ASSERTION FAILED:
 x < MAX_NUMBER_OF_GRIDS
./mangos-worldd(_ZN3Map17EnsureGridCreatedERK9CoordPairILj64EE+0x24) [0x8201b04]
./mangos-worldd(_ZNK3Map9GetHeightEfffb+0x7e) [0x8203d4e]
./mangos-worldd(_ZNK11WorldObject21UpdateGroundPositionZEffRf+0x3e) [0x822767e]
./mangos-worldd(_ZNK11WorldObject12GetNearPointEPKS_RfS2_S2_fff+0x47f) [0x822a92f]
./mangos-worldd(_ZN25TargetedMovementGeneratorI6PlayerE18_setTargetLocationERS0_+0x15f) [0x835c92f]
./mangos-worldd(_ZN12MotionMaster6MutateEP17MovementGenerator+0x4d) [0x821929d]
./mangos-worldd(_ZN11PlayerbotAI13MovementResetEv+0xd9) [0x82d13a9]
./mangos-worldd(_ZN11PlayerbotAIC1EP12PlayerbotMgrP6Player+0xf1) [0x82d1511]
./mangos-worldd(_ZN12PlayerbotMgr10OnBotLoginEP6Player+0x2d) [0x82cd48d]
./mangos-worldd(_ZN6MaNGOS15_IQueryCallbackINS_9_CallbackI16CharacterHandlerP11QueryResultP14SqlQueryHoldervvEEE7ExecuteEv+0x2b) [0x83d103b]
./mangos-worldd(_ZN14SqlResultQueue6UpdateEv+0x1f) [0x8429b1f]
./mangos-worldd(_ZN5World6UpdateEj+0x20c) [0x839926c]
./mangos-worldd(_ZN13WorldRunnable3runEv+0xb8) [0x811c5f8]
./mangos-worldd(_ZN9ACE_Based6Thread10ThreadTaskEPv+0x1a) [0x8430a5a]
/opt/mangos/lib/libACE-5.6.6.so(_ZN21ACE_OS_Thread_Adapter6invokeEv+0x6e) [0xb7edf18e]
/opt/mangos/lib/libACE-5.6.6.so(ace_thread_adapter+0x11) [0xb7e88f01]
/lib/libpthread.so.0 [0xb7790f3b]
/lib/libc.so.6(clone+0x5e) [0xb75f5bee]
V
mangos-worldd: ../../../src/game/Map.h:457: NGridType* Map::getNGrid(uint32, uint32) const: Assertion `"x < MAX_NUMBER_OF_GRIDS" &&0' failed.
Aborted (core dumped)

Mangos crashed with this error.

Link to comment
Share on other sites

@illustri: What you are showing me looks good.But, I can't see the benefits of calling DoCombatMovement() from within the class AI. The combat flow was:

a) Get a target, or change a target if needed (i.e. by combat order protect, or by use the point emote on a target - quiet the same as what you do by whisper attack to your bot)

b) Set movement by movement orders (chase/follow in distance or stay until target is near)

c) Do sanity checks to prevent crashes, clear target if it died or disappeared for whatever reasons

d) Call class AI's DoNextCombatManeuver()

If I got right what you tried to do is to override the movement stuff if you got a new target - and of course eventually do an opening move like charge or go to stealth. I think implementation would be easier and more logical, if you hook this into point a). Maybe this way:

a) Add a flag called something like m_changedTarget to PlayerbotAI. In GetCombatTarget set this flag, if you change the target (could be forced, by assist or by just getting a target out of the list of attackers).

b) in PlayerbotAI::DoNextCombatManeuver() between the calls to GetCombatTarget and DoCombatMovement add something like this:

if( m_changedTarget )
{
   if (GetClassAI())
       (GetClassAI())->DoOpeningCombatManeuver( m_targetCombat );
   m_changedTarget = false;
}

The DoOpeningCombatManeuver should set the movement generator if it does any opening moves. This way you could activate stealth mode just after selecting a new target and also set movement generator to chase the target in its back, or for a warrior cast charge or if you not have the highest threat and are on tank mode you could cast Taunt.

And for the flag. Maybe if you consider to do it this way you can implement a PlayerbotAI::m_targetType to be able to remember why we picked this target. The enum could have values like NORMAL, ASSIST, PROTECT. Then in the opening move you could cast something making big threat if it was set to PROTECT. Think this variable should only set when changing a target.

Also the changes in DoCombatMovement() itself are not getting through to my mind. Did they fix the Chase Movement Generator to ignore the relative angle to the target if you only specify the distance? Otherwise you will encounter the problem that your hunter runs 20 yards north of the target... this was driving me crazy at the time I tried to fix it :D

Let me know what you think about it :)

@sirzufall: My question should be where in all Azeroth you teleported to? Was this in Northrend? Seems you teleported out of the allowed grids :) Ending up in dead space. But this seems to be some kind of core problem, if any. Maybe the max allowed grid constant is not properly set yet, cause of the changes in the addon... perhaps this disappears with my next merge.

Link to comment
Share on other sites

@Runsttren

thank you for looking over my changes, i appreciate your input especially since i have little experience coding other than as a side interest

i'll keep your points a & b in mind as i play around more... here was my initial reasoning for moving the docombatmovement: i wanted to limit movements of casting classes: mage, lock, priest for example... so as soon as they were in combat and in range of action they begin casting spells instead of moving everytime master moved -- which was my experience when docombatmovement was called in playerbotai for all bots,

also i would be able to specify hybrid class movement based on spell sequence, for example paladin, druid, shaman casting group healing spells doesn't need to chase a target while healing

on your second question about the changes in docombatmovement... i have to admit i haven't tested that completely, i merely looked at the movechase function and saw i could enter in a distance value, certainly it doesn't seem to account for terrain either, and i can forsee a bot moving into the ground or a wall because of it, i'll work on that too

on other news i think i've had some success implementing warrior charge and rogue cheapshot opener, can see it on my repository at: http://github.com/illustri/mangos/commits/illustri , i'll try to make a patch against playerbot soon

Link to comment
Share on other sites

here is the patch against playerbot master

http://pastebin.com/m5dc29604

includes rogue cheapshot and warrior charge opener implementation

Thx for the patch illustri! Will integrate your code into playerbot.

And for the combat movement issue I have to review my original code I think. It's not just a problem for healers. Every spell with a casting time should stop the movement - otherwise spells would be cancelled. This could be solved by calling PlayerbotAI::MovementReset() - AI of bot is suspended as long as a spell needs to be cast. After bot resumes action it would automatically call DoCombatMovement in combat situation. Will check this out and make proper changes to the code :)

Have fun

Link to comment
Share on other sites

@Illustri: is it possible you missed the warrior stuff in your patch file on postbin? Anyway, implemented everything I could get out of your patch. But, I more or less directly tried to improve things having the earlier suggestions in mind...

Well, ready or not here come the updates!

Changelog:

- PlayerbotAI::CastSpell now stops movement

- added virtual PlayerbotClassAI::DoFirstCombatManeuver

- implemented opening moves for rogue and warrior (thx illustri)

- and of course some other changes/fixes I do not remember anymore

What it does:

As mentioned earlier bots doing mostly spells (i.e. proest, mage) will start to go to follow-the-master mode in combat. If master is the tank or anything else heavily involved in melee bud-kicking, those bots would try to follow the master even if they cast a spell right now. This problem should be solved by stopping all movement when starting to cast a spell.

Next was implementing the opening move stuff. GetCombatTarget now sets m_targetChanged and m_targetType. As long as m_targetChanged is set true, PlayerbotAI will call PlayerClassAI:: DoFirstCombatManeuver() which should return false, when the opening move sequence is done and true if there are things to come. For now DoCombatMovement is called between DoFirst and DoNext every update cycle. I.e. Rogue is going stealth, ending the opening moves. Rogue's DoNext now has a SpellSequence for stealth moves.

And I also started to rewrite WarriorAI to use the more clean way of coding like done in RogueAI (and please do not remove the TellMaster calls, they are only done when DebugWhisper is turned on. I still have to add more moves (especially for berserker stance), but I managed to implement the tank combat order. Warrior will now go to defense mode and then use the defensive spell sequence. Still have to add a way to decide if I should use battle or berserker stance (maybe I by getting the talent point weights?!?!)

Any questions?

Erm... and everybody is more then welcome to rewrite other AIs to adapt the style in RogueAI and WarriorAI.

That's it ppl!

Have fun!

Link to comment
Share on other sites

@Runsttren

is it possible you missed the warrior stuff in your patch file on postbin?

very possible, i'm just beginning to learn distributed programming and git in particular, i probably didn't include a commit or something

thanks for the help and your efforts also, its a great learning project

*update*

i've compiled from playerbot master but the bot behavior has not been as expected:

- rogue enters stealth but makes no movement toward target

- warrior casts charge but its location is not updated (probably due to missing relocate() in my pastebin patch)

-working as intended are range/casters stopping on spellcast, though i'd prefer them not moving while in pve at all (as it is now they resume following master on spell cooldown)

i'll continue playing around and forking from master, but if anyone has a different experience please let me know

Link to comment
Share on other sites

good to know bout the bugs. the missing relocate is of interest. could you post the line of code? I tested rogue. It really seems on first /point it just goes to stealth, after second /point it will sneak up its target. I will debug this asap, but I can not imageine why this happens. DoFirst returns false - ending the opening moves. After this DoCombatMovement is called. Rogue is melee class and should immediately start chasing its target.

As for the range class maybe it would be a good idea to remove the ai->SetMovementOrder call within ClassAIs (as seen in PlayerbotPriestAI.cpp:130). In hunter class I removed it and set hunter to ranged combat class. It now just moves into shooting range. Hope I can workout something for mages, warlocks, priest. Mages and warlocks normally should behave like hunter and just move in spell range, this would be an easy change. But for proest I temporarily have to change the combat target to the one I have to heal and call do combat movement, after this restore original combat target. This should make the priest move into spell range to heal a friendly target. But I should consider rules for what happens if a group member is to far away from priest, it could happen a proest runs into more and more foes while trying to help a friend.

Tip: make yourself some macros for the following emotes:

/point - all bots will attack selected target

/wave - selected bot or all bots will follow the master

/stand - selected bot or all bots will stand where they are

Got my macros attached to my action bars. Making combat organization much easier :) And allows pulling tactics.

Link to comment
Share on other sites

for warrior this was the only way i was able to get charge working:


float x,y,z;

   [b]if[/b] (targetDist[b]>=[/b][color=#009999]8.0f[/color] [b]&&[/b] targetDist[b]<=[/b][color=#009999]25.0f[/color])
   {
       pTarget[b]->[/b]GetPosition(x,y,z);
       [b]if[/b] (m_bot[b]->[/b]HasAura(BATTLE_STANCE, [color=#009999]0[/color]))
       {
           [b]if[/b] (CHARGE[b]>[/b][color=#009999]0[/color] [b]&&[/b]    ai[b]->[/b]CastSpell(CHARGE))
               [b]return[/b];
           m_bot[b]->[/b]Relocate(x,y,z);
       }
       [b]else[/b]
       {
           ai[b]->[/b]CastSpell(BATTLE_STANCE, [b]*[/b]m_bot);
           [b]return[/b];
       }
   }

   [b]if[/b] (targetDist[b]>[/b]ATTACK_DISTANCE)
   {
       ai[b]->[/b]DoCombatMovement();
       [b]return[/b];
   }

the problem is there is no check for spell success, so that even on charge fail the relocate function is called...

Link to comment
Share on other sites

@Marry521

DKbot cause mangos and computer freeze

Hi marry. What action do you perform just before mangos freeze? Are you just summoning the bot? What I wonder is that mangos does not crash the normal way. Seems there is a dead lock somewhere. Can you provide more info? Like how is your game environment set up? Server and Client on same machine?

@All: Next update

ChangeLog:

- made warrior's charge work right

- defined some more functions as constant methods

- added PlayerbotAI::GetCurrentTarget()

- HunterAI now also uses the debug whisper config var

- removed SetMovementOrder calls from Mage and Warlock

- added SetInFront call to WarlockAI

- changed the way stealth aura is removed for Rogues

What it does:

To make the charge work right I first looked into MaNGOS what happens when charge spell is cast. On some point it calls Spell::EffectCharge() - this one calcs the contact point of attacker and victim and sends a SMSG_MONSTER_MOVE to the player. First I tried to do it in PlayerbotAI::HandleBotOutgoingPackets, cause if this worked also other spells with effects which relocate a player would work out of the box. But! The core also sends this packet to a player/bot if he moves normally. Means SMSG_MONSTER_MOVE is indirectly used as a confirm packet for movement send from client to server. Now I just copied the contact point part from the spell effect and added it right after casting charge. Works fine for me.

The rogue-stealth-and-run-problem still exists. Pointing twice on a target makes the bot start movement. The weird thing is that the movement generator exists and is updated. But something blocks the actual movement when stealth is cast. Will investigate more.

The other stuff in this commit is just for some playability with range classes. Mage and warlock now do it the same way as hunters and follow their combat target in some distance.

Todo (now):

- Have to debug the MovementGenerators more indepth to find the problem with stealth

- Will create a deathknight and a warlock to address mentioned problems

Todo (future):

- find a way to make bots interact with non-questgiving game objects like chests or triggers

- make it possible to use need/greed rolls with bots - master looting is to time consuming

- rewrite bot movement to not use monster movement generators anymore. They were not designed for this. Instead I will have to write code to make the bot 'see' its near environment and act on this correctly. Hopefully my quake2 bot coding days are not to far in the past to remember how to make a bot strafe a target...

Have fun ppl

Link to comment
Share on other sites

on rogue combat movement, the first /point calls dofirstcombatmaneuver() as expected, but immediately after it seems the bot loses its target, i think m_targetcombat must have been cleared somewhere before another call of docombatmaneuver

for warrior the charge movement from relocate() is working, however the charge spell is not actually being cast if you notice, this was the same problem i ran into

ai->CastSpell(CHARGE,*pTarget) seems to be skipped or interrupted because there is no animation, and no stun effect, and in debug there is no record of charge cast

the way i got it somewhat working was to call castspell(charge) intially, return, and on next aiupdate call relocate(), that was the only way charge was cast at all

Link to comment
Share on other sites

@illustri: thx for the info with charge. will add second cycle to dofirst for relocate after charge. and the rogue is not loosing it's target nor loosing the movement generator. if you pull the target near the rogue it starts to attack.

@marry521: okay... got my deathknight. summoned it as bot. the behaviour is strange in combat to say the least. but freezing my server and/or client? nope, that doesn't happen at all...

Link to comment
Share on other sites

here is a fix for rogue behavior i've made on latest playerbot

http://pastebin.com/m1d61798

changed:

- "m_bot->Attack(m_targetCombat, false)" is required for rogue to cast opening move before melee combat

- additional cycles for dofirstcombatmaneuver for rogue

- conditions for melee combatmovement simplified, i think thats was stopping rogue initial movement

Link to comment
Share on other sites

Pls.....fix the playerbot.....crash my mangos....

My process...

get playerbot from git://github.com/illustri/mangos.git

>>>git pull git://github.com/mangos/mangos.git

>>>git pull git://github.com/Diablox/mangos.git autobroadcast

+scriptdev2 from git://github.com/scriptdev2/scriptdev2.git

My core crash in instance into instances....bots as die...and more....

Pls help me

Link to comment
Share on other sites

@Runsttren

here is a patch rewriting all class ai to style in rogue and warrior

note: this is just a straight conversion, builds fine but actual cast orders tweaking may be required

http://pastebin.ca/1595330

enjoy

How to apply this pach?

========================

I've just noticed that the crash occurs when the bots try to teleport when they

dead ... ex:

they die in one place and I'll go another map .... there when they try to

then killed the server is crashed

Have some fix for that or everyone else is having the same problem?

Link to comment
Share on other sites

Ok... found it. Seems someone updated ACE and modified the LockedQueue stuff since last merge (before mine). There is indeed no empty() anymore, regardless of what VS9 and IntelliSense think. Packets are pulled by next(packet) and then deleted. Will update playerbot code in WorldSession.cpp asap and push it to repos.

sorry, that was my push. at the time i was only checking in on this thread sporadically and also went from playing WoW alot to not so much. that fix was cherry picked from this thread and not fully tested. however, i only have myself to blame :( ...anyway great to see you back Runsttren! :D

@sickofitall - playerbot works fine on rev_8620

@leomkyll - plz, post the crash log or tell us which bot(if any) is responsible for the crash.

EDIT: updated playerbot branch to 3.2.2a :D

thx to everyone on mangos team that make this switch possible.

special thanks to TOM_RUS, VladimirMangos, balrok, arrai

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use