This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
PTS's profile picture

Mine Manager for turtle fleet

Started by PTS, 16 March 2012 - 08:36 AM
PTS #1
Posted 16 March 2012 - 09:37 AM
I've put this software together for our server but I figure it's good enough to be published. It supports up to 4 turtles and works best in strip-mining operations. I considered adding support for a larger fleet, but your hands will be full taking care of just these guys, they work fast!

Features:
  • Manage all droids from a centralised location
  • Droids report their status and progress so you know what's going on and when to intervene
  • When the cargo hold is full, droids will automatically drop off and then return to where they stopped
  • Distress call when obstructed by mobs or players (will resume working as soon as obstruction is removed, no need for further orders)
  • Easy to use GUI with all information visible at all times
  • Works with 1.3 and 1.31 (read notes)
Some screenshots
SpoilerMain menu on the server

Entering mining location

Droid report

Status report on the server
Server
Turtles

To install, go to .minecraftsaves{worldname}computer and extract the contents of the appropriate archive into the folder of the computer/turtle you want to use (you can check which folder you need by entering 'id' on a console or turtle in Minecraft). I have not made an installer cause it's been just me maintianing the computers on our server and if the foreman had a problem I went there and fixed it. I do consider it for a future release though.

NOTE: This software does not work as an API, because there are several files that chain-load. If you place the files in the API folder you will get errors. Remove calls to os.loadAPI() if you want ot use it this way (make sure you know what you're doing first).

How to use:
  • Turtles
Spoiler
  1. Install the droid software on each wireless turtle
  2. Enter the coordinates of every droid using 'setcoords' (can be skipped if you use a dock)
  3. Run the droid software on each turtle with 'remote-bot' and when asked, enter the ID of the server
  4. The droid will then say what it's ID is (in case you don't know yet), make a note of all four IDs (you can use less turtles too)
  5. Make sure you don't exit the program by pressing '0', this wil terminate the connection! Just hit Escape on your keyboard.
  • Server
Spoiler
  1. Install and run server software (remote-pc). You need a console with a rednet modem on it's right side!
  2. From the main menu, select 'Change droid ID'
  3. Note your selection box is now focused on the four items in the uppoer left. Select on and you'll be asked to enter a new ID.
  4. Repeat step 3 for up to four droids
  • To set up a mine
Spoiler
  1. Make sure your droids are position where their drop-off point is (preferably facing a RedPower filter or similar contraption)
  2. From your server, select 'Mining operations' and then select which droid you want to use
  3. Enter the coordinates for the starting point. This part might be a little tricky, so pay attention. The robots always go towards +x and +z when they dig, so the position you enter must have the smallest coordinates in both directions. What this means is, once you have selected a rectangular area you want to excavate, stand in one corner and face direction 0 (south). The droid will dig forward and to the left from this position. Keep checking until you find the corner in which when you face south, the target area is contained to the left and infront of you. I will add some schematics later.
  4. Now enter the size of the individual hole. Width and Length are pretty obvious, Max depth is the Y coordinate to which the droid will dig. So if you specifiy 15, the hole wont be 15 deep, but will have it's bottom layer on coordinate Y = Max depth (I guess it should be called Min depth). There's a built in safety to prefent droids from hitting bedrock, so you cannot go beyond depth 5 (even if you explicitly specifiy it, this means this program is useless on superflat worlds!)
  5. Check all the coordinates again and confirm your selection with 'y' and Enter. If you made an error, type any other letter and you'll be asked whether you want to enter new coords or to cancel the operation altogether.
  6. Repeat all steps for the rest of your droid fleet
  • To set up a dock
SpoilerAs of 1.31 this function is pretty much obsolete, but I'm including it for compatibility reasons. A dock is usefull if you intend on using lots of robots for various purposes and you need them to know where they are in the world. It can also come in handy if you want to manually remove a stuck mining droid and place it back.
  1. Construct a dock, consisting of one empty block, surrounded by blocks on three sides. Blocks above and bellow are irrelevant.
  2. Make a note of the coordinates of the empty space and the direction of the unobstructed side.
  3. Enter those coordinates in the server by slecting 'Change docking coordinates' from the menu
  4. Whenever you want to calibrate a bot, place or maneuver it to enter the dock, and run the 'remote-bot' program
  5. From the server, select 'Callibrate droid' and select the droid you just placed. Make sure you have entered it's ID in the fleet database first
  6. Wait a few seconds and the droid will have the new coordinates configured. If something stalls, just press space to cancel.
You can see how this can be usefull not just for mining, since you can callibrate a bot and then use it for whatever you want and it's ID does not need to be on the server permanently.
Known bugs and issues
SpoilerMost of these are extremely specific and probably wont ever happen during normal use. And they aren't that much of a problem, just minor issues.
  • You cannot use the 1.31 'vector' function if using any of the included APIs, cause I'm using an object with the same name and similar functionality. The program works correctly with 1.31, but there might be issues if you want to extend/incorporate it.
  • Droids cannot be recalled by the server, because the digging function is a loop and messages cannot be received in it's duration. A workaround is being considered.
  • If droids dig beyond rednet wireless range, progress wont be updated on the server. They continue operation as normal. Currently gateways to extend the range cannot be added.
  • Droids dig most efficiently with even width and length because after every row they return to the starting x/z of the mine. With even numbers this will be a single operation, with odd numbers there'll be two movements. May cause a minor slowdown on very large operations.
  • Droids have a problem with navigating around obstacles that are above them and are wider than a few blocks. You can easily identify a stuck robot cause it'll sit in one position spinning aimlessly. By removing the blocks above it, movement will resume as normal. This may be a major issue, since no distress signal will be sent and the droid will not give up attempting to circumvent the obstruction, so keep an eye for robots that have not returned for a while after reporting they are going to drop-off.
  • If a droid digs into sand or gravel and it falls from above, it will be stuck without sending a signal. You wont experience this unless you use them to dig underground
  • There's a slight diffirence when returning to either odd or even row. If the cargo bay got filled on an even row every time and more than a few times, the droid may erroneously complete the operation before the last few blocks have been mined. May only happen with large volumes of excavating
  • Server settings are not stored as permanent variables. This means you'll have to reconfigure your docking coordinates and fleet IDs every time the program is terminated or the chunk containing the server unloads.
  • Under rare circumstances, when returning after a drop-off, the droid may begin digging from a position considerably higher than the intended (in a location with just air in it). This bug may have been removed in the present version, but it's very hard to recreate. Likely occurs when drop-off happened between rows/levels and there's a barrier around the mining coordinates (as would be the case if the droid is digging a hole)

How I may improve it:
  • Sync all coordinate operations with the new GPS API
  • Add screen support so droid status can be displayed and visible from a larger distance
  • Recall droid function
  • Store fleet data permanently on the server
  • Various automations like detecting all droids in range, surveying the land, assigning large lots that are automatically split in smaller chunks and sending the droids to those chunks without manual entering of coordinates (now easier with screens)
  • Sanity check for entered coordinates. You cannot imagine how much it sucks to accidentally omit a minus and have the droid fly off into the sunset. So if distance is larger than say 100 blocks, confirmation should be required
You can see our mine in this gallery
http://www.failreactor.com/set/88
It took a single foreman about 3 real-time days to excavate the entire volume with 3 droids (we had 4, but one was lost to creepers, and we didn't really need any more to be efficient). The mineral resources we acquired are among the tens of thousands (hundreds of each RedPower gem type and thousands of each common metal ore, including iron). You can see the drop off points (RedPower filters), one for every droid, so they don't dump around if two are unloading at the same time. Sorting machines filter out cobblestone, which is sent to be incinerated in a small lava pool and the rest is split between three silos.
Zer0t3ch #2
Posted 16 March 2012 - 03:59 PM
Looks awesome! I will try it out with some friends on my server after school!
ironsmith123 #3
Posted 16 March 2012 - 08:33 PM
verycool!i see this becoming quite popular!
crimsonknight3 #4
Posted 17 March 2012 - 04:01 PM
Does the turtle have to be a wireless turtle and a modem connected to the server?? I've set everything up as instructed however the mining bot does utterly nothing >.>

[edit] another question while i was reading. does the mining operation HAVE to be directly in front of the droid? For example, my droids co ords are
X -262 Y 74 Z 313 Facing 3. If i told it to dig from X -264 Y 74 Z 313 and have the hole 3 wide 5 long and depth of 50. Or does the droid *have* to face south and have its mining co-ords going South-West? Also do you know of any mod that forces chunk loading to prevent droids disappearing That isnt teleport pipes as thats not been updated?



[edit] nevermind i got it working now (maybe specify wireless miner?) though facing 3 it digs forward the to the right so its direction are different depending on what direction its original position is facing?
crimsonknight3 #5
Posted 17 March 2012 - 05:22 PM
Okay strange behaviour. Got my turtle to mine out a small ish shaft. It says completed 100% 144/144 even though it left out 6 blocks. Now the strange part is that when it got back to its starting postion, it didnt have ANY items in its inventory and it didn't dump out a single item.? I dont know why though?

[edit] Just thought id point out that when i did a test shaft RIGHT in front of its starting position only about 5 deep, it dumped the items out fine
Dreamlash #6
Posted 17 March 2012 - 06:54 PM
When I attent to run the "setcoords" it returns "a attent to index? (a nil value)

and remote-pc attent to call nil

:D/>/>
PTS #7
Posted 17 March 2012 - 11:41 PM
crimsonknight3:
The turtles have to be wireless and the console needs to have it's modem placed on the right side, sorry for not specifying. And you need to run the program on the droids first and then send the mining order.
It doesn't matter which way the turtle is facing when you assign the operation, but this is the direction in which items will be unloaded, so if you have a special block that will receive them (redpower filter or some sort of pipe), it has to be facing that way. The depth variable is actually the depth you want the turtle to reach, not how deep the hole would be (I guess I could have chosen a better name), so if you specify a depth of 50, the turtle will dig down to and including y:51.
Chunk loading is a bit of a problem, but it cannot be circumvented. You need to be around the droids when they work, or else the program will unload (it's what all computers do).
As I've mentioned in the description, there might be a problem with the last few blocks, but it's hardly an issue too great. Your turtle was probably empty from the previous trip but did not realize it had nothing more to dig when it went back, so it came home empty the second time.

When I attent to run the "setcoords" it returns "a attent to index? (a nil value)

and remote-pc attent to call nil

:D/>/>
Did you place all the files in the same folder? In single player, you need to open the folder located in .minecraftsaves<worldname>computer and in there find the appropriate folder. You can see which folder you need by executing 'id' on the computer/turtle you want to configure. All four files from the server.zip must be extracted in the same place (the folder with the same ID as your controlling computer) and every turtle needs all 9 files that are in droid.zip.</worldname>
Kghareus #8
Posted 18 March 2012 - 03:07 PM
Ok I've installed it.

Clicking on the designated server computer returns "rednet:319: attempt to call nil"

Clicking on any one of the droids gets me the same thing but with "File not found" at the top

Clicking on any computer that isn't the server gets "File Not Found" 3 times and then "remote-pc:23: attempt to index ? (a nil value)

and clicking on any turtle that wasn't a droid gets "File Not Found" 3 times and then "remote-pc:23: attempt to index ? (a nil value)

All of this happens upon computer startup. It doesn't let me do anything on the computer.
Kghareus #9
Posted 19 March 2012 - 12:01 AM
Could anyone give me a tutorial or something on how to install this?
PTS #10
Posted 19 March 2012 - 12:42 PM
Ok I've installed it.

Clicking on the designated server computer returns "rednet:319: attempt to call nil"

Clicking on any one of the droids gets me the same thing but with "File not found" at the top

Clicking on any computer that isn't the server gets "File Not Found" 3 times and then "remote-pc:23: attempt to index ? (a nil value)

and clicking on any turtle that wasn't a droid gets "File Not Found" 3 times and then "remote-pc:23: attempt to index ? (a nil value)

All of this happens upon computer startup. It doesn't let me do anything on the computer.

You shouldn't have placed the files in the API folder but in the folder of each computer. Go to .minecraftsavesworldnamecomputer and in there you'll see folders with numbers for names. Each folder corresponds to a computer in the game. While playing, you can approach any computer and type 'id' and it'll tell you which folder belongs to it. Now you can go to this folder and extract all of the files in there, depending on if it's a console (then server.zip) or a turtle (then droid.zip). Also, the console must have it's modem on the right side. The program wont work without a modem and wireless mining turtles.
mememan000 #11
Posted 19 March 2012 - 07:13 PM
~
Edited on 28 August 2015 - 01:39 AM
Kghareus #12
Posted 19 March 2012 - 09:19 PM
Ok I've installed it.

Clicking on the designated server computer returns "rednet:319: attempt to call nil"

Clicking on any one of the droids gets me the same thing but with "File not found" at the top

Clicking on any computer that isn't the server gets "File Not Found" 3 times and then "remote-pc:23: attempt to index ? (a nil value)

and clicking on any turtle that wasn't a droid gets "File Not Found" 3 times and then "remote-pc:23: attempt to index ? (a nil value)

All of this happens upon computer startup. It doesn't let me do anything on the computer.

You shouldn't have placed the files in the API folder but in the folder of each computer. Go to .minecraftsavesworldnamecomputer and in there you'll see folders with numbers for names. Each folder corresponds to a computer in the game. While playing, you can approach any computer and type 'id' and it'll tell you which folder belongs to it. Now you can go to this folder and extract all of the files in there, depending on if it's a console (then server.zip) or a turtle (then droid.zip). Also, the console must have it's modem on the right side. The program wont work without a modem and wireless mining turtles.

Yea. I've re-installed computercraft and it's working now. I'm just trying to figure out how placing some files into a folder could've made all the computers stop working.
PTS #13
Posted 20 March 2012 - 06:26 PM
Yea. I've re-installed computercraft and it's working now. I'm just trying to figure out how placing some files into a folder could've made all the computers stop working.
It's because all the files in the API folder are loaded whenever a computer runs, so if there's an error, ALL computers will have that error. In this current case, remote-bot loads smartmine which loads smartmove which loads pervar, which is ok in terms of how programs work, but then all these files have already been loaded, because they are in the API folder, and attempting to load them again, causes problems. I'm happy you managed to get it to work now.

agsking said:
this is awesome! One problem though is you spelt calibrate wrong in the GUI haha

Do you think you could add some pictures of the dock and which point to enter for the dock coords? or even better if u could make a video of how to do the entire set up.

Also do you have to start all the droids from the docking station or can you start them from anywhere? Whats the purpose of the docking station anyway ha?

and where do the turtles drop off the items relative to the docking station? Mine seemed to put them to the right of it.

and for the facing direction on the dock config is it the angle? like 0-360?


Sorry about all the questions but its really interesting. I cant wait until it supports more than 4 turtles and you improve the other parts :D/>/>

The dock looks like so:

The one block that is missing is the direction you should specify. Just stand in the dock, look out trough the opening and press F3 on your keyboard. You'll notice your coordinates x, y, z as well as a fourth number, denoted as f. This number is the direction. You can start the droids anywhere, but you have to manually enter their coordinates with setcoords. Resources are dropped where the droid starts from, so position it where your receptacle is and then order them to dig, they will come back to the starting location when full or when the job is done. The docking station has no meaning for the droids, other than when you're calibrating them, so you don't need to specify it's location if you're not using it.
I can see how a video would be useful, but I haven't ever made one and honestly don't have the time to do it. But I would appreciate if someone wants to do it for me, I'll provide detailed instructions :)/>/>
pcmaster160 #14
Posted 21 March 2012 - 05:01 AM
This is amazing. Like great job! This has a huge amount of effort put into it I mean like this is huge like very great job. I may make a video of this mod in a new series i'm working on.
My one problem is that you said in the bugs the variables aren't persistent over sessions. Unfortunately this would be a pain for ssp. If I understand it right the turtles will mindlessly mine until the inventory is full? Is there some way to stop them there? So when I save and quit all I would have to do is set their coords and server ids.
FuzzyPurp #15
Posted 21 March 2012 - 06:14 AM
Why not use persistant variables for this? There is alteast 2 on this forum. Cookiebal has one and i believe Liraal doees.
PTS #16
Posted 21 March 2012 - 11:32 AM
This is amazing. Like great job! This has a huge amount of effort put into it I mean like this is huge like very great job. I may make a video of this mod in a new series i'm working on.
My one problem is that you said in the bugs the variables aren't persistent over sessions. Unfortunately this would be a pain for ssp. If I understand it right the turtles will mindlessly mine until the inventory is full? Is there some way to stop them there? So when I save and quit all I would have to do is set their coords and server ids.
Turtle coordinates are persistent over sessions, your only job would be to order them to go back to their drop off point using moveto :(/>/>
They will mine far less from mindlessly, instead once 8 slots are full and the ninth slot has one block in it (meaning if a new ore is encountered, it wont fit in the inventory) they go back to where they started, drop their cargo and then return to where they stopped and resume, all done automatically. If you stop the session mid-course though, they'll just sit there until ordered to move, do something else.
The server console does not store it's data across sessions, but that's hardly an issue, since all you have to reenter are the IDs of the worker droids. It was merely an issue with having too much files in the pv directory, but I've fixed this and will be uploading a new version of the server software by the end of the week.
Why not use persistant variables for this? There is alteast 2 on this forum. Cookiebal has one and i believe Liraal doees.
I am indeed using a system of my own, inspired by Cookiebal, for which he deserves a credit here. I did however made a few features of my own, like the ones you'll see in the next version, namely being able to store entire config sets in the form of lua tables in a single file. I'm also playing around with GUIs and I think it's turning up quite nice.
Aerik #17
Posted 08 April 2012 - 10:51 PM
Epic!

Little question though, how high up does the turtle go on it's way to mining location? Because my first and only turtle just went straight up, out of view, and has yet to arrive at its destination…

EDIT: Hmm, second try seems to be working fine, though I lost that first turtle… (And yes, I checked the coords without a "-")
GhostRecon #18
Posted 25 May 2012 - 09:24 PM
Hello,

First off, I wanted to say - Awesome program! Looks very cool, and when I've gotten it to work, its awesome!

However, this leads me to problem number one: Getting it to work consistently. I'm sure I'm doing something wrong, somewhere, but I just can't get this program to initiate on the Turtles consistently. I'll set the Turtle into remote-bot mode and assign it an ID (Though regardless of what ID I enter, it always enters whatever PC ID it is), then I'll turn on remote-pc and enter in dock coordinates; however, when I try to calibrate the Turtle it always hangs and does nothing. Trying to manual do setcoords and run mining operations off of the turtle when the turtle is suffering the "calibrate hangup problem" has the same results… its like the turtle doesn't register at all to the remote-pc program.

Some notes:
Using computercraft 1.33
Wireless Mining Turtle
Console with Mine Manager installed (modem on right side, based on player orientation)
Dock (Various configurations tried - originally trying to do something with obsidian pipe and teleport pipe, so I can make this relatively mobile)
mariahw #19
Posted 07 June 2012 - 01:22 AM
Thank you for this program, it is exactly what I need, the problem is I got a new computer and reinstalled tekkit, and a server for my own personal use. The program was running great on my old computer and old tekkit, but now after it mines a while the miner stops and
displays the following error:

pervar:33: attempt to index ? (a nil value)

I love this program and can not find anything else like it, please tell me
what I have to do to fix this or what the problem is.

Any help please

Mariah
NeonPhoenix #20
Posted 29 August 2012 - 07:51 AM
hey this is a great program but…

every time a start the Mining Operations option my turtles just spin around in circles on the spot
i have gone through the instructions a thousand times and follow everything to the letter
but no matter what i do it just decides to spin around and around

can you help me please
Tiin57 #21
Posted 29 August 2012 - 08:51 AM
This code was made for 1.3/1.31 and is more than likely outdated and therefore will not work.
NeonPhoenix #22
Posted 29 August 2012 - 11:40 AM
okay do you know when or if this is going to be updated
im using the latest build of technic
roflstein #23
Posted 05 February 2013 - 03:48 AM
I installed this on our server, and I guess it will work, but… The turtle is spinning around in dock? Not moving at all, just spinning.. And there is nothing above or underneath it?
sjkeegs #24
Posted 05 February 2013 - 06:00 AM
I installed this on our server, and I guess it will work, but… The turtle is spinning around in dock? Not moving at all, just spinning.. And there is nothing above or underneath it?
Look at ttin57's post two above yours, and the post just prior to his response.