Jump to content

Playerbot


Recommended Posts

@blueboy,

actually no errors, and have re-completed all the quests to make sure they work. Compiler would not complete with the original. Gave an error that 'spellId' was not declared. Thus game.lib wasnt created which caused the rest to fail.

so... not sure what to say. maybe someone else can try the code and see if it works for them.

if it's any prettier, this also works:

if ((item->GetProto()->Flags & ITEM_FLAG_LOOTABLE) && (spellId == 0))

I know that logically, expressions should be separated in parenthesis, which is why I scratched my head all morning trying to get it compiled.

No idea why it won't compile the initial way. Just tried it again and still the same declaration error.

anyway, I'll leave it alone til you get it pushed. Maybe im missing something?

**note**

My programming experience with c++ is limited, ive mostly worked with various scripting languages and am pretty much self taught. too old to worry about taking classes =P

While some principals are pretty common, I have to dig and work with trial and error in C++. I'll try to be more of a help than a hinderance =)

Link to comment
Share on other sites

  • Replies 799
  • Created
  • Last Reply

Top Posters In This Topic

Hi Gitch,

After the first patch, did you edit the code manually? I moved the code for the patch further on down below the declaration of spellId.

so we need the reposition the patch in the function UseItem() to check for possible spellId.

uint32 spellId = 0;

for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)

{

if (item->GetProto()->Spells[ i ].SpellId > 0)

{

spellId = item->GetProto()->Spells[ i ].SpellId;

break;

}

}

if ((item->GetProto()->Flags & ITEM_FLAG_LOOTABLE) && spellId == 0)

{

// Open quest item in inventory, containing related items (e.g Gnarlpine necklace, containing Tallonkai's Jewel)

WorldPacket* const packet = new WorldPacket(CMSG_OPEN_ITEM, 2);

*packet << item->GetBagSlot();

*packet << item->GetSlot();

m_bot->GetSession()->QueuePacket(packet); // queue the packet to get around race condition

return;

}

WorldPacket *packet = new WorldPacket(CMSG_USE_ITEM, 28);

*packet << bagIndex << slot << cast_count << spellId << item_guid

Sorry for any confusion I may have caused.

Link to comment
Share on other sites

@blueboy,

Yeah, after the first patch, I manually removed the first code, and added the new where you see it positioned in your post.

I'm going to chalk it up to something wierd on my end, it actually compiled this time. I'm just going to go bite the cat or something, I'll be back.

Link to comment
Share on other sites

I'm not sure about missing features, but populating battlegrounds and arenas with bots has been a big item on the wishlist. Such "PvPBots" have been attempted by others, and I think kennumen is tinkering with some code regarding this.

My thought was to have the bots be NPCs, similar to the way AuctionHouse Bot in the core uses an NPC. Set the server config to allow a minimum of one player, then call some function that then populates both sides of the combat with the correct number of bots per side, minus the number of actual players. Of course, this would require scripting some rather sophisticated AI for each race/class, but there's a solid foundation for that already in Playerbot. The downside is it would place quite an extra load on the server, even with optimizing the algorithms.

At the rate things are progressing, there may come a day when all I have to do is sit down with my coffee and watch the bots play for me! :lol:

Link to comment
Share on other sites

@UnkleNuke

Yeah, I've already had my sight on battlegrounds hehe. My server is already set up for 1v1 so when I get time I'd like to see what can be done. Would be interested in whats already done in that area as well.

the last server I put together (long time ago) I populated the battlegrounds with NPC's from each side, which had a respawn of like.. 25 seconds or maybe less. Basically it required the player(s) to navigate a battle that was going on, to get the enemy flag or defend theirs. I never got around to writing the scripts to make it more interesting like keeping them from taking the flag etc.

This code makes alot possible.

ATM there are some minor things Im wondering about:

for one, I'd like bots with professions to whisper their skill each time it goes up, or at the very least, report it with the 'skill' command. this would make e.g. herbalism a bit easier when gathering.

So ya dont go that extra distance for that nice little patch of strangekelp, and find out their skill is 1 point too low =P

From the todo list file in the root dir, it looks like the list is about done. wondered if there were other issues not listed there.

Link to comment
Share on other sites

Well, the TODO list is usually for those design goals foreseen being implemented in the near future. It is by no means an exhaustive list of possible improvements and new features. Really, the only limit to that is your imagination and skill.

By all means, please try making a patch for the skill command as you have proposed. It may be best to make it an optional switch that you can turn off. Some may find it annoying to have their bots reporting every single point gained. Otherwise, you could just have the auto-report set to only say when a bot has enough points in a skill to unlock a new ability, like harvesting Stranglekelp. "[bOTNAME] is now skilled enough to gather Stranglekelp!" This would also server as a helpful reminder to go find a profession trainer for your bot. ;)

I tried implementing battlegrounds in a manner similar to your own idea. I think for such a method to work well would require using ScriptDev2 to control the actions of the NPCs, much the same as dungeon NPCs and bosses are scripted. I'm not that familiar with the inner workings of ScriptDev2 and EventAI, so I have no idea if the battleground NPCs would "run on rails" or could be scripted with a decent degree of flexibility in their actions.

Playerbot's AI would allow that flexibility and also give the player the opportunity to direct battle by issuing commands. Perhaps the bots on your team would respond only to commands issued in BG chat. For example, you type into BG chat, "Follow me!", or use one of the preset emotes and all bots within a certain radius that are not engaged in combat would form up and follow you. When your group is in combat, you can issue specific orders by clicking to select the bot you wish.

Of course, I've said for quite some time that what Playerbot needs most is a UI addon to make giving orders as simple as a few clicks. The chaotic pace of battlegrounds and arenas would make that even more vital.

I'm hoping the day comes when I can make more significant contributions, but I'm still very much a novice struggling to find the time and brain cells to learn all this. This old dog wants to learn some new tricks! :lol:

By the way, aside from Ike's fork of Playerbot for PvP, I stumbled across Pocket Gnome at Github. It appears to have a rather good conditional AI. It's intended to be one of those many client bots, this one for Mac OS, but I thought it may offer some ideas on fleshing out the AI for Playerbot.

Link to comment
Share on other sites

Is there a particular method of getting your bots to follow you on say a hippogryph?

One bot does (first in group list) and other does not, but stays behind and I have to summon her.

Ideas?

***Edit***

This addition will report the bot's profession skill level. It will be included if you ask for 'skill' in either /t or /p .

I need to get my repo set up better.. and I'm still reading up on how to create patches.. soo.. if someone could lend some explaination I'd appreciate it.

if (m_bot->GetSkillValue(*it) <= rank[sSpellMgr.GetSpellRank(skillLine->spellId)] && m_bot->HasSpell(skillLine->spellId))

{

// DEBUG_LOG ("[PlayerbotAI]: HandleCommand - skill (%u)(%u)(%u):",skillLine->spellId, rank[sSpellMgr.GetSpellRank(skillLine->spellId)], m_bot->GetSkillValue(*it));

msg << "\\n" << m_bot->GetSkillValue(*it) << " / " << rank[sSpellMgr.GetSpellRank(skillLine->spellId)] << ": ";

MakeSpellLink(spellInfo, msg);

At approx. line 8837 in PlayerbotAI.cpp, I've inserted the code ( IN RED )for the skill report.

its output is basically like this:

59 /75: [professional tradeskill]

1 /75: [professional tradeskill]

I borrowed the idea from the Debug_log code on line 8836.

BTW : I used newline for personal preference, the separation makes the output easier on my poor eyesight.

If its preferred to be in one line, let me know.

Otherwise, you could just have the auto-report set to only say when a bot has enough points in a skill to unlock a new ability, like harvesting Stranglekelp. "[bOTNAME] is now skilled enough to gather Stranglekelp!" This would also server as a helpful reminder to go find a profession trainer for your bot.

@UnkleNuke

Hrm, good ideas. I'll take a look at it tomorrow.

Link to comment
Share on other sites

@Kennumen: I havent tried/looked at the autobot code yet, but want to when I get things more settled. Don't want to wind up with a mess on my end =)

@blueboy: Thanks for the links! I've got them bookmarked, along with a few other tidbits. In fact.. I have an Idea, *loud whirring noise, and a puff of smoke*

also, yeah, the bot had the cash, and was standing there with the other bot when I took off. Also had completed the quest (first ride). I just tried riding hippos on my GM account, and it worked ok.

I'll check to see whats up with that other char. It might not have taken the quest (its a draeni).

@UnkleNuke: Thanks! Spotting playerbot is what got my attention again. From looking through the posts, I'd say the 'team' is a fair size. It takes all the ideas and testing as well as coding!

Link to comment
Share on other sites

Hi Gitch,

Indeed, welcome aboard ;)

git pull [email protected]:blueboy/portal.git new-ai:master

I get permission denied (publickey)

Not surprising. I checked Github and you haven't yet got an account, or at least one with the user name 'Gitch'. You will need to create one (it's free) and you will create a 'key pair' in the process. Github recognises

[email protected]:blueboy

separated by a colon as collaborator (read/write) access. It will expect a valid 'pass phrase' associated with your 'public key' to access the online repos. Create your account and I will add you to the collaborators list.

git pull git://github.com/blueboy/portal.git new-ai:master

Will work for guest readonly access.

Hope this helps

Link to comment
Share on other sites

Hi Gitch,

I've added you to the collaborators list for 'portal'. You will now be able to create your own work space (branch) off the 'portal master', for your development work and push/pull code when you wish. If you have any questions, don't hesitate to ask.

Hope this helps

Link to comment
Share on other sites

Thanks Blueboy,

I'm having trouble with this script.. trying to set things up more orderly on my end.

#!/bin/bash -x

git clone git://github.com/mangos/mangos.git playerbot

cd playerbot

git fetch git://github.com/playerbot/mangos.git master:playerbot

git checkout playerbot

HASH=`git log --pretty=oneline | grep -m 1 '\\[1[0-9]\\{4\\}]' | cut -d " " -f 1`

git diff $HASH > playerbot.patch

i get an error saying -m is not an option for grep.

I copy/pasted it into Git.

how can I save it to file, what format, and what command to execute it in Git bash?

***Edit***

and then I'll leave you alone ;)

Actually, I'll just go with merging it. Wanted to figure out the prepared patch method.

What a way to spend a day off eh?

Final Edit *****

Got the creation of patches figured out, and my repo looks alot better.

thanks for your patience guys.

Link to comment
Share on other sites

Hi Gitch,

i get an error saying -m is not an option for grep.

No worries, I frequently get asked this question from windows users. The 'git-bash' shell contains an old version of grep.exe that does not have the '-m' option. Easily solved. Locate the folder holding the shell binaries. Then download from GNU (version 2.5.4 or greater) the updated binary & dependancies (libiconv2.dll,libintl3.dll,pcre3.dll & regex2.dll),

grep.exe update

Copy these to the binary folder and your running.

Hope this helps

Link to comment
Share on other sites

Hey blueboy, thanks for the reply!

That was bugging me =)

I have most of what i need figured out I think for now, except one thing I want to clarify:

the path of information .. as I understand it atm, is: local repo -> git sub branch -> portal -> main git..

Is that close?

And, if so, I am to pull from sub branch 'new-ai' and add my work to that, and push it back into a separate new sub branch (named by me)?

Thanks again for your patience, I don't want to get messed up (or mess anyone else up)

Link to comment
Share on other sites

Hi Gitch,

I understand, everyone is nervous about messing things up to begin with ;)

I would recommend you use the 'master' as the base code for your branch, rather than using a sub-branch like 'new-ai'. You can if you wish, merge 'new-ai' into this (git merge origin/new-ai). If you want to push to 'new-ai' that's fine (help below)...

It best the visualise a git repository like the trunk and branches of a tree. The trunk will be the 'master' and the branches come off this.

What you need to do is create a branch of your own (choose a name and replace 'new_branch_name')

1. Create a local repository for your code

git clone [email protected]:blueboy/portal.git new_branch_name

cd new_branch_name

2. Create a remote branch (new_branch_name) off the 'master'

git push origin origin:refs/heads/new_branch_name

3. Track your remote branch from your local branch

git checkout --track -b new_branch_name origin/new_branch_name

This will allow you to 'git push' or 'git pull' to & from your local repo, directly to your remote repo

:~/portal> git branch -a

* master

remotes/origin/HEAD -> origin/master

remotes/origin/autobot

remotes/origin/loot-fix-bt

remotes/origin/master

remotes/origin/new-ai

remotes/origin/sharedbots

remotes/origin/talentspec

Shows the current layout of the portal master and it's associated remote branches.

4. To merge one branch into another (e.g master into new_branch_name, after say a core update), inside new_branch_name

git merge origin/master

If there are no merge conflicts, a 'git status' or 'git log' should show that the merge was successful. If you do get conflicts then these will need to be addressed before the merge takes. I will discuss this with you later.

-----------------------------------------------------------

If you wish to add your code to an existing branch (e.g new-ai) follow the steps above. Omit step 2. and replace 'new_branch_name' with new-ai. You will then have a local repository 'new-ai' that can be used to update the remote 'new-ai' branch directly. The normal state for the local branch should be,

:~/portal> git status

# On branch master

nothing to commit (working directory clean)

You can now apply local patches to the code or manually edit the files. Once done, repeat 'git status' and you will be notified which files have been modified.

To commit the changes (example)

git add /src/game/playerbot/PlayerbotAI.cpp

git add /src/game/playerbot/PlayerbotAI.h

etc..

repeat for all modified files. Once done, you need to finalise the commit prior to pushing

git commit -a -m "This is a decription of my commit"

Then 'git log' should preview what the commit description will look like online. If you're happy :D

git push

If not, and wish to edit the commit

git commit --amend

Will open the commit header description, with your default editor. Edit the description and save, then 'git push'

To Remove an unpushed commit altogether from your local repo, should things go pear shaped. (Remember: Once you push, it is nigh impossible to remove your commit, so carefully consider what your pushing).

git rebase -i HEAD~2

Your editor will open allowing you to change things (follow the instructions)

To set default editor ("notepad" or your preferred editor should be in the directory path)

git config --global core.editor "notepad"

That more than enough for the moment :o

Hope this helps

Link to comment
Share on other sites

wow...

Now thats a sticky if I ever saw one....

Thanks a ton!

I had alot of those pieces floating around in my head already (from all the reading) but you just put them together nicely!

In other words, it makes sense now =)

...well.. mostly haha.

I'll yell if I run into any trouble.

Again, thanks alot!

Link to comment
Share on other sites

Hi Blueboy and everyone developing playerbots.

I have been making wow private servers for years now and I just want to give you all my thanks.

The playerbots being developed here are the most comprehensive ones out there and because of you guys they are continuing to get better.

After moving to cata mid last year, I have decided to came back to 335 after missing these bots too much. They really are the heart of many private servers.

Great job guys, keep it up.

Link to comment
Share on other sites

blueboy can u implement some configs in mangos.conf... for example

1. to have a config through witch u can allow 0(players),1(GM rank 1+) to summon the bot from any account

- limit in this way a user to use someone else bot, or to be more specific to use a bot from a different account than his account

2. create a table with permssions similary to account table, in which u can set witch account can use playerbot

Thank you

Link to comment
Share on other sites

Updated new branch "skillbot"

When using the command /t skill or /p skill , the bot will also report their current/max skill for each proffesion, as well as weapon skills.

My main thought behind this was not really for keeping up with what bots need to go train, but for keeping up with which bots need to raise what skill.

Patch:

diff --git a/src/game/playerbot/playerbotai.cpp b/src/game/playerbot/playerbotai.cpp index 3bf733c..c3edde4 100644 --- a/src/game/playerbot/playerbotai.cpp +++ b/src/game/playerbot/playerbotai.cpp @@ -8823,6 +8823,7 @@ void PlayerbotAI::_HandleCommandSkill(std::string &text, Player &fromPlayer)                          if (m_bot->GetSkillValue(*it) <= rank[sSpellMgr.GetSpellRank(skillLine->spellId)] && m_bot->HasSpell(skillLine->spellId))                          {                              // DEBUG_LOG ("[PlayerbotAI]: HandleCommand - skill (%u)(%u)(%u):",skillLine->spellId, rank[sSpellMgr.GetSpellRank(skillLine->spellId)], m_bot->GetSkillValue(*it)); +                            msg << "\\n[" << m_bot->GetSkillValue(*it) << " / " << rank[sSpellMgr.GetSpellRank(skillLine->spellId)] << "]: ";                              MakeSpellLink(spellInfo, msg);                              break;                          }

considered adding a reminder to train.. but still thinking on that. If its done each time the bot uses that skill (and needs trained) it would get annoying.. If its done along with the above.. well.. since you typed 'skill' and see the current/max skill levels.. you'll already know they need trained, or not.

If you'd rather see it in 1 line rather than 2, im open to suggestions.

@Rossage: Welcome back!

Link to comment
Share on other sites

blueboy can u implement some configs in mangos.conf... for example

1. to have a config through witch u can allow 0(players),1(GM rank 1+) to summon the bot from any account

- limit in this way a user to use someone else bot, or to be more specific to use a bot from a different account than his account

2. create a table with permssions similary to account table, in which u can set witch account can use playerbot

Thank you

Already created by BThallid: try the sharedbots branch:

https://github.com/blueboy/portal/tree/sharedbots

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