Jump to content
adc

get farthest (or minimum distance) visible main screen tile in a given direction?

Recommended Posts

If you have movement path found

LocalPathFinder pathFinder = new LocalPathFinder(scp.bot);
LinkedList<Position> path = pathFinder.findPath(entity);

you can just check its tiles for visibility from index 0 to 20 for example.

new MainScreenTileDestination(bot, path.get(i)).isVisible()

If you need specific direction, you can ray-trace the line:)

Link to comment
Share on other sites

Load region

Add all visible tiles to a list

Grab the biggest or smallest (or a mixture of both if you want a most distant inter-cardinal direction position) x and y coordinates

 

I'm curious what you need this for tongue.png

 

post-71761-0-22896900-1404500813_thumb.png

 

I'm pretty sure the game map is 16 by 16, so the farthest position to the right would be:

new Position(myPosition.getX() + 16, myPosition().getY(), myPosition().getZ());

Farthest position below:

new Position(myPosition().getX(), myPosition().getY() - 16, myPosition().getZ());

etc...

 

 

Oh hey, perfect, this is exactly what I need QwPha8E.png For some reason I overlooked this, thinking I'd need something more complex.

Link to comment
Share on other sites

Are you doing barrows tunnel traversal without a path finding algo ? huh.png

 

 

 

I originally tried using a simple A*-type algorithm, but I encountered the problem of rooms being too far to load. Because of this, there's no way to determine a path unless you're already in the center of the catacombs, making it pretty much useless :P 

 

So my solution is this: 

 

(for data I have an enum that stores room areas, as well as Point[]s that possible doors reside at)

  • analyze current room's number of openable doors
  • if viable doors < 2, that means there's only one possible path; follow that path to the next room
  • if viable doors = 2, there's two paths. If one of the paths leads to the previous room, forget it and use the other path. if said other path leads to a blacklisted door, blacklist the current room as well.
  • if viable doors > 2, prioritize in this order: 1) doors that lead to the chest 2) doors that lead to short tunnels 3) whatever is left (doors that lead to long tunnels)
  • if a room has only 1 door and it's not the ladder room or chest room, blacklist it

 

It works pretty okay so far  :D

Link to comment
Share on other sites

I originally tried using a simple A*-type algorithm, but I encountered the problem of rooms being too far to load. Because of this, there's no way to determine a path unless you're already in the center of the catacombs, making it pretty much useless tongue.png

 

You could just go to the center once and store all the required data once in a class though (as you would do for a webwalker).

 

 

So my solution is this: 

 

(for data I have an enum that stores room areas, as well as Point[]s that possible doors reside at)

  • analyze current room's number of openable doors
  • if viable doors < 2, that means there's only one possible path; follow that path to the next room
  • if viable doors = 2, there's two paths. If one of the paths leads to the previous room, forget it and use the other path. if said other path leads to a blacklisted door, blacklist the current room as well.
  • if viable doors > 2, prioritize in this order: 1) doors that lead to the chest 2) doors that lead to short tunnels 3) whatever is left (doors that lead to long tunnels)
  • if a room has only 1 door and it's not the ladder room or chest room, blacklist it

 

It works pretty okay so far  biggrin.png

 

If it works then that's all that matters I guess x)

Link to comment
Share on other sites

You could just go to the center once and store all the required data once in a class though (as you would do for a webwalker).

 

 

 

Actually, I tried. the problem is that every time you spawn a new tunnel path (every chest run at barrows), you'd have to be able to check whether each door on a given path is openable. When I tried doing this via getActions.contains("Open"), unloaded doors return true whether they're actually openable or not, meaning it couldn't determine a path, since A* (and pathfinding in general afaik) obtains its path from the end point to the beginning.

Link to comment
Share on other sites

Actually, I tried. the problem is that every time you spawn a new tunnel path (every chest run at barrows), you'd have to be able to check whether each door on a given path is openable. When I tried doing this via getActions.contains("Open"), unloaded doors return true whether they're actually openable or not, meaning it couldn't determine a path, since A* (and pathfinding in general afaik) obtains its path from the end point to the beginning.

 

You can get the openable doors via config(s) tho, without having the doors loaded.

  • Like 2
Link to comment
Share on other sites

Why do you guys make this so complex?

 

If you can get the doors you need to open via configs, you can literally just run around the perimeter until the door is reachable. Finding the next position to walk to is ezpz as you can just find the farthest walkable tile in your game region and walk to it.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Recently Browsing   0 members

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