3 ms·
Dijkstra on real map data with raylib
- sleepycatgirl 3y agoVery much cute :D And I gotta agree, raylib is cute lil' library. And I love the fact that it has bindings to so many languages, and e.g makes making games in Common Lisp a joy. Or any language, that one would want to use.. well not all, but a lot.
- uysalibov 3y agoThank you. I really like raylib. It's so powerfull.
- richrichie 3y agoRaylib is amazing.
- throwaway425933 3y agoGreat work but I cant relate to it because I am not from Istanbul? How do I add it for other cities. Specifically, for San Francisco Bay area or for Hyderabad, India.
- unclad5968 3y agoLooks like the file loading for the map data is hard coded into the initialization.
- uysalibov 3y agoYes, I do like that. My istanbul data hard coded. But i want to add data import menu. It's on my todo list.
- gfiorav 3y agoThe files under Maps/*.json seem to be generated via https://wiki.openstreetmap.org/wiki/Overpass_API https://wiki.openstreetmap.org/wiki/Overpass_API You can generate your own and rebuild
- throwaway425933 3y agoThx. Any instructions on how to "generate your own" would be appreciated.
- pvo50555 3y agoYou can try one of the Quickstart guides on that page. Just type in "San Francisco" in the search bar on the map on this page: https://overpass-turbo.eu/ https://overpass-turbo.eu/ and then run your search query (drinking fountains by default). The bounding box should be whatever is in view of the map on the right. Then you can click the Data tab to see exported XML.
- pvo50555 3y agoWhat would be the best way to generate custom maps for use with an algorithm like Dijstra's or A*? I have seen some methods using various game level editors to output to a grid, but is there an easy way to draw custom maps, such as indoors locations, and create your node map with additional JSON data visually?
- cornstalks 3y agoReminds me of this Reddit post of using A* on a real map: https://old.reddit.com/r/dataisbeautiful/comments/172b8as/oc_astar_pathfinding_algorithm_visualization_on_a/ https://old.reddit.com/r/dataisbeautiful/comments/172b8as/oc... Unfortunately I don't think the Redditor shared their code.
- uysalibov 3y agoYeah, I saw that video too. But it's created with Python and Blender.
- cornstalks 3y agoI'm curious what your results would be if you switched to A*. The heuristic could be as simple as geographic distance, which would still allow for optimal paths but might reduce the amount of searching you do in the opposite direction of your destination.
- keyle 3y agoIf you're interested in the A* algorithm to implement yourself, here is a solid base as reference [1] [1] https://www.redblobgames.com/pathfinding/a-star/introduction.html https://www.redblobgames.com/pathfinding/a-star/introduction...
- jbl0ndie 3y agoNice animation! Reminds me of https://isovists.org/ https://isovists.org/
- uysalibov 3y agoThanksss
- tines 3y agoWhat heuristic distance function is being used? If it were using Euclidean distance, wouldn’t it be a lot more efficient and not pursue paths that are going in literally the opposite direction as the destination?
- uysalibov 3y agoI use Squared Euclidean distance. Yes, dijkstra algorithm like that way. But if you want to pursue to destination i need to implement A* too.
- thom 3y agoYeah, Dijkstra is more for graph search where maybe you have weights but not actual vectors. But this does give a nice visualisation of how far you can get from a single point in a given time.
- gfiorav 3y agoThis is very cool! I compiled it on m2 with no problems. Istambul is an excellent choice. I enjoyed watching the algorithm take for ever to find a route from the most northern part of the river to the other side :)
- leoh 3y agoBravo! Thank you for sharing -- glad to learn about raylib and the overpass API.
- kebsup 3y agoAt my university, one of the homework exercises was implementing A* on real map data. Really gave a perspective on the speed of computers, from what I remember, it was megabytes of map data of the UK, but calculating the best path from London to Edinburgh was within tens of milliseconds.
- lionkor 3y agoFYI the build steps should be simplified to cmake -B build -S . cmake --build build this will work on all platforms.
- ms-menardi 3y agoRaylib is the best visual library for C! You can do whatever you'd like, as long as you can program it, which is always the most interesting part of the day.