←  Turtle Programs

ComputerCraft | Programmable Computers for Minecraft

»

Swarm Miner - Quarry Up Where You Want. Ve...

Wojbie's Photo Wojbie 13 Oct 2013

Swarm Miner has been discontinued.
Its better bigger brother Swarm Driller&Miner is in development.
Current ETA: Heat Death of Universe.


Swarm Miner - Quarry up where you want. v2

Swarm Miner is a simple Swarm Turtle Quarry system that mines out area defined by you by dividing it into smaller sectors and mining them one after another.
Unique part in this design is that Turtles don't have a Server/Overseer Computer. All data is synchronized between turtles and each turtle decides on its own where to go/what to mine.
This allows mining of large areas without much hassle.

Download Here: http://pastebin.com/LXLBZK25
Or ingame by providing empty Floppy Disk in Disk Drive and using command:
pastebin get LXLBZK25 disk/startup
(requires http-api to be active)

Image Album with a walkthrough of basic setup - http://imgur.com/a/RcSCw
Image Album with small showcase of features(not all) - http://imgur.com/a/g7rfX

Video Advert made by Lewanator1


www.youtube.com/watch?v=4Nucy7APDz0

Features List:
  • Mining of Preset Area
  • Uses Standard by now 3 layers at once mining system.
  • No limit to amount of turtles working - you can use 1 or 30 - it will still work like it should with turtles talking to each other and working together.
  • Included Scanner that shows where turtles are in area and what they are doing/mining.
  • Ability to continue from where it stopped after server stop/crash or chunk unload
  • Delivers mined blocks in selected chest or into provided Enderchest
  • Refuels from selected chest or from provided enderchest
  • Can drop unneeded cobble (or any other material) increasing time it can mine between dropping mined material/decrease amount of trash in mined material
  • Automatically recognizes chests and removes content before mining it
  • Never mines anything that is a peripheral (chests from feature before excluded)
  • Auto stops at y=5 - never gets stuck on bedrock! Mines layer 4 if needed. (can be changed to dig deeper in case of flat bedrock)
  • Full installer floppy disk that downloads other files and can update them if asked (update attribute)
Side Features List:
  • Minimal mining level can be adjusted by changing levelmin value inside swarminer file on the floppy disk.
  • Installed Vacuum cleaner that collects most of dropped items that turtle finds while mining
  • Breaks minecarts and collects them too. In case of storage minecarts most of contents gets picked up by Vacuum cleaner.
  • Startup files in miner and scanner contains Top Level Coroutine Overwrite that removes rednet coroutine and Api. That lovers amount of event that turtles receive by half.
  • Main Installer Floppy Disk automagicly detects witch drive its run from and allows auto installation or miner or scanner depending on if its run on turtle/computer
  • Scanner can be used to pause/unpause turtles in its area of effect
  • Main Installer Floppy Disk can be preformatted with order that allows faster deployment of mining turtles
  • All Mining Turtles and Scanner contain gps host code spreading gps signal in area
  • Automatically add labels to all data storage mediums its used on.
  • Scanners share data about turtles in their zones of influence.
  • Emergency Beacon - any Turtle that crashes to shell will emit ERROR Signal
  • If You place a Monitor next to Scanner it will print basic stats data on it.
UI Information
  • In Mining Turtles:
  • Press "p" to pause and "o" to unpause selected turtle
  • In Scanner
  • Press "p" to pause and "o" to unpause all turtles in signal range
  • Press "t" to change type of informations that are provided by it
  • Left Right Up and Down keys move map marker allowing you to inspect map
  • Pg_Up (or "w") and PG_Down (or "s") allow you to scroll trough list of turtles. Map maker will move to this turtle if its possible.
System Explanation/Requirements
  • Instaler file is made to be run from floppy disk - it will not work from "/" but it may work if placed inside any directory (not 100% tested)
  • System requires gps signal in area of its effect ( You can set up effective gps signal in area by setting up 4-5 scanner computers in area [all programs contain gps host code inside of them])
  • gps-less mode is coded hoever its not stable on server crashes and stops
  • To mine area system needs
  • Start Point and Direction
  • Forward Size of one Sector (values under 10 work best - for large area mines simply set large amount of repeats. Also values under 3 while supported may lead to weird side effects.)
  • Sideways (to right) Size of one Sector (same as above)
  • How many blocks down to mine [min 3] (if gets to y=5 then it wont go deeper - can be changed in program code.)
  • How many Sectors to mine Forward
  • How many Sectors to mine Sideways (to right)
  • Manual refuel/dropoff point and direction. (by default its same as start but backwards)
  • Each turtle needs those settings and items to work
  • If it uses Enderchests then it will ask for them
  • If it drops cobble will ask for one piece for furure reference.
  • If neater it will not ask for anything.
  • If starting from preformated order turtle will attempt to get some fuel at start. If has enderchests it will look there or if not it will look in chest above it.
  • Refuel point is a 2 chest setup one in front of this point and one above it. Front one recives Mined items and top one is where turtles look for fuel (if enderchests are used turtles never go here) There is a screenshot of correct refuel point in spoiler below.
  • System includes many undocumented command line options that allow advanced users to use system more efficient.
Unfinished Features List
  • You can define areas (cuboids) inside area that will not be mined by turtles ( can be used to preserve mob spawner ect. Right now only trough adding in predefined order (addzone atribute in floppy disk) or manual editing of order.log file.
  • Full Gps - less mode - Not 100% Stable with current system - can be turned on by manually changing flag in swarminer file.
WARNING - System creates a lot of noise on its own modem channel it uses

Example of usage:
Spoiler

Screens:
Spoiler

Change-log:
Spoiler

Plans For Future:
Spoiler

FileList:
Spoiler

List Of Argument Line Commands in Files and What They Do [For Advanced Users Only] :
Spoiler


Any Comment and Suggestions how to improve Code are appreciated.
Edited by wojbie, 01 March 2015 - 10:58 AM.
Quote

dronf's Photo dronf 14 Oct 2013

Will give this a try tonight after work :D
Quote

HeffeD's Photo HeffeD 14 Oct 2013

I'm very intrigued by this, (It looks amazing! :o ) but I'm fairly new to Computer Craft and Lua, so I'm a bit unclear on how exactly to get this working. Any chance of a step-by-step tutorial or video?

You mentioned that if OpenPeripherals is installed, it can automatically detect an inventory. I'm assuming that this would detect a storage minecart as well as a standard chest? Is any particular turtle expansion required, or will this function with a standard wireless mining turtle?

And you mention that the mining stops automatically at level 5 (with level 4 being a possibility). Is this a strict level limit, or does it just go to where it hits bedrock and determines that this is as far as it will go? I ask because I use the Thermal Expansion mod, and it has a configuration option to flatten bedrock. This leaves a single layer of bedrock at the bottom of the world, so it would be nice if this script could mine all the way down to bedrock at 0 instead of stopping at level 4 or 5. There are often diamonds hiding down in these lowest levels. :)

Anyway, I'm looking forward to trying this out!
Quote

Wojbie's Photo Wojbie 14 Oct 2013

Hmm i forgot that now there are minecarts instead of chests in mines...
It detects chest based on that openperipherals add peripheral to chest and turtle can detect that its connected to it :D
It simply looks if its connected to "container_chest" type peripheral and clears it.
Will need to test how it reacts to minecarts - It simply didn't go thought my head at time.

EDIT: Mob killing routine detects minecarts as mob and kills it - dropping its contents on ground - there is no way around it other then removing anti-mobs code - it cant detect minecart as far as my testing shows (no peripheral) sorry :)
EDIT2: IDEA! By including while trurtle.suck() do loop inside code i could get turtle to pick up those dropped items. It could also work good to pick up items that hanged on mined blocks and special drops from mobs that are not collected by killing turtle. Btb installing vacuum cleaner inside turtles!!!
EDIT2: Vacuum installed and working 90% correct - it should now collect most of contents of minecarts.

As for level 5 limit is code enforced by turtle position in world - i will update it in second to allow you to change it by editing one line of code - right now its kinda all over the place. Simply put it don't consider area below 5 as reachable and can't go there. Good idea didn't think of that. I will go edit code to that right now.

EDIT: Added value "levelmin" in swarminer file - by editing it you can change what is minimal safe level considered in calculations. It has to be manually changed inside installer floppy copy of file - thats one that then gets copied to all turtles.


As for installation video i kinda am unable to make one however in Example of usage:I tried to explain it.
Try simply using it a few times - it usually errors in way that tels you what you did wrong (Unless it don't know that then you get "Something went wrong" error :P )
I will try to make it more simple to understand however English is not my first or second language so i have small problems translating from mind onto paper.
Quote

HeffeD's Photo HeffeD 14 Oct 2013

Hi wojbie, I really appreciate the quick reply and changes to your script!

Your English is very good. :)

You did do a pretty good job of explaining things, I just don't have any experience with disk drives, so things like "Download main file and place it onto floppy disk" don't really tell me how to do that. That's not really your problem though. :P I'll just need to do some reading to figure out how to do that. B)

I'll get it figured out. Thanks for sharing this script!
Quote

Wojbie's Photo Wojbie 14 Oct 2013

Well thanks to you i got idea to include vacuum cleaner into code :P It looks funny when turtle breaks minecraft and then begins to vaccum contents :)

EDIT: Just something for fun - how manu turtles do you see on image?
Spoiler
Quote

Sekky's Photo Sekky 14 Oct 2013

Hi,

I love the idea behind your program, but I cannot get it to work. A few things:
  • Try to have the turtle's check which direction they're facing at the beginning. I've noticed if I don't place my turtles facing north every time they go the completely wrong place.
  • Also, my turtles will not empty their inventories into the drop off chest, they just sit there and select every slot over and over.
  • My turtle got an ambiguous gps position, so it moved and tried again - and then crashed with an error - something to do with __sub
  • Not sure of why these bugs are happening. This is ftb unleashed 1.5.2. I'll reply with more info if you need it.
(Also - permission to do a video on this if I get it working?)
Quote

Wojbie's Photo Wojbie 15 Oct 2013

  • Hmm... There is code that detects direction where its facting. No idea why its not working. works perfect for me but i made this so by definition it should work for me. It cant detect where its facing with no fuel.
  • Either turtle don't have any fuel - give him some for startup or you didn't place drop-off and refuel chest correctly. IN default mode turtle faces backwards from start point for drop off and looks up for refuel.
  • That means there is not strong gps signal in area "ambiguous gps" is i think 3 sources 4 are needed for accurate gps - try setting up some scanners around - they act like gps host too. __Sub part i can't solve cause i don't know witch line it happened at. - can Guesstimate based on your questions but well.
  • I tested it on Unleashed, just computercraft and computerccraft+openPeripherals. So your bugs should not be connected to Unleashed.
Also try running floppy startup with atribute update (disk/startup update) - that should re download latest versions from pastebin - i am Working on it as i get bug reports so updating could solve one.

IF you get it to work i would be grateful if you made a video!!!! That would be AWESOME!!!
Quote

Sekky's Photo Sekky 15 Oct 2013

Huh, It been working perfectly for me today after I ran the update command. I think what tripped it up before was the lack of fuel in a fuel chest. The turtle freezes up if there isn't any fuel in the chest. Also, configurable fuel would be nice. Every turtle requiring 1000 fuel to even start is draining my coal like nothing, and I don't have a reliable source of lava yet. I'm going to look into alternatives though. Also, It would be nice if the turtle only attempted a refuel if its fuel was under a defined fuel level. Other requests: An option to clear the current order when a warminer boots, a recall option from the scanner that makes the turtles drop off their inventories then line up next to the start would be nice, and an option to put a percentage of usable fuel items in the refuel chest would also be nice.All of these are just suggestions, I love the program how it is. Once I get the resources for more turtles, I'll definitely make a video and post it here.
Quote

Wojbie's Photo Wojbie 15 Oct 2013

Hmm ok then lets look into it:
  • From fuel standpoint i was using 1000 during testing. I meant to change it to 100 + distance from refuel point but i never go to it.... It will be in next update (tomorrow probably).
  • The way to clear current order and a recall function are coded into turtles - it simply never got added to scanners. I will look into adding it to scanners. Hoewer due to probable damage it could cause to your mine it will probably be a argument called when manually running scanner and not an option inside scanner.
  • For the last part i don't think there even is the way to detect amount of viable fuel in chest - i could detect all items in chest and divide it by space left... but that would not give you info how effective each item is and if someone simply didn't put a ton of cobble into it.
Cheers and again - any video that you make would be a great help for me. Not to mention awesome :D

EDIT:
  • Refueling System tweaked - Now it refuels based on how far it has to go from where its mining to refueling station (in case of Enderchests how far its from start of mine so it can always go back) + small buffor just in case. Also now don't overfuels - fuel it don't needs is placed back in chest.
  • Added WipeOrder, Goto, and Emergency arguments to scanner. First one WipesOrder - Second issues Goto command to provided cords (asks for them) and 3th one Crashes all turtles in area (Emergency Break :) )
  • I think detecting amount of fuel in fuel chest could be done with OpenPeripherals but i am not that good with that. :) Sorry.
  • Also i will make Documentation of all Arguments that can be called in Scanner/ Swarminer and Installer and what they do. Most of them are Redundant but could be useful for people.
Quote

Sekky's Photo Sekky 16 Oct 2013

Awesome - You rock.
Quote

Wojbie's Photo Wojbie 17 Oct 2013

Update -Small bug-fix - now should gather contents of chest minecarts more reliably.
Quote

lewanator1's Photo lewanator1 19 Oct 2013

Hey,

I'm having some issues setting it up.
Is there a video or a picture walk-through on how to set this up step by step?
Quote

Wojbie's Photo Wojbie 19 Oct 2013

There is no video sadly - i am unable to capture minecraft without blowing up my system.
Never thought about making picture walk-through. Great idea!!!!
I will make one right away.,

EDIT: Walk-through http://imgur.com/a/RcSCw
Quote

lewanator1's Photo lewanator1 19 Oct 2013

Nice program! I mean really nice program its awesome!

Few ideas i have

Add more blocks to be dropped (Sand, dirt and gravel etc or even add your own)
When dropping off blocks they que normally insted of moving arround alot (Few of mine have ran out of fuel from that)
Turtles getting stuck and pacing forward and backwards (Il upload a video of this happening soon)
Turtles talking to main scanner computer to say when there out of fuel (Maybe a red F next to it?)

Apart from that i love this program, nice work
Quote

Wojbie's Photo Wojbie 19 Oct 2013

Well truthfully you can place any block in "cobble" slot and it will be dropped.
I didn't code for more slots cause each slot that is dropped is one less slot for mine-able materials.
While its a good idea i don't think i will have time to add it to design, that would require rewrite in about half of functions.

Refueling que kinda got scrapped after turtles started eating each other.
Thats when i coded in enderchests support ;)

Pacing forward and backward is a new for me. o well another bug i guess.

You can press t in scanner to switch to 2nd page of data. Fuel levels are included there.
Quote

lewanator1's Photo lewanator1 19 Oct 2013

Oh ok i understand what you mean with the first two things
Il add the video of the stuck turtle soon
I didnt know you could do that :P

Thanks
Quote

Wojbie's Photo Wojbie 20 Oct 2013

UPDATE! 1.3
  • Added queue system for refueling purposes
  • Added time of last message to scanner system (in second page - press t to toggle to second page)
  • Refueling code optimized - now 3 times faster
  • Added compression code - Turtle will always check if he can't squeeze a little bit more space in its inventory.
  • Bug-fix in path-finding - tx to lewanator1 for finding and reporting bug.
Run
 disk/startup update 
on your swarminer disk to download latest version
Quote

lewanator1's Photo lewanator1 20 Oct 2013

Check your messages :)
Quote

Wojbie's Photo Wojbie 20 Oct 2013

UPDATE! 1.3.1
  • Scanners now attempt to share info about turtles in range.if data about turtle was received form another scanner (and said turtle is out of range of this one) it will show distance of "EX" (in second page - press t to toggle to second page)

Run
 disk/startup update 
on your swarminer disk to download latest version
Quote