OpenKore / openkore

A free/open source client and automation tool for Ragnarok Online
http://openkore.com
Other
1.29k stars 1.05k forks source link

AI 2008 fld2 and PathFinding algorithm #1684

Closed Henrybk closed 5 years ago

Henrybk commented 6 years ago

As some of you may know I have been working on writting a new pathfinding code for openkore for quite a while, I believe today I finally got it working and decided to PR it so other developers can take a look.

Features:

1 - Uses new simplified fld2 files
2 - Uses .weight files based on .dist files instead of .dist files, allowing custom static or dynamic weight maps (avoid mvps, non-walking mobs, dangerous map areas)
3 - Correctly uses diagonals, using weight 1.4 that of ortogonal moving
4 - Uses diagonal distance heuristic, which is the most appropriate for ragnarok maps
5 - Is guaranteed to always find the shortest / best path since it does not limit openlist
6 - Uses about 42% less time to calculate a route
7- Fixes runfromTarget, attackCheckLOS and AttackCanSnipe
8- Corretly predicts the time to walk a given distance, preventing a few timeouts

benchmark of current algorithm: https://gyazo.com/cd3adf01a6af0b022e5e57a4010c7064 изображение

benchmark of my algorithm: https://gyazo.com/2359320cab8587a1e9078558b99ac4d9 изображение

My benchmark consists of all the portalslos paths plus 20 randomwalks on all RO maps.

Edit: Most of the changes were ideas from here: http://forums.openkore.com/viewtopic.php?f=36&t=1350

this pull fixes #2546

Glikadin commented 5 years ago

@Henrybk Please continue work

Henrybk commented 5 years ago

@Glikadin oh, thanks for testing, I`ll take a look this weekend.

Henrybk commented 5 years ago

@Glikadin There was a bug that happened when using the move command to move to the same cell the char was standing, thanks for testing. This last update should have fixed that.

Henrybk commented 5 years ago

Please continue in #2871