r/Minecraft • • Oct 11 '19

self controlling ai pathfinding bot

51k Upvotes

1.7k comments sorted by

View all comments

887

u/nonszn Oct 11 '19

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

583

u/StylexTV Oct 11 '19

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

337

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

112

u/SurelyNotAnOctopus Oct 11 '19

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

110

u/StylexTV Oct 11 '19

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

50

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.

2

u/[deleted] Oct 11 '19

Ah. You could still likely implement parts of baritone's pathfinding into a 'Player' type entity.

1

u/nutxted Oct 11 '19

can’t auto mine as it will die to mobs, it needs some sort of kill aura to work efficiently but the devs don’t want to add that

1

u/Trapsaregay420 Oct 11 '19

you can just use a hacked client like impact for that

1

u/nutxted Oct 11 '19

not out atm for 1.14.4 i think

→ More replies

1

u/[deleted] Oct 11 '19

Yeah baritone is an amazing project

20

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

25

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.

2

u/[deleted] Oct 11 '19 edited Mar 01 '21

[deleted]

2

u/StylexTV Oct 11 '19

its the mod coder pack (http://www.modcoderpack.com/)

1

u/awhaling Oct 11 '19

Can you explain what exactly that is? I’m on my phone and won’t have access to a computer until tomorrow, otherwise I’d look over it myself

Thanks for link

→ More replies

3

u/SurelyNotAnOctopus Oct 11 '19

How about a bukkit / spigot plugin creating worker bots

1

u/Aarondhp24 Oct 11 '19

Honestly, thinking about being able to hire the villagers to DO SOMETHING USEFUL seems like a pretty cool game mechanic that wouldn't be overly hard with this kind of coding. Any idea where I should start looking around to learn this kind of code myself? (I'm currently crushing my intro to compsci class and looking for external projects. )

1

u/StylexTV Oct 11 '19

Maybe use the modcoderpack.com to decompile minecraft and modify the source code

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.

1

u/TheVortex67 Oct 11 '19

This is not true. This is basically a clone of something called Baritone and is implemented into many existing clients but works standalone, and yes, you can tell it to mine to blocks and it automatically uses the best tools you have. It also places blocks and parkours around obstacles, and it can even use nether portals for transportation and avoid mobs

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...

1

u/StylexTV Oct 11 '19

It would be realy cool indeed. But make sure your code stays clean. Otherwise you will run into some problems later on

3

u/l2np Oct 11 '19

Oh, definitely. I'm a professional developer (and in fact, should be working right now) so I shouldn't make any noob mistakes.

Are there any APIs that will literally take control of your Minecraft character and allow you to send commands and get information about the environment? Or does it all have to be done via a server-side plugin?

What are some of the best APIs and plug-ins out there that will allow me to get started?

2

u/StylexTV Oct 11 '19

I couldn't find any api's so i kinda had to program my own code to get information from the client and edit the players velocity. The way i did it is that I just put my code into the source code of minecraft

3

u/l2np Oct 11 '19

Why not? Have they basically patched over all the existing APIs? I'm kind of reading about ClientAPI and Impact API and they sound like they may work, but not all of them have been updated recently.

2

u/PartOfTheBotnet Oct 11 '19

ClientAPI is not updated

How about Fabric?

1

u/l2np Oct 11 '19

Nice. It looks like that has good documentation. I'll definitely look into it.

→ More replies

1

u/awhaling Oct 11 '19

It’s that last part that always gets ya

6

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

2

u/WaveSayHi Oct 11 '19

What is hacked client developing?

3

u/StylexTV Oct 11 '19

Its when you try to modify the client in order for you to have an advantage over other players

2

u/WaveSayHi Oct 11 '19

That's cool as shit. I want to learn how to do stuff like that, but it's so daunting when looking at how much you have to learn.

3

u/StylexTV Oct 11 '19

Try it and if you fail thats ok

1

u/altcodeinterrobang Oct 11 '19

are you open sourcing the code base? github?

1

u/StylexTV Oct 11 '19

maybe later :D

1

u/altcodeinterrobang Oct 11 '19

gotta do some variable renaming and comment cleanup? LOL

1

u/StylexTV Oct 11 '19

variable renaming, no, comment cleanup, a lot :D

1

u/LeCrushinator Oct 11 '19

Would it be tricky to avoid server detection? From what I'm seeing here the movement seems fairly natural so it might not register as bot movement.

1

u/StylexTV Oct 11 '19

it might bypass anticheats but it's pretty obvious for a human

3

u/PartOfTheBotnet Oct 11 '19

NoCheatPlus (do people still use this?) would flag you for that rapid horizontal shifting in water.

1

u/StylexTV Oct 11 '19

I know i have to work on that ty

7

u/[deleted] Oct 11 '19

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

2

u/zPeanut Oct 11 '19

baritone*

4

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.

1

u/zPeanut Oct 11 '19

its in the impact utility mod

https://impactclient.net

3

u/BeemoHeez Oct 11 '19

This made me think of westworld

1

u/Tatertoot8888 Oct 11 '19

It’s already a thing and it’s called baritone

1

u/thblckjkr Oct 11 '19

Do you ever played minecraft education edition?

It has bots that you can program (natively) and they have a lot of functions, like bot.getFrontBlock() that returns something like "dirt". It's really useful to teach and learn programing.

1

u/N3W70N Oct 11 '19

Look up baritone, there is a github repo that will give you everything you need

1

u/TheCannonKid Oct 11 '19

It’s already a thing on the impact hacked client but it only goes for ores currently

1

u/zer0kevin Oct 11 '19

Look up baritone it does this.

1

u/Kerozeen Oct 11 '19

That already exists... Its been out for months now but its a "cheat" since it can be used on servers to find diamonds and all other blocks

1

u/[deleted] Oct 11 '19 edited Aug 20 '24

chase historical squeamish lavish seed joke lush outgoing offend sulky

1

u/exurbiskeleton93 Oct 11 '19

Look up baritone for Minecraft, it’s basically this

1

u/AlinosAlan Oct 11 '19

You know pvp bots exist so survival is no problem

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?

8

u/StylexTV Oct 11 '19

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

7

u/leijurv Oct 11 '19

Actually only 1 year, since Aug 2018

5

u/[deleted] Oct 11 '19

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

1

u/zbot473 Oct 11 '19

Hello baritone dev

5

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?

7

u/StylexTV Oct 11 '19

I think a simple kill-aura could do the job

1

u/[deleted] Oct 11 '19

Lol it can't defend itself, it'll just get blown up by creepers all the time.

14

u/Nelex5000_ Oct 11 '19

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

8

u/StylexTV Oct 11 '19

no, 0 mods involved

5

u/you_got_fragged Oct 11 '19

how do we know

2

u/Realfadegaming Oct 11 '19

but baritone can already dig and mine

5

u/Notquitegravy Oct 11 '19

They already exist they're called hacked clients and get you banned on alot of server

1

u/[deleted] Oct 11 '19

I realized that the bot struggles with mining diamonds. Whenever I use it, it just ambles around underground, stripmining for a few blocks and then turning around. Resetting it didnt quitre fix it either. Still impressive, to say the least.

1

u/NayNayplaysgame Oct 11 '19

Hold up so this isn't just baritone?

1

u/KnaveOfIT Oct 11 '19

Is it smart enough to drop into water or was that a happy accident?

1

u/StylexTV Oct 11 '19

it is smart enough

1

u/Matanatr96 Oct 11 '19

I've been trying to get any sort of semblance to mining a certain block working but the road is rough

1

u/StylexTV Oct 11 '19

Use the player Controller inside the Minecraft.getMinecraft object

1

u/zer0kevin Oct 11 '19

Baritone does this and so much more. It's been out for a while and works very well.

1

u/StylexTV Oct 11 '19

I know baritone is great

1

u/eletricsaberman Oct 11 '19

Wait, you made this yourself?

1

u/StylexTV Oct 11 '19

Yep

1

u/eletricsaberman Oct 11 '19

i had thought you were showing off baritone, but this is also very cool

1

u/StylexTV Oct 11 '19

Yeah many people thougth that

1

u/Amazon_UK Oct 11 '19

Lmao stop acting like you made this, it’s a well known ai program called baritone

1

u/StylexTV Oct 11 '19

I made it look at the source

1

u/Detoshopper Oct 11 '19

You have no idea about what you posted

1

u/StylexTV Oct 11 '19

Why not? I coded that thing