Scripting Resources & Utilities > Stealth Snippets\Library

[C# .NET, ScriptSDK, Bot] Combot (RC2) - responsive multi-botting

(1/2) > >>

unisharp:
Combot (RC2) - release candidate v2

What?
Combot is a system for handling multiple concurrent Stealth profiles capable of communicating with each-other.

Why?
If you have a script that checks for information from UO and does something based on that information....  then you take that script and you multiply it by how many profiles you're running it on.  If the profiles could share information with each other, they would not all need to request information from Stealth.  This makes it more efficient by having the scripts share information with between profiles.  Combot is also capable of client cross-communication.

Examples of usage:
You have a group of profiles existing in the same space (shard, screen) and they are fighting some monster together.  If you're running the same script through Stealth for each profile to check one another's health and heal them when they need it, then all your profiles will always try and heal the same person at the same time.  If another profile was damaged, it wouldn't get a heal until all the profiles finished healing someone else.    Combot's job priority system can be used to delegate tasks, such as healing, to each profile that it's connected to.  Instead of all the profiles trying to heal the same person, the Combot hub (server) will assign each profile with a different healing job.

How?
Combot makes it so only one profile is requesting data from Stealth while the other profiles feed off that data over TCP/IP.  This system is broken down into three parts (two of which are only important) - Client, Server, Data.  First you run the Server on the profile that you want to act as the "hub" for all other bots.  This will collect any data from Stealth that all the other bots need - such as checking player health.  That runs in something called a "Routine" which I'll talk more about later.  The Server Routine collects data and issues Jobs to the JobQueue based on that criteria.  When a new Job is added on the Server, it will notify each Client that is connected - this can also be setup to only notify certain Clients based on criteria (like if it's a bandage job, don't notify clients who don't have healing.)  As the server starts notifying Clients, if a Client is not busy with another Job it will accept it and notify the Server that the Job is now assigned so that Clients aren't don't pick up the same Job.  Once the Client is finished with the Job, it notifies the Server that the Job is complete and the Server removes the Job from the JobQueue.  You can run the Client on as many Stealth profiles as you desire.

Structure:
I'm going to have to write up a lot more documentation on this, but I'm going to give you guys all the need-to-knows now.

Routines - Both the Client and the Server have Routines.

The Server Routine contains the checks to Stealth that you want to also share with the Clients.  It also assigns jobs to the JobQueue based on the checks that you have done in the Server Routine.

The Client Routine contains what you want the client to do on its own - like making sure you're staying within range of the Leader (the Server.)  You can add your own routines; right now both the Client and the Server have example routines named "Combat."  The Client also has a routine named Job - this defines how Jobs should be handled on the Client-side.  For example, the Server sends a Client a Job to bandage someone, the Client runs the JobHandler in the Job Routine to check what type of job it is, and calls a method in the Routine to handle the Job.



Status:
This project is 85% complete.  I'm up to coding the response to the server when a client accepts a job, so I have to finish that and then setup methods for the server to queue the job on completion.  I'm throwing this somewhat incomplete project up here for example, but I am still working on it and it will be complete very soon.


Files:
NEW LINKS COMING SOON

If you want to get this setup and running in it's current state, download the entire solution and open it up in Visual Studio 2013 (free community edition can be downloaded.)

Server\Routine\Combat.cs
You'll see there's a GroupList - this is a list containing all the player IDs whom are to be checked (for health.)  Add/Remove as many as you like and remember to change the number to whatever ID your character is.

Client\Client.cs
Line 68 - set this to your machines local network IP.

Start up Stealth and connect with a profile that you want to act as a hub.  Compile and start the Server.  Use Stealth to connect another profile that you want to act as a client.  Compile and start the client.

This post is also a work in progress.

Updates:
4/21/15 - Job system complete overhaul.
4/22/15 - Job system tweaked.
4/29/15 - Job rejection added, major updates.  RC1 released
10/28/15 - RC2 - ScriptSDK

unisharp:
Documentation:

Coming soon...



Video Guide:

Coming soon...

Crome969:
Thank you for your awesome contribution!

unisharp:
Thanks :)  Wouldn't be possible without Stealth!

The job system is 99% complete.  There's one thing missing and that's how to handle rejected jobs.  A rejected job comes from the client when they could not complete the job they were given.  An example of a rejected job would be when a client can't bandage someone because they were already full health or too far away, or when a client fizzles on casting Close Wounds.

So here's the dilemma.  If a client fizzles Close Wounds, should the client request the target's health again before re-casting Close Wounds, creating extra work for Stealth to do?  Should the client just tell the server he fizzled, and if so should the server assign the job to someone else.

Right now, rejected jobs are just ignored or not handled because I'm currently undecided on how to handle this.

EDIT: There will be Videos posted soon: Getting Started, Creating New Jobs, Creating New Routines

Crome969:

Navigation

[0] Message Index

[#] Next page

Go to full version