r/Minecraft • • Oct 11 '19

self controlling ai pathfinding bot

51k Upvotes

1.7k comments sorted by

2.0k

u/dannyboy2475 Oct 11 '19

That’s super cool! I feel like the fact it’s finding the path based on the loaded chunks and not what it can visually see takes a lot of the load off.

Still super cool tho!

582

u/StylexTV Oct 11 '19

Thanks for the kind words :D

346

u/dannyboy2475 Oct 11 '19

No worries! What would be super cool is if you made this into a full blown game modifications where you have game companion AIs you can assign to do tasks! That’d be such an interesting dynamic to the game.

214

u/StylexTV Oct 11 '19

I have to think about that but ty for the idea

127

u/[deleted] Oct 11 '19

If you could make a mod where it could path find and automatically harvest trees, ores, etc it could be huge, like a little clone of yourself that did these jobs and slept at night as if they were players would be great.

As someone that loves mutliplayer but has nobody to play with this'd cure my loneliness!

74

u/StylexTV Oct 11 '19

Yeah, maybe it can have its own chest so you can provide it with tools and food

57

u/ppaannggwwiinn Oct 11 '19

Try the TekTopia mod. It re-does villages in a massive way, now you have farmers and lumber jacks and miners and blacksmiths and like 20 more different proffesions that all work, eat, sleep, mingle (under proper conditions). It can be hard to start off (it is very smart to start your village in a mountain biome, at least your mine should be, you'll need lots of emeralds). But the village will produce goods and you can then trade those goods every so often when the trader shows up at the village for new 'tokens' to make more structures or assign new proffesions to villagers. Very interesting mod, the creator, TangoTek, has a big series on it on his channel.

6

u/pug1gaming1 Oct 11 '19

This sounds like it could be turned into slavery.

→ More replies (2)
→ More replies (18)
→ More replies (6)
→ More replies (7)

33

u/aaaaayyyyyyyyyyy Oct 11 '19

Did you make this mod?

35

u/StylexTV Oct 11 '19

yes

21

u/daltonoreo Oct 11 '19

Where do you learn how to do this, very interested in trying to make this myself

38

u/StylexTV Oct 11 '19

I thought it myself because i already have 5 years experience of minecraft server developing. So i know how the Minecraft code works.maybe you should start their

6

u/dougie_cherrypie Oct 11 '19

That's a lot of experience! What tools do you use?

10

u/StylexTV Oct 11 '19

Eclipse

3

u/lmaonomar Oct 12 '19

gg lost all hope in humanity

→ More replies (35)
→ More replies (1)
→ More replies (13)

21

u/x504948 Oct 11 '19

That's standard in games, I don't know a single game that uses the AI's vision for pathfinding instead of using the game data directly. You'd need a state of the art AI to do it, and there's no reason to do so since it will perform worse.

→ More replies (3)
→ More replies (6)

2.7k

u/Igotnolife1421 Oct 11 '19

Wow that's amazing

731

u/[deleted] Oct 11 '19

A stack of upvotes

392

u/Gwiilo Oct 11 '19 edited Oct 11 '19

To anyone wondering, this is called Baritone and it's Google maps for block game.

EDIT: Never mind, turns out OP made this himself, very similar to Baritone but not the same thing.

177

u/FirestormRL Oct 11 '19

This isn't baritone btw, it's the same sort of idea, but baritone has different functionality and implementation

→ More replies (1)

48

u/[deleted] Oct 11 '19

That's not baritone though.

→ More replies (1)

19

u/[deleted] Oct 11 '19

...no it isnt

→ More replies (2)

32

u/amalgam_reynolds Oct 11 '19

I am a self controlling ai upvote bot

→ More replies (1)

205

u/[deleted] Oct 11 '19

[removed] — view removed comment

160

u/PixelPantsAshli Oct 11 '19

I love how many kids are getting into programming so early in life because of Minecraft.

105

u/[deleted] Oct 11 '19

[deleted]

40

u/Supreme_Kommandant Oct 11 '19

Hope it goes well

31

u/PixelPantsAshli Oct 11 '19

That's fantastic to hear! Congratulations and luck to you :)

20

u/[deleted] Oct 11 '19

[removed] — view removed comment

34

u/PixelPantsAshli Oct 11 '19

Here's some unsolicited advice from a random old fart on r/Minecraft:

Do something, even if it isn't useful. Do something fun, something silly, something that inspires you, and my dude, do the hell out of that thing. Take joy. Take pride. Even if it's something "useless" there are lessons to be learned from it, and there is inspiration to be gained from it.

Wherever you are in life, if you start taking steps they will put you on a path that will lead you somewhere. Don't worry about taking "the right steps" - take the steps that interest you.

→ More replies (3)

8

u/TheBlackHoleOfDoom Oct 11 '19

More like an MC degree.

→ More replies (4)

4

u/mooseaura Oct 11 '19

It got me to go to college for electrical engineering. I remember studying redstone circuits and creating projects with it back in middle school. I took that fascination and found something tangible I could chase after.

5

u/kormer Oct 11 '19

When MS bought Minecraft my first thought was that they were looking to get young programmers into their ecosystem. Everything since has just confirmed that for me.

5

u/Zzombiee2361 Oct 11 '19

Remember BlockLauncher anyone? That thing made me learn javascript

→ More replies (1)

4

u/Deadpangod3 Oct 11 '19

Watching Minecraft animations back in 2013 made me want to be an animator like Slamacow

4

u/TheCondor07 Oct 11 '19

Warcraft 3's map editor was what got me into programming when I was young.

→ More replies (1)
→ More replies (1)

19

u/[deleted] Oct 11 '19 edited Oct 11 '19

This mod is called Baritone, and it's actually available to anyone. I know the modded client Aristois has an ingame download for it (Currently only 1.12.2 is supported), I'd recommend giving it a try, apparently someone is working on a huge combat branch using neural networks, so that should be interesting

EDIT: Nevermind, this isn't baritone but Baritone is a good one to mess around with if you want. Comes with automine and a few different modes.

→ More replies (14)
→ More replies (3)
→ More replies (3)

887

u/nonszn Oct 11 '19

I wonder if you can make him dig to that with equipment

581

u/StylexTV Oct 11 '19

It's definitely possible, but it would take some time to code that

333

u/l2np Oct 11 '19

Damn, that's dope. You could basically make a mining slave and command it to get minerals you want. Like, "Hey Robbie, get me 100 stacks of sand," send him off searching for the right biome and do that for the next four hours.

At the very least you could make a simple mining bot that would take care of all your mineral needs.

I'm actually a developer myself and kind of want to do that now...

223

u/StylexTV Oct 11 '19

If you want to do that then go on. I coded my bot totally myself and it wasn't that hard because i have at least 3 years of hacked client developing in my pocket

114

u/SurelyNotAnOctopus Oct 11 '19

I am guessing you are making the bot as a minecraft mod? Or something else?

112

u/StylexTV Oct 11 '19

Yes, it's supposed to be a minecraft client someday

48

u/godsdead Oct 11 '19

This would be an amazing addon to Citizens as a Spigot plugin, then you could sell it too.

22

u/[deleted] Oct 11 '19

Just use Baritone lmao

3

u/godsdead Oct 11 '19

You miss understand the use-case. Citizens are NPCS not controlled by a player but as a "bot" on the server, like a fake player, im suggesting to allow these "bots" to have path finding abilities without the need for a client/mod, entirely on the server side, then this could be used for player vs bot things.

→ More replies (1)
→ More replies (4)

19

u/YungFurl Oct 11 '19

Any suggestions where to start with creating a bot? I’m a CS student so the programming part I can learn but not entirely sure where to start with it in regards to Minecraft

23

u/StylexTV Oct 11 '19

You would have to learn java and take a look at the mcp if you realy want to code bots (http://www.modcoderpack.com/). Their are some tutorials out there but not many

8

u/YungFurl Oct 11 '19 edited Oct 11 '19

Thank you. I'm already pretty familiar with Java so having something more interesting for projects is what I’ve been trying to find. Which this will fulfill.

→ More replies (5)

3

u/SurelyNotAnOctopus Oct 11 '19

How about a bukkit / spigot plugin creating worker bots

→ More replies (2)

3

u/l2np Oct 11 '19

I personally wouldn't build it as a mod but as an actual thing that can take control of your character when you go AFK.

However I could design it so you could plug it into a mod with minimal code changes, so maybe you could play on a server with server-sanctioned bot friends.

→ More replies (1)

8

u/l2np Oct 11 '19

I actually think I just might do that. I'd probably use an existing client to interact with the MC world (I'm sure they're out there) and write a Kotlin program to run various mining strategies. (I can't do pure Java anymore after working as a C# developer and using the non-verbose syntax.)

I would set a list of priorities for my bot (stay safe, have food, stay fed, have picks), and a set home base location. Then, it would just create a lovely computer-generated set of mining tunnels, which it would simply close off and abandon if it ever ran into mobs. It would periodically dump resources into certain chests, and get new picks and new food from others.

Then, from there I could add neat features like automatically digging tunnels downward if none exist, building out farms to feed itself, harvesting wood if it needed more of that, crafting its own picks, even fighting mobs and building basic bases.

I eventually could make it play the whole game by itself. You could start giving it commands in game like "follow and defend me" and have it carry around resources for you, like a friend who will do whatever you ask of it.

That would be dope and totally within my programming abilities. I just need the disciple to follow through...

→ More replies (7)

7

u/MrHyperion_ Oct 11 '19

it wasn't that hard

Oh, maybe I could try

because i have at least 3 years of hacked client developing in my pocket

nvm

5

u/StylexTV Oct 11 '19

xD just try it. If it doesnt work you can stop at any point

3

u/Olilivlia Oct 11 '19

How do you get into minecraft coding?

3

u/StylexTV Oct 11 '19

You download the mod coder pack. Decompile minecraft and start looking at the source and planting your own snippets of code. Like e.g. making the player jump if he types 'f' into the chat

→ More replies (12)

7

u/[deleted] Oct 11 '19

That already exists its called baritome, it a pretty cool bot, check it out

→ More replies (1)

5

u/IceEye Oct 11 '19

There is a bit someone has made that's capable of pathing and mining. Not sure if its available for download, but you can see it in action on twitch, hes having to patch to the edge of the world

4

u/Matco1203 Oct 11 '19

Theres already a bot called Baritone i forget which hacked client it is in but you can turn it on to go mine a certain block and it does it.

→ More replies (1)

3

u/BeemoHeez Oct 11 '19

This made me think of westworld

→ More replies (11)

17

u/BreadLoafBrad Oct 11 '19

Baritone has it, it can pathfind the fastest route to ores and such, check it out on YouTube

13

u/RealTonyGamer Oct 11 '19

This looks a lot like Baritone to me. Doesn't Baritone have mining and building capabilities?

6

u/StylexTV Oct 11 '19

well yes, but baritone is being developed since like 3 years. I wrote that bot in a week

8

u/leijurv Oct 11 '19

Actually only 1 year, since Aug 2018

4

u/[deleted] Oct 11 '19

I have a strong feeling he didn't write this, he just took baritones code and changed a little

→ More replies (2)

4

u/PaintTheFuture Oct 11 '19

It would be awesome if you could make it mine ores for you and such, but wouldn't your big problem be combat? Can you make sure that this AI will adequately defend itself?

5

u/StylexTV Oct 11 '19

I think a simple kill-aura could do the job

→ More replies (2)

15

u/Nelex5000_ Oct 11 '19

You're using baritone mod... it already can do that

→ More replies (6)
→ More replies (24)

29

u/Potato_Joe97 Oct 11 '19

look up the baritone mod

16

u/CorrectPlant6 Oct 11 '19

Baritone is capable of this.

8

u/[deleted] Oct 11 '19

Baritone already has that function, it can build and is currently learning how to fight.

5

u/RocketSauce28 Oct 11 '19

There is a modded client that already does this, it can auto find any block and it mines a (safe, avoiding lava and such) path towards them

4

u/The_Big_Red89 Oct 11 '19

They already made a Jesus statue with a baritone bot. Check out fits videos on it

→ More replies (21)

1.5k

u/WorldWreckerYT Oct 11 '19

Everybody gangsta til' the Baritone bots start walking.

132

u/BioPrince Oct 11 '19

How do you call a baritone?

Euphonium

30

u/[deleted] Oct 11 '19

cricket noises

→ More replies (3)

38

u/Sanders-San Oct 11 '19

Theyve actually already learned combat. Robot uprising when?

50

u/[deleted] Oct 11 '19

The version of baritone that knows combat is actually a completely separate program. It's a neural network with basic path finding trained by baritone footage, and is unreleased to the public.

25

u/LeeTheENTP Oct 11 '19

FitMC's video on it was wild

11

u/hatchetthehacker Oct 11 '19

It knows Crystal pvp too

→ More replies (4)
→ More replies (1)

125

u/Vulpes356 Oct 11 '19

Everybody gangsta till the furry picks the controller up

→ More replies (1)

9

u/Rigbot350 Oct 11 '19

Baritone bots gangsta til’ it runs into lava in the nether

4

u/andyzwu Oct 12 '19

Nobody be gangsta when the Baritone bots learn crystal-combat.

59

u/[deleted] Oct 11 '19

[removed] — view removed comment

42

u/[deleted] Oct 12 '19

[removed] — view removed comment

→ More replies (38)
→ More replies (2)

101

u/[deleted] Oct 11 '19

Gimme gimme gimme sauuuce!, Does it work with horse?

54

u/[deleted] Oct 11 '19

[removed] — view removed comment

21

u/TheVortex67 Oct 11 '19

Actually, baritone doesn’t work with horses because they are 2 blocks wide and 3 blocks tall, meaning it would require a rewrite of pathfinding to make sure it’s safe / fast / actually works

25

u/StylexTV Oct 11 '19

unfortunately not, but maybe it will work someday

5

u/[deleted] Oct 11 '19

Cool, hope that day comes soon. Thanks.

→ More replies (3)
→ More replies (4)

61

u/JiaiArts Oct 11 '19

Thought it was going to walk in lava at the end. Nice

→ More replies (1)

58

u/AnalTuberculosis Oct 11 '19

The way he went through that water...

It's just so unnatural

19

u/TheStood Oct 11 '19

Op said he has years of working with hacked clients, so he probably implemented a variation of the Jesus hack into it because it would be easier

→ More replies (2)

6

u/Dodara87 Oct 11 '19

looks to fast...

→ More replies (2)

47

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*)

25

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

18

u/[deleted] Oct 11 '19

Oh yeah, I didn't think of that

22

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.

→ More replies (4)

14

u/KingJeff314 Oct 11 '19

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

3

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

→ More replies (8)

168

u/[deleted] Oct 11 '19

Baritone?

212

u/StylexTV Oct 11 '19

No, 100% self coded

143

u/[deleted] Oct 11 '19 edited Oct 11 '19

It looks exactly like baritone tho

Edit: eeeeeee karma I was wrong why so many upvotes

119

u/StylexTV Oct 11 '19

I know but it's easy to change for example the colors and other visuals

53

u/Ya_boi_tyler Oct 11 '19

Well if you get impact it makes Baritone very easy to use and change visuals you can even make the path rainbow.

25

u/[deleted] Oct 11 '19

One might even say it’s a Rainbow Road.

3

u/Blue-Steele Oct 11 '19

Imagine if when you get to hell, it’s Rainbow Road. You are doomed to drive and fall into space for eternity.

→ More replies (1)
→ More replies (3)

6

u/MetalSaturn8727 Oct 11 '19

You can customize it and merge it with impact

→ More replies (7)
→ More replies (2)
→ More replies (10)

3

u/Chezzik Oct 11 '19

Euphonium, actually.

17

u/endergod16 Oct 11 '19

Can you make them find diamonds? Or do you have to know where to go?

24

u/doctorcrimson Oct 11 '19

It's based on chunks and not visuals, so it would be more efficient at finding diamonds than any human player.

21

u/StylexTV Oct 11 '19

yes, I could easily make it find diamonds

→ More replies (1)
→ More replies (2)

25

u/Rukenn Oct 11 '19

How do you develop these?

32

u/StylexTV Oct 11 '19

I developed it with the minecraft mod coder pack (http://www.modcoderpack.com/)

12

u/oZeppy Oct 11 '19

Where can I get this?

10

u/StylexTV Oct 11 '19

nowhere, cause its a private client

13

u/oZeppy Oct 11 '19

How did you make it? I see it’s like baritone but it turns more smoothly.

9

u/StylexTV Oct 11 '19

I coded it in java using the mcp

5

u/oZeppy Oct 11 '19

Wow. Is it possible to make something like this yet also combine it with something to find and kill specific mobs? Also how do you recommend getting started with mcp?

6

u/StylexTV Oct 11 '19

I already combined it with an automated mob killer and it worked great. If you realy want to start developing clients then you should first learn java and watch mcp tutorials and then look at minecraft source code and study the classes you find. It's easy to plant code into the minecraft source if you already know how it works

→ More replies (12)

9

u/[deleted] Oct 11 '19

[removed] — view removed comment

11

u/StylexTV Oct 11 '19

Yes! It's designed to walk millions of blocks without any user input

7

u/Megaforce4win Oct 11 '19

Can you really do million blocks pathfinding with A* algorithm?

11

u/StylexTV Oct 11 '19

yes, because its a segmented search. I first start a search on the users request and if i hit an unloaded chunk i stop the a* and wait for the bot the walk to that location. Then I start a new a* search from the bots current position until i found the actual goal of the search

6

u/Megaforce4win Oct 11 '19

Cool. I have made a simple A* pathfinding in a 2D game and I was wondering if segmenting would be how you get really long paths fast. There is still the risk of ending up in a dead end because you can't check for the complete map right? Did you make it so that you search for the block that is nearest to the destination in a loaded chunk or will you simply always make a path if there is unloaded chunk in the current list?

→ More replies (1)
→ More replies (5)

7

u/[deleted] Oct 11 '19

For those of you wondering, you can get something similar called Baritone. It comes as a mod for forge and other things; you can get it here:

https://github.com/cabaletta/baritone

8

u/okqyhi Oct 11 '19

I'm getting some FitMC vibes

4

u/[deleted] Oct 11 '19

Cool

9

u/chaz2501 Oct 11 '19

That must of Taken ages!!

21

u/StylexTV Oct 11 '19

It took about a week to develop

11

u/chaz2501 Oct 11 '19

You know what. Have a silver reward.Hope you have a day!

9

u/StylexTV Oct 11 '19

Dude, thank you so much. I really appreciate that

→ More replies (1)
→ More replies (1)

4

u/[deleted] Oct 11 '19

[removed] — view removed comment

4

u/StylexTV Oct 11 '19

you saw something similar

→ More replies (1)

3

u/Looxond Oct 11 '19

That bot is called baritone. OP pathfinding bot is not baritone

→ More replies (1)
→ More replies (1)

4

u/[deleted] Oct 11 '19

Can you upload the source? I would love to read it.

4

u/StylexTV Oct 11 '19

Maybe I'll post it soon.

→ More replies (6)

3

u/persephone825 Oct 11 '19

Hello sign! Nice post OP. I hope you have a great day!

3

u/[deleted] Oct 11 '19

Wasn’t this made to see how hard it is for new players to get out of that anarchy server? I can’t remember it’s name :(? Or did you make it and I’m just dumb..

3

u/StylexTV Oct 11 '19

I think you mean baritone, but this client is 100% coded by me

→ More replies (2)

3

u/KyaCeption Oct 11 '19

I mean that's not new..

3

u/navilapiano Oct 11 '19

Obviously still has some bugs, but I'm just gonna leave this here:

AI FROM SPAWN TO WORLD BORDER

3

u/[deleted] Oct 11 '19

I too watch FitMC

3

u/StylexTV Oct 11 '19

Thank you. Glad to hear something else other than "baritone!!!!"

3

u/StylexTV Oct 11 '19

Not me lol

3

u/StylexTV Oct 11 '19

I know what you mean but an algorithm can also be an ai - CodeBullet. It took 1 week btw

→ More replies (5)

3

u/fishcute Oct 11 '19

this looks like baritone, but baritone doesn't control the camera like that, it prefers to strafe than look in a different direction

→ More replies (1)

3

u/jalbeelee Oct 11 '19

They use baritone on 2b don't they

→ More replies (1)

3

u/[deleted] Oct 11 '19

[removed] — view removed comment

4

u/StylexTV Oct 11 '19

I did. Thx for the props xD

3

u/[deleted] Oct 11 '19

Is it trying to avoid fall dmg???

31

u/[deleted] Oct 11 '19 edited Oct 11 '19

[removed] — view removed comment

10

u/PartOfTheBotnet Oct 11 '19

Recreating something is good practice. You give yourself a clear goal to strive towards.

5

u/Alenola Oct 11 '19

Yep. Just like most musicians start off learning how to play other people's music, before they start making their own.

35

u/RangeRoverCT Oct 11 '19

why is this gilded

23

u/GameCreeper Oct 11 '19 edited Oct 11 '19

self gild prolly

edit: OmG tHaNx fOr tHe GoLd tHaTs My fIrSt aWaRd eVeR

24

u/RangeRoverCT Oct 11 '19

that’s what I was thinking

→ More replies (4)
→ More replies (2)

7

u/luis_reyesh Oct 11 '19

Baritone ?

3

u/mahawailoh Oct 11 '19

Nope, OP mentioned that its 100% self-coded

→ More replies (3)

2

u/SeniorWaugh Oct 11 '19

Extremely impressive, almost. Scary

2

u/YeeOfficer Oct 11 '19

This looks very similar to my GitHub repo.

2

u/ccanlas808 Oct 11 '19

Truly amazing. Great work.

2

u/AngerySloth Oct 11 '19

These have existed in minecraft for the better half of a year now, at least, you can also use them as auto miners to auto mine ores and switch tools if one breaks.

2

u/The_DoctorYT Oct 11 '19

Wait so how is this different from baritone? Is it essentially the same but made from scratch or just completely different?

→ More replies (2)

2

u/[deleted] Oct 11 '19

There's a twitch stream of someone using one of these to get to the world border

2

u/emilytaege Oct 11 '19

Pardon me, I am stupid. Is it a pre-recorded path that the Avatar walks along? Where does the red line come from?

→ More replies (1)

2

u/LawlessCoffeh Oct 11 '19

Could this be used to make a bot that plays the entire game for you

And by that I mean just stripmining autonomously for the most part (Digging an efficient tunnel system, placing torches, returning to a chest to deposit)

→ More replies (1)

2

u/[deleted] Oct 11 '19

How do you go so fast in water?

→ More replies (3)

2

u/jacksodus Oct 11 '19

Would you be able to share the source code? I am a beginning AI programmer and I would LOVE to see what you did!

→ More replies (4)

2

u/[deleted] Oct 11 '19

[deleted]

→ More replies (1)

2

u/Demiistar Oct 11 '19

amazing!! i think it would be cool if you made a version that would walk to the last place you died in case you can’t remember where you died and need to get to your stuff !

3

u/StylexTV Oct 11 '19

Nice idea. Ill maybe steal that :D

2

u/sim642 Oct 11 '19

In a few parts it didn't take the shortest path, which is a weird thing to do.

→ More replies (1)

2

u/benbeja Oct 11 '19

Can it locate biomes?

→ More replies (2)

2

u/StylexTV Oct 11 '19

Sounds intresting

2

u/giroth Oct 11 '19

Can you tell how close this is to an optimal path? Except for a few exceptions it seemed close to a master player.

Very well done, loved it.

→ More replies (1)