Seravy

Server side AI command : @autopilot

Recommended Posts

Posted (edited)

This seems to be a more appropriate place so continuing here from

@autopilot is a server side AI implementation that can control player characters. The primary goal is to replace human players for any reason : perhaps you installed a server on your own computer and have no other players, or your server has too low population or a critical class for the party isn't available. Either way, this allows you to add characters to your party without having a human player available. Note that this isn't a bot : it might get stuck in a corner if left alone with no human to lead the party. Also note this is server side : you have to be the server owner and capable of modifying your source to add it.

Obviously an AI isn't a human player, which means better reaction time, and no "I have to go 5 minutes afk sorry" during boss fights but at the price of not being able to judge more advanced situations correctly. Overall I'd say the AI will play better than a typical player but will fail at anything more complex than "use this skill when <condition>".

All the current progress is available here : https://github.com/SeravySensei/rathena/commits/Autopilot

To install, make a branch for the feature in your local repository, pull from the linked branch, then use or merge it as you prefer. I strongly recommend reading through the comments in the code : every skill has hardcoded AI and there are a few cases where my server uses nonstandard parameters for skills. These are mentioned in the comments, usually explaining how it is different from normal and what's recommended to change in the code if you are using default skills. Finally, enable all the added commands in your groups.conf file.

Currently implemented :

All 1st classes, 2nd/rebirth classes. Regular Homunculus. Archbishop.

Awaiting implementation :

  • -Homunculus S
  • -3rd jobs
  • -Summoner

How to use :

@autopilot Tank enables tanking mode, the AI will try to engage enemies in melee and use melee skills.

@autopilot Skill enables the AI to use ranged attacks or ranged skills, in general this is the DPS mode

@autopilot Support restricts the AI to using support skills only.

@autopilothom with same parameters : same modes for the Homunculus.

There are a few other commands for enabling "extras" such as telling the AI to use a song or dance or other special skill or use sp potions. You should see them in the atcommands file(s).

It's old but here is a recording that shows the AI in action :

 

 

Edited by Seravy
  • Upvote 4
  • Love 5

Share this post


Link to post
Share on other sites

Latest update : @autopilothom command, homunculus can now use normal attacks and move. (this overrides client side AI if enabled)

Homunculus skills not yet implemented. AI will not use Rest or Call Homunculus, but will use Resurrect Homunculus if the homunculus dies.

 

Today has been fairly productive, normal Homunculus skill AI is done and pushed to the branch.

Attack skills will be used whenever possible. Might add some fine tuning to conserve SP like on player skills later, at the moment I don't know how abundant homunculus SP is. Buffs will be used whenever possible but battle buffs will be limited only when at least one enemy is nearby because they typically have very long cooldowns. This is far from ideal but should do for now. Later it might be worth adding more conditions like only using these if at least one nearby enemy is stronger than a certain threshold. Healing skills will be used when possible targets are at low health. Chaotic Blessings is limited to be used at level 5 only and never if an enemy is nearby. Caprice is random element so it doesn't do the usual check for enemy element. Might be worth excluding Holy in a future update. The AI will never use Castling, SRB44 and Self Destruction due to their cost/potentially unwanted effect. These are better left for manual use. Homunculus S skills are not implemented yet, I'll probably do those together with 3rd job (genetic) skills.

  • Upvote 1

Share this post


Link to post
Share on other sites

Nice idea !

I have some remarks :

- First, you should look into autotrade in order to be able to close your client with autopilot still on. I think you just have to remove connection link with client (sd->fd = 0) or maybe just a bit more...

- Currently it's only a matter of rules right? Like homunculus. No "real" AI is involved into your system (machine learning etc), isn't it?

- Then you should better propose a .diff or a patch in your git (instead of a whole emulator)

Share this post


Link to post
Share on other sites

I don't want to close the client. Sometimes you do need to take manual action, like switch equipment (especially if monsters break it), talk to an NPC to enter a map, trade items between characters when overweight, etc.

Yes, it's just a matter of rules, no real AI. I'm trying my best to make the rules as smart as possible.

No idea how to do that patch/diff thing. Yes, it would probably be more convenient to the users although they'd still need to fix merge conflicts if any shows up.

 

Share this post


Link to post
Share on other sites
Posted (edited)

Added the Taekwon class skills.

Sprint will only be used to activate the Spurt status. There is almost never a need to move a large distance in a straight line for the AI.

Leap will not be used. Going to the other side of an obstacle will only break the party up.

Stances will always be kept active. The corresponding moves will be used when triggered. Tumbling will be kept active as well. I don't see any downsides for having these active.

Flying Kick will be used only in tanking mode if the target is still at a distance.

Taekwon characters won't complain for having no weapon or shield equipped.

Mild Wind is used in the same way Endows are. For the time being, the AI will not attempt to overwrite a "bad" endow using it until the existing one expires. It might be worth considering the possibility of allowing that in the future.

Star Gladiator  is ready as well. The class actually doesn't have that many active skills. Heat will be used when attacking a Boss monster only. Protections will be used always when it's the correct map. Union will be used only if a priest (or anyone with level 4 ressurrection) is available in a party because the hp cost makes it a potential suicide move otherwise.  And that's pretty much all the active skills the class had. The AI obviously won't designate monsters or maps, that's left for the player to do.

Edited by Seravy

Share this post


Link to post
Share on other sites

Awh I thought it would be like sprites walking around not just using random skills or half ass random 

 

 

Share this post


Link to post
Share on other sites

Not entirely sure what you mean by that, can you explain?

 

Added Soul Linker. Also merged the latest Rathena changes.

Eswoo, Eske and Kaite will not be used by the AI, as they are very niche skills you usually don't need at all and come with major risks if misused.

The AI is aware of the element from Mild Wind when using Esma.

 

Share this post


Link to post
Share on other sites

@Seravy

First, congratulations! This is an amazing work. I see a lot of potential on it.

Are you planning to implement the AI for 3rd jobs ?

If you authorize, I can make a patch file from your git to easily apply it on the latest rAthena repository.

I hope you keep the project going and thanks for share it.

Share this post


Link to post
Share on other sites

Yes, I plan to keep updating this and eventually add the remaining 3rd (or other) jobs.

Sure, you can make a patch file but if you do make sure you keep it updated. I haven't had much time to add more to this in the past month but there will be updates sooner or later.

Share this post


Link to post
Share on other sites

I stopped waiting for the job rebalancing to happen and added whichever parts I truly wanted on a per line basis from the open PR, and implemented the AI for all the missing 1st/2nd/rebirth classes. I'll most likely take a longer break before I work on 3rd jobs and/or spend that time playing the game...

Every skill where the AI should be adjusted for official versions of the skills is marked by a comment starting with **Note**, however that's already assuming the official implementation will be https://github.com/rathena/rathena/pull/4072 so pay extra attention to that.

  • Love 1

Share this post


Link to post
Share on other sites

master seravy can i have a patch file for this.. i try your emulator but so many error in my debian 10 os

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...