Comments (8)
There are several solutions that compute a nicer path more often (though none work 100% of the time). RedBlobGames has an article on this: http://www.redblobgames.com/pathfinding/a-star/implementation.html#troubleshooting-ugly-path
I've been experimenting with it, but I haven't come to a solution yet that I really like. I'll see if I can cook something up this weekend. (no promises).
from astar.
One solution I haven't tried yet is to start the neighborhood search with the tile that is on the line from the current cell to the finished cell.
from astar.
I've been reading your commits and in the commit where you've changed the heuristic to Chebyshev you removed something that u commented out.
// Avoid zig-zag paths by correctly penalizing the cost of diagonal movement
Did it use to work? Or u never checked?
from astar.
@SpreedBlood unfortunately that approach made the heuristic A* depends on for finding the shortest path inadmissible (it overestimates paths over the diagonal). Which caused some non-optimal paths to be found.
from astar.
I thought some more about this issue. You get the straightest path, if you follow the direction you were following. I can look up what offset was last used for the path so far and start exploring that offset in that direction first (in the case of ambiguity). It will take me a bit to figure out how to do this fast. But I think this will work.
Meanwhile I'm working on the last improvements off the viewer so I can more easily verify that changes like this have the desired effect.
from astar.
Hmm I haven't had much luck with my own idea, or other hacks. It might be best to include a string pulling algorithm in the library. I've found some info here: https://www.gamedev.net/forums/topic/539575-string-pulling-explained/
from astar.
String pulling seems to work brilliantly, I've got a WIP branch here: https://github.com/roy-t/AStar/tree/feature/string_pulling (note you can only see the effect in the viewer in release builds, (which only shows the end result) the debug build only shows the path finding steps and doesn't know about string pulling yet).
There are some issues/TODOs in my current implementation that need to solve, but I'm confident they do not block my progress.
- Make sure smoothing paths does not conflict with the movement pattern of the agent
- Make sure path segments do not become disconnected by smoothing (oops)
- Visualize the path smoothing in the debug mode in the viewer
- Test the performance (probably OK since it only affects the final path, but we might want to make the smoothing step optional).
from astar.
I've implement the string pulling algorithm. In a new section in the readme you can see how its used and what affect it has. I think this will make you very happy :). The changes are also in the update NuGet package (v1.2) which I've uploaded just now.
from astar.
Related Issues (20)
- Considering the size of the agent
- Finding closest path to unreachable end cell HOT 4
- Deterministic? HOT 2
- Info: v2 WIP version available on Master HOT 2
- Hidden Connect method HOT 3
- Documentation / IntelliSense support HOT 5
- Isometric Support HOT 1
- Coming to v3 HOT 3
- Path. HOT 3
- No issue just a question. HOT 3
- Saving and loading graphs HOT 7
- TODO: release new minor version with save/load changes HOT 1
- just question HOT 2
- Question: GPS coordinates HOT 3
- Question HOT 1
- Explanation on how velocity is used HOT 6
- Question : Bidirectional graph search HOT 1
- Question: obstacles HOT 3
- Discussion on algorithms HOT 5
- Add Grid.Connect(GridPosition position)? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from astar.