Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Tutorial Understanding Runemate's Pathing Systems, and Utilizing Them

Joined
Aug 23, 2015
Messages
1,961
Why Pathing is Important:
Runemate's pathing systems are what allow bots to move between locations in-game. Any bot in the store that moves more than a screen distance away utilizes some sort of pathing.

Types of Paths available:
Bresenham Path:
Builds a direct line between two points.

Region Path: Generates a path constricted to the currently loaded in-game region (104x104). The generated path is based on the regions collision flags (these detect you can't walk through, and some other things) to allow you to walk around obstacles such as buildings or trees.

Predefined Path: A path defined by you (the author), consisting of a set of coordinates that are traversed in order.

Viewport Path: A path that clicks on in-game tiles to walk. To create a viewport path, generate a Coordinate Path (AKA a Bresenham, Region, or Predefined path), and convert to viewport.

(Default) Webpath: Uses Runemate's default web to generate a path. This path can handle most obstacles such as doors and staircases, will utilize Normal/Lunar/Ancient teleports, jewelry teleports, spirit trees, and gnome gliders. Usage is recommended only when traversing past obstacles or over significant distances.

Advantages/Disadvantages of Paths:
Each of these examples is in the form of a TreeTask, which is the "Leaf" of a treebot.

Bresenham Path: Doesn't navigate around objects. Bresenham paths are best used in large open areas for basic walking. Reliable generation as long as no obstacles, such as doors, block the path generation.

Region Path: Paths go around objects, but cannot pass obstacles such as doors or agility shortcuts. Path will generate null if you try to walk to a different in-game region.

Predefined Path: Very reliable since the path is supplied by the author instead of generated, but restrictive and repetitive by nature. Usage is discouraged. Cannot traverse obstacles such as doors.

Viewport Path: Clicks on in-game tiles to walk, which allows for greater precision when you need to walk to a specific tile. Can be more human-like in certain situations.

(Default) Webpath: Can traverse obstacles such as doors, staircases, and ladders (Aka can move between in-game planes). Utilizes many teleports without significant implementation efforts by the authors. Has one disadvantage - If the webpath doesn't work properly, or doesn't generate, the author must rely on Runemate staff for the problem to be fixed.

Coding with Paths:
Bresenham Path:
Code:
public class Walk extends LeafTask {

    private Coordinate destination = new Coordinate(3013, 5608, 0);

    @Override
    public void execute() {
        BresenhamPath bresPath = BresenhamPath.buildTo(destination);
        if(bresPath != null){
            bresPath.step();
        } else {
            getLogger().warn("bresPath was null in Walk");
        }
    }

}


Region Path:
Code:
public class Walk extends LeafTask {

    private Coordinate destination = new Coordinate(3013, 5608, 0);

    @Override
    public void execute() {
        RegionPath regionPath = RegionPath.buildTo(destination);
        if(regionPath != null){
            regionPath.step();
        } else {
            getLogger().warn("regionPath was null in Walk");
        }
    }

}


Predefined Path:
Code:
public class Walk extends LeafTask {
 
    private PredefinedPath predefined = PredefinedPath.create(new Coordinate(3016, 5627, 0), new Coordinate(3015, 5624, 0), new Coordinate(3015, 5622, 0),
            new Coordinate(3014, 5619, 0), new Coordinate(3013, 5616, 0), new Coordinate(3013, 5613, 0), new Coordinate(3013, 5611, 0),
            new Coordinate(3013, 5608, 0));
 
    @Override
    public void execute() {
        if(predefined != null){
            predefined.step();
        } else {
            getLogger().warn("predefined was null in Walk");
        }
    }
 
}


Viewport Path:
Code:
public class Walk extends LeafTask {

    private PredefinedPath predefined = PredefinedPath.create(new Coordinate(3016, 5627, 0), new Coordinate(3015, 5624, 0), new Coordinate(3015, 5622, 0),
            new Coordinate(3014, 5619, 0), new Coordinate(3013, 5616, 0), new Coordinate(3013, 5613, 0), new Coordinate(3013, 5611, 0),
            new Coordinate(3013, 5608, 0));

    @Override
    public void execute() {
        if(predefined != null){
            ViewportPath viewport = ViewportPath.convert(predefined);
            //viewport won't ever be null, so no need to null check it
            Coordinate nextStep = viewport.getNext();
            if(nextStep != null){
                if(nextStep.isVisible()){
                    viewport.step();
                } else {
                    Camera.concurrentlyTurnTo(nextStep);
                }
            } else {
                getLogger().warn("Could not get next step of viewport");
            }
        } else {
            getLogger().warn("predefined was null in Walk");
        }
    }

}


(Default) Webpath:
Code:
public class Walk extends LeafTask {

    private Coordinate destination = new Coordinate(3013, 5608, 0);

    @Override
    public void execute() {
        WebPath webPath = Traversal.getDefaultWeb().getPathBuilder().buildTo(destination);
        if(webPath != null){
            webPath.step();
        } else {
            getLogger().warn("Could not generate webPath in Walk");
        }
    }

}

An Extra: TraversalOptions

All types of paths can also take an argument of Traversal Options when calling .step()

Traversal options as of 12/25/2017 are:
MANAGE_DISTANCE_BETWEEN_STEPS
MANAGE_RUN (turning it on if it runs out and re-generates)
MANAGE_STAMINA_ENHANCERS (stamina potions, terrorbird scrolls, etc)

All types of paths default to managing these things if not specified by the author. They can all be disabled using .step(false), or individually enabled using .step(TraversalOptions you want to enable).

Code:
public class Walk extends LeafTask {

    @Override
    public void execute() {
        WebPath webPath = Traversal.getDefaultWeb().getPathBuilder().buildTo(new Coordinate(3013, 5608, 0));
        if(webPath != null){
            webPath.step(Path.TraversalOption.MANAGE_DISTANCE_BETWEEN_STEPS, Path.TraversalOption.MANAGE_RUN);
        } else {
            getLogger().warn("Could not generate webPath in Walk");
        }
    }

}
 
Last edited:
Joined
Mar 28, 2017
Messages
286
Does a viewport handle obstacles such as doors?

Also, for the paths you mentioned that cannot handle doors, would it be possible to modify the path ourselves, and add a BasicObjectVertex for the door? Or do you think it'd be better if we use #interact instead of messing with the list of vertexs.

EDIT: Also, do we have to take care of the camera for all paths, or does RM handle it for us? ie viewport path -> if (!path.getNextStep.isVisible) -> turnCamera
 
Joined
Aug 23, 2015
Messages
1,961
Does a viewport handle obstacles such as doors?

Also, for the paths you mentioned that cannot handle doors, would it be possible to modify the path ourselves, and add a BasicObjectVertex for the door? Or do you think it'd be better if we use #interact instead of messing with the list of vertexs.

EDIT: Also, do we have to take care of the camera for all paths, or does RM handle it for us? ie viewport path -> if (!path.getNextStep.isVisible) -> turnCamera

  • Viewport is a converted Predefined, bres, or region path, and these paths do not handle obstacles. By extension, viewport does not.
  • BasicObjectVertex is part of making a web, not part of traditional pathing. Walk near the door, interact with it normally, and then path again.
  • Camera is irrelevant for Coordinate paths (Bres, region, predefined) since they use the minimap. Viewport has an example in the guide.
 
Joined
Mar 28, 2017
Messages
286
  • Viewport is a converted Predefined, bres, or region path, and these paths do not handle obstacles. By extension, viewport does not.
  • BasicObjectVertex is part of making a web, not part of traditional pathing. Walk near the door, interact with it normally, and then path again.
  • Camera is irrelevant for Coordinate paths (Bres, region, predefined) since they use the minimap. Viewport has an example in the guide.

Okay I see, my bad didn't read the code example for Viewport :x But that you for clarifying for the rest
 
Joined
Jan 17, 2018
Messages
10
Does a web path automatically open doors/gates or is there code needed to specify what to open/when? If it does need to be specified would you mind giving me an example? I'm attempting to write my first bot so this information would be much appreciated :)
 
Joined
Aug 23, 2015
Messages
1,961
Does a web path automatically open doors/gates or is there code needed to specify what to open/when? If it does need to be specified would you mind giving me an example? I'm attempting to write my first bot so this information would be much appreciated :)
Web paths can traverse obstacles all on their own.
 
Joined
Feb 21, 2016
Messages
60
Would you store a webpath into a variable and use that until it cannot step / is at the end of the destination? Or is it ok to generate a path every time the leaf task is called?
 
Joined
Aug 23, 2015
Messages
1,961
Would you store a webpath into a variable and use that until it cannot step / is at the end of the destination? Or is it ok to generate a path every time the leaf task is called?
You can do that if you or users are having trouble with the speed of the web pathing, but you may encounter scenarios where it will get stuck endlessly traversing an obstacle back and forth if you don't regenerate after the obstacle.
 
Top