1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Creating/Extending a Web (RS3)

Discussion in 'Developer Support' started by Philosobyte, Dec 25, 2014.

  1. Philosobyte

    Joined:
    Dec 18, 2014
    Messages:
    398
    Likes Received:
    79
    Unfortunately, Defeat3d's tool is exclusively for OSRS.

    I have been trying to extend or create a Web for several hours now, and still don't have a grasp of what exactly a Bidirectional Edge is, how it relates to the Web or even to a CoordinateVertex, or how a coordinate's isReachable affects webwalking. And many other things besides.

    I and many future coders here would appreciate a conceptual explanation and an example of these things when the default web fails us.

    My futile attempts at creating a web:
    Code (Text):
    1.  
    2. private List<Coordinate> list;
    3. private Web web;
    4. private Collection<WebVertex> webList = new ArrayList<WebVertex>();
    5.  
    6. public void someMethod()
    7. {
    8.         Area area = new Area.Polygonal(new Coordinate[]
    9.                 {
    10.                 new Coordinate(2779,2999,0),
    11.                 new Coordinate(2774,3011,0),
    12.                 new Coordinate(2870,3038,0),
    13.                 new Coordinate(2875,3016,0)
    14.                 });
    15.         list = area.getCoordinates();
    16.      
    17.         for(Coordinate c : list)
    18.         {
    19.             CoordinateVertex v = new CoordinateVertex(c);
    20.             v.addBidirectionalEdge(new CoordinateVertex(c.derive(1, 0)));
    21.             v.addBidirectionalEdge(new CoordinateVertex(c.derive(0, 1)));
    22.             v.addBidirectionalEdge(new CoordinateVertex(c.derive(-1, 0)));
    23.             v.addBidirectionalEdge(new CoordinateVertex(c.derive(0, -1)));
    24.             webList.add(v);
    25.         }
    26.         web = Traversal.getDefaultWeb();
    27.         web.addVertices(webList);
    28. }
    29.  
    30.     @Override
    31.     public void onLoop()
    32.     {
    33.         Execution.delayUntil(() -> web.getPathBuilder().buildTo(Data.OBELISK).step(true));
    34.         stop();
    35.     }
    36. // results in a NullPointer, most likely because the path specified by buildTo doesn't exist.
     
  2. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    The general concept is that the web is a graph. Each vertex is a graph element and to signify that you can move between two elements on the graph you have to connect them in an edge. A bidirectional edge specifies that you can traverse from A to B and B to A, while a single directional edge is simply from A to B.
     

Share This Page

Loading...