[quote=“frank_, post:27, topic:410034”][quote author=unlimitedorb link=topic=511300.msg3715059#msg3715059 date=1313586651]
Raycasting > Navigation meshes > Waypoint Graphs
[/quote]
wat[/quote]
From the bottom to the top:
1.) The RS2 botting community currently hardcodes waypoints into their scripts. Suppose you’re trying to get from lumbridge to draynor - a set of visible tiles are selected along the path from lumbridge to draynor as waypoints that the bot walks along. Sometimes bots will give them a degree of freedom i.e. it can deviate some amount of walking space from the actual tiles.
This is bad for a number of reasons including the bot can easily get stuck along a path if the degree of freedom encompasses an obstacle (requiring revision to the waypoints selected). Also, each tile must be hand selected for each and every script made.
2.) Waypoint graphs - the next step up from what the botting community does now is to treat tiles you can walk on as a graph problem i.e. select a number of tiles and use them as vertices in a graph data structure to perform a pathfinding algorithm on. A* not only works with grid problems but graph problems as well!
This is good because we can dynamically determine a relatively good path from Point A to Point B and depending on the number of vertices we have in our graph, we can make it quite optimal and there’s no need to update/hardcode tiles into the script once the graph is set up.
This is bad because depending on how few vertices we have representing walkable areas, we get “zigzag” behavior. While it’s possible to smooth this behavior by using a spline, this doesn’t guarantee that the bot won’t demonstrate the “getting caught on an obstacle behavior” as before because it’s not guaranteed that the tiles outside of the graph aren’t collision areas. In addition, the more vertices we add to our graph, the more expensive it becomes to perform pathfinding on it.
3.) Navigation mesh - The next step up from a waypoint graph (and ironically easier to implement) is describing the walkable landscape as a series of convex polygons with a few additional attributes e.g. height. Also, I’m sure the client has a collision map of some sort in the cache, so its possible to generate a navmesh from that. There are quite a few good documents out there that’ll explain it better than me and even some tools that automate the task of creating navmeshes! So I’ll leave that up to you to research.
4.) Raycasting - when I say raycasting I use it in the sense that we treat the land as a series of objects we have to avoid and we cast a ray to see if it hits an object, if it does, we avoid it. Using this, coupled with learning techniques, the bot can explore any area regardless of updates and learn the land dynamically.
The only bad thing about it is that its expensive to do. There’s no rule saying it can’t be coupled with another approach like a navigation mesh, though…