Jump to content

OSBot Scripting Framework (Behavior Tree)


TheJacob

Recommended Posts

Hey folks, I'm working on an AI framework for writing Scripts on OSBot. After having recently played around with a decision tree framework and reflection (see this thread), I wanted to try a different approach to scripting and I definitely think this is a winner. My intent is to provide two things: flexibility and simplicity (in regards to maintainability). I will be using a behavior tree model w/ a utility function to write a F2P pking script, so let me know where you think we can improve this framework!

Source

Download (0.0.31): Git Repo (temporarily down)

Changes

  • 0.0.31 - new repository, structural changes, and maven integration (streamlines collaboration).
  • 0.0.21 - merged new framework, implemented a utility function, and removed json integration & chicken killer test script.
  • 0.0.12 - loading decision tree from JSON file.
  • 0.0.1 - initial release

Setup

  • Updating setup in accordance with 0.0.31 (TODO).

Remarks

  • Updating remarks in accordance with 0.0.31 (TODO).

Snippets (v0.0.31)

MyScript.java

Spoiler
// MyScript.java
package org.johndoe.myscript;

import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.script.Script;
import org.thejacob.sandbox;

@ScriptManifest(name="MyScript",author="John Doe",version=1.0,info="",logo="")
public class MyScript extends SandboxScript {
    @Override
    public void onStart() {
        BehaviorTreeFactory factory = getFactory();
        factory.inject("hello-world");
        BehaviorTree decisions = factory.getInstance("hello-world");
        setDecisions(decisions);
    }
    @Override
    public int onLoop() {
        getActionHandler().process();
        return 200; // < 1 game tick (in ms)
    }
    @Override
    public void onGameTick() {
        getDecisions().tick();
    }
}

 

 

Edited by TheJacob
New upcoming 0.0.31 release.
  • Like 1
  • Heart 1
Link to comment
Share on other sites

Follow-up:

So, I definitely think this approach (a behavior tree) will be sufficient to create a F2P ranged/2h pking script. That said, release 1.2 will separate actions from decisions before diving into the meat and potatoes of pking. Namely, the behavior tree will be parsed to update the blackboard with a set of game states (read as goals) that the game logic will accomplish -- decisions executed in onLoop and decisions processed in onGameTick. Also, I will provide more flexibility with regards to conditional aborts and parsing a "RUNNING" tree. In release 1.3+,  grouping and prioritizing actions for pking (as subtrees) will be the toughest part.

It's my intent to have a working pk-ready release within the next 10 days. If anyone has any thoughts on what a model might look like for pking, definitely reach out and give me a shout. As well, it's my first time writing a project in Java, so if there's any bad practices you folks see in the project, let me know.

Edited by TheJacob
Link to comment
Share on other sites

Follow-up:

Utility functions implemented. Next updates will expand on buckets, useful utility decorators, and streamlining the script to a (sense -> decide -> act) model. I expect these to be the last additions to the framework before major work will be put in to writing conditions/actions for f2p hybrid pking.

Edited by TheJacob
Link to comment
Share on other sites

20 hours ago, TheJacob said:

Follow-up:

Utility functions implemented. Next updates will expand on buckets, useful utility decorators, and streamlining the script to a (sense -> decide -> act) model. I expect these to be the last additions to the framework before major work will be put in to writing conditions/actions for f2p hybrid pking.

Follow-up:

Prior to the aforementioned upcoming tasks, I'm going to provide Javadocs for everything under the framework package. In doing this, I'll likely clean up a bunch of the code as well (or at least streamline it). The "decision" model is essentially complete, maybe adding one or two more decorators or composites here and there. The focus will shift to the "action" model once I've finished documenting everything (the "sense" model is provided by the OSBot API hehe, ty.)

Initial Javadocs pushed to Git for Tree, TreeFactory, and Behavior. The remainder will follow.

Edited by TheJacob
  • Like 1
Link to comment
Share on other sites

Follow-up:

Repository will be down over the next day or two. I'm changing the project name and integrating Maven in the development process. Moreover, I'm working with some collaborators that are focused on pushing a proof of concept script with the first stable release of the framework. The repository layout will be changing as well to reflect this.

This project will be open source (no change).

Edited by TheJacob
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...