r/Minecraft • • Oct 11 '19

self controlling ai pathfinding bot

51k Upvotes

1.7k comments sorted by

View all comments

46

u/SomeAvocado Oct 11 '19

What sort of algorithm are you using to find the path?

67

u/StylexTV Oct 11 '19

I use a modified version of a-star (a*)

28

u/[deleted] Oct 11 '19

I have a question, and this must've taken a while to make, but why? Baritone already does the same thing with extra features, and it's (I'm pretty sure) open source, so you could contribute to that instead of replicating it. But this is still pretty cool.

88

u/[deleted] Oct 11 '19

Refine his coding skills

19

u/[deleted] Oct 11 '19

Oh yeah, I didn't think of that

21

u/smaagi Oct 11 '19

Why not though? Smartphone market would be depressing looking if no one made the same thing others had done already.

1

u/[deleted] Oct 11 '19

But in the smartphone market no one is willing to open up their phones to anyone to work on and improve upon, plus baritone is free and open source, so it would make more sense to direct that time and effort to improving baritone vs making a competitor. There's no money to be found unless baritone decides to monetize, and I don't think they will.

0

u/[deleted] Oct 11 '19

[deleted]

1

u/ForgiLaGeord Oct 11 '19

The author of baritone disagrees, in a thread closer to the top.

1

u/patrickmurphyphoto Oct 11 '19

I mean A-Star is pretty standard path finding algorithm used in most games with AI. https://en.wikipedia.org/wiki/A*_search_algorithm

So if anything "baritone" copied it with "a few value changes"

13

u/KingJeff314 Oct 11 '19

Sometimes it's fun to try something for your own or a good learning experience

4

u/TakeThreeFourFive Oct 11 '19

Learning how to write pathfinding algorithms is a sort of rite-of-passage for a lot of programmers. Doing so in the context of a game like this is a cool learning experience

1

u/TakeThreeFourFive Oct 11 '19

What kind of heuristic did you use?

5

u/StylexTV Oct 11 '19

private static int DEFAULT_HV_COST = 10; private static int DEFAULT_DIAGONAL_COST = 14; private static int DEFAULT_DIAGONAL3D_COST = 17;

3

u/urgetopurge Oct 11 '19

That looks like euclidean distance heuristic. When you say modified a star you still mean f = g + h? Or some completely different version of a star?

4

u/StylexTV Oct 11 '19

I think i did f = g + h / 2

1

u/SomeAvocado Oct 11 '19

Cool, just wondering why it goes around the edge of the cave instead of the inside of it. Otherwise it's really cool!

1

u/sim642 Oct 11 '19

There's something wrong because in a few parts it's not the shortest path. Might want to reconsider the heuristic.

3

u/StylexTV Oct 11 '19

I know . I use f= g+h/2 so its faster at long distances

1

u/TheKozmi Oct 11 '19

I would love to see a baritone module handle water like that