cabaletta / baritone

google maps for block game
GNU Lesser General Public License v3.0
7.15k stars 1.43k forks source link

Better area mining (impove #sel) #1791

Open Dryhb opened 4 years ago

Dryhb commented 4 years ago

[It's a bit long but I explain how you could implement that using existing features]

A more advanced mining method for larger areas (better than #sel)

Details

Currently, the "classic" #sel method for an area is to get in the approximate corner of the selection and stop moving, mining blocks in reach doing like a hole straight down. After the bot dug to the last y-level it will move the side and continue to dig in hand reach and will make some kind of tunnel at the lowest level of the selection. After clearing all the bottom part of the selection, he'll find a path to the top and restart the process (mine down then over) until the area is cleared, leaving different path on the side on the selection. I think this is due to the code that manages the most efficient mining method: no movement, only head movements. In the code of the game (can be experienced in-game) when the player moves or is being moved, the mining time is longer (by not a lot but on a large number of blocks, it makes the difference). By standing still, the player has the maximum mining speed. Now that the current mining method used by Baritone, I'll explain my suggestion of layer by layer digging. In the most known digging servers (servers that digs millions of blocks to make big holes) use a method of 45° left or right, 45° down and left(or right) sprint at the same time as a forward sprint ( that makes diagonal sprinting). Experienced players can reach easily 33kblocks/h dug (overworld terrain (caves, dirt & gravel and other) and 45k/h in the nether roof (almost no lava). To use this method, it requires preparation: speed 2 and haste 2 beacons (haste only for ow) to reach max speed. Using that method, you mine 2 layers of the terrain at a time ( at most 20blocks/sec (max speed) mined). Although this method is recognized by many the best one, it's hard to execute properly. The "main" difficulty comes from the angle that the player needs to look to mine the most blocks by block sprinted but also to not left behind "random" blocks that you missed because of the wrong angles by humans. Using a bot for this makes this much easier since you can see the yaw of the player to an exact direction (as done on many other programs on baritone that digs stuff). Sprinting diagonally and looking at a perfect angle and mining at the same time, I don't think baritone does it in a program currently but the bot can sprint in all directions even when the player (human) looks away ("free look"). I don't know if the bot sprint diagonally or not when he wants to go diagonally (he can do forward sprinting with the camera rotated, not sure). In a request like #goto portal, you can interact with blocks while the bot walks (breaking, placing and opening GUI). Now we know that the bot can walk in a specific direction and mining blocks can be separated. The bot "could" (not 100% sure) force a view angle to have perfect orientation for digging. For the speed and haste, this can be easily "bypass" using speed &/or speed mine (for ex on wee client) or as a timer (most clients have it(makes you do everything faster)). To make things easier (the goal is to apply that to a really large area (maybe even more than render distance) to dig. You could enter (maybe similar to WorldEdit) the corners using a tool( as a debug stick for ex a pickaxe) setting an area to dig. Using different client or timer the speed values could change (if you change mining speed then it won't be instant mining then useless to use this method) Baritone could detect the speed of the player and adjust the movement speed with the mining speed & angle. The bot will need to stop or at least slow down a lot while mining ores (most of the time multiple at once or blocks that are slower to mine (infected blocks, obsidian and grave & dirt (or just change tool)). I don't have footage of the method now but I'll record a bit to be better to understand when I have more time.

Settings

1 - A setting with the number of layers to dig at once (most useful is 2 and 1 because 2 is most efficient and 1 could be used for the last layer of the area) but 3 and more "could" be available tho much less efficient and looking way less legit.

2 - Another setting that could autodetect the speed of the player(if possible) or not, if so, input the speed values ( forward, side, diagonal and back ) to make it possible.

3 - Maybe a setting "collect materials" to collect every item or not and a sub-setting with possibly a list of the items to keep ( for ex keep diamonds but don't collect cobblestone)

4 - A setting for the "tool" item to select or just in the command of the type

perimeter [corner1 x y z ],[corner2 x y z ] [number of layers (1-5)] [collect 0 or 1 or 2 (0 = don't collect any, 1 = collect all, 2 = collect listed items]

That's how I see the command for the perimeters kinda like this but it can be in "gamerules" like #collect items false/true/choose or #dighigh 1/2/3/4/5 things like that.

Context

I am not even sure if it's possible but seeing the capabilities of the bot today, I think so. The context would be to make a hole to make a base or put a farm into or just to look cool. You would have to get the setting #assumewalkonwater and #assumewalkonlava true or false (probably false for lava) because liquids could conflict the mining method and speed. (remove all liquids) The main goal is to make a better #sel mine using specifics configuration(best configs) for the best efficiency of digging.

I'll add footage of the method when I will have time. Contact me via discord Dryhb#7685 for more info or other.

5HT2 commented 4 years ago

Can you expand on what you mean by 2? As for 3, you can do that with clients that have an InventoryCleaner module. For 4, Baritone automatically selects the tool it needs.

Dryhb commented 4 years ago

for the 2. I mean that with a different client, the speed hack used can be different (for ex boost of AAC or Vanilla) so the player doesn't travel at the same speed on every clients. For 3. yes, ofc didn't think of it For 4. I meant that you would select the area to mine using a tool like WorldEdit (select the corners by right-clicking on a block). An alternative to the "tool to mark the corner" use the position of the corners in the command

5HT2 commented 4 years ago

For 2, Baritone doesn't support speed hacks of any kind, and it most likely won't in the future.

For 4, you can already to that. #click

Dryhb commented 4 years ago

Does it support beacon effect ? or could it because the mining method require the speed 2 effect to work at full efficiency

  1. ho yeah sure I just wanted to include it in a command if possible
5HT2 commented 4 years ago

Iirc it supports vanilla speed effects but not much else

Dryhb commented 4 years ago

That's enough then. If it ever gets coded it would need to know that the player must have speed effect for best efficiency but using beacons or potions only and no hack

Dryhb commented 4 years ago

If it's not possible to make the best method, maybe just add a rule to dig per layer similar to build per layer for the schematics. I talked to a dev and he suggested the dig per layer Idea would ne easier