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

The versatile Shape Builder (updated 05/08/14 - now with diagonal lines)

Started by Keridos, 26 March 2013 - 03:43 PM
Keridos #1
Posted 26 March 2013 - 04:43 PM
So here it is, the thread for the updated shape builder.

Features in the current release:
  • Lines/Rectangles (now even diagonal etc. thanks to CupricWolf)
  • Walls
  • Stairs
  • Platforms
  • Cuboids (Rooms, hollow and nonhollow)
  • Cylinders
  • Pyramids
  • Spheres/Domes/Circles (both up and downwards)
  • 6- and 8- prisms and their 2dimensional counterparts (thanks to CupricWolf)
  • command line interface (also thanks to CupricWolf)
  • resume finally fixed, even without gps (that was me)
  • Ender Chest Refilling (was me aswell)
Its code is based on stuff coded by and been improved by Michiel/Vliekkie/Aeolun/pruby and currently maintaining it on GitHub are CupricWolf and me. (CupricWolf was called happydude before)
The most recent code can be found on GitHub here: https://github.com/K...s/Shape-Builder
The latest "stable" release is also available at pastebin: http://pastebin.com/RAHj4r2K - updated 19/08/14

Tutorial:

You need a mining turtle if your turtle needs to remove blocks to build. A chunkloader module (from MiscPeripherals) makes your turtle work even if no one is standing next to it (very good for smp servers/module currently bugged). A resupply module (also from MiscPeripherals) can make your turtle autorefill its materials -> good for bigger projects.
Place the turtle where you want to build the shape. The turtle will build the shape to its front right side. The turtles starting spot is in the bottom left corner of the square that surrounds your build (trying to get that in a picture if you do not understand what I want to tell with that)

For Enderchest refilling just place an enderchest in slot 16, enable refilling when it asks for that and then keep the enderchest filled with the required building material. It throws away a few pieces of the building material, about 2% of the material to keep unwanted stuff out, cannot be easily done elseway.

Future Additions:
  • More shapes
  • Ability to build stuff upside down
  • GPS support (in the works)
  • Ability to select starting point to be the center of the build.
If you have any ideas for this, just post here or on the GitHub repository.
Same is for any found bugs.

Changelog can be found here: https://github.com/K.../commits/master


ToDo for the thread:
Add Pictures
Edited on 19 August 2014 - 06:26 PM
MrHohenheim #2
Posted 27 March 2013 - 12:22 PM
hi platform thing not solved i build 20x20 and when slot 1 run out example dirt and pick up cobble use this and not move to slot 2 to use the dirt..
Keridos #3
Posted 27 March 2013 - 01:18 PM
eh what?

edit: Didn't want to be that rude, sorry.
kirimato #4
Posted 27 March 2013 - 01:23 PM
I think that he means is that the 20x20 platform building is still bugged. When the turtle is building, he has slot 1 and 2 filled with dirt. When slot 1 runs out of dirt, it picks up cobble and uses the cobble while it doesnt touch the slot 2 filled with dirt.
Keridos #5
Posted 27 March 2013 - 01:39 PM
Ah ok thanks, I will look into that soon, we just need to get that resume stuff working. Stay tuned, should be fixed soon.
MrHohenheim #6
Posted 28 March 2013 - 02:59 AM
I think that he means is that the 20x20 platform building is still bugged. When the turtle is building, he has slot 1 and 2 filled with dirt. When slot 1 runs out of dirt, it picks up cobble and uses the cobble while it doesnt touch the slot 2 filled with dirt.

yes thanks my englis very bad :(/>
Kravyn #7
Posted 28 March 2013 - 04:39 PM
Is there a way I can trigger a sequence of build scripts back to back?

Since I am unable to make it build downwards I am trying to get it to go down and build upwards from the bottom point I wanted it to build from.

like when you make the turtle.down() enough times to reach the point I want then have it do shell.run("shapebuilder") the problem I am having is how do I tell the turtle to fill in the information for me when it asks what shape calculate fuel and the dimensions I want.

I would appreciate the help.

example like:
i=0
setPoint=9
shapeBuild=6


while i < setPoint do
turtle.down()
i=i+1
end
while i < shapeBuild do
shell.run("shapebuilder")
….. this is where i get stuck because when the builder script is triggered it asks for the information step by step.
write("square")
write("n")
write("10")

or instead something like shell.run("shapebuilder square n 10") <———–
end

turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()

while i< shapeBuild do
shell.run("shapebuilder")
write("square")
write("n")
write("8")
end

And keep going til it gets down to the final size set. I dont need full automation just a way to trigger the shapebuilder within my script. is it possible?
CupricWolf #8
Posted 28 March 2013 - 08:39 PM
Is there a way I can trigger a sequence of build scripts back to back?

Since I am unable to make it build downwards I am trying to get it to go down and build upwards from the bottom point I wanted it to build from.

like when you make the turtle.down() enough times to reach the point I want then have it do shell.run("shapebuilder") the problem I am having is how do I tell the turtle to fill in the information for me when it asks what shape calculate fuel and the dimensions I want.

I would appreciate the help.

example like:
i=0
setPoint=9
shapeBuild=6


while i < setPoint do
turtle.down()
i=i+1
end
while i < shapeBuild do
shell.run("shapebuilder")
….. this is where i get stuck because when the builder script is triggered it asks for the information step by step.
write("square")
write("n")
write("10")

or instead something like shell.run("shapebuilder square n 10") <———–
end

turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()

while i< shapeBuild do
shell.run("shapebuilder")
write("square")
write("n")
write("8")
end

And keep going til it gets down to the final size set. I dont need full automation just a way to trigger the shapebuilder within my script. is it possible?
We are working on adding command line access to things like this. Also building downwards will be added with upside down structures. Right now though the biggest concern is resumption, it has several issues that need to be addressed.
Kravyn #9
Posted 29 March 2013 - 04:58 AM
Well resuming any code is a pain and most of the time it requires GPS and a saved file or just saved file recording the last position in the code it ran and the variables + or - it was on within the code. But as said below I am still learning lua.

All I was asking really was if there was a way to make the turtle fill in the information for me. like a write command or a io.read("*a") then trigger a write()? things like that to fill in the information.

I understand you want to get the code out first but by the time I get the code I might be finished building my project manually. Which is a long time from now my point is that I just wanted a quick fix or work around.

I am grateful people are working on this code it seems to be really handy. I am learning turtle lua as fast as I can but every time I spend on it the less time I spend on building. and being on a server I fall behind everyone else. heh
Keridos #10
Posted 29 March 2013 - 02:51 PM
Well I have an idea how to get returning to get working most of the time. Basically the chance of it failing can be minimized, but not decreased to 0% without GPS.
The command line parameters are definitely being added as happydude already said.
Personally I would like to get the code going piece by piece and adding things in older versions is only more work for us.
But as you seem to have a basic understanding of programming take a look in the code of the program on pastebin. It is really easy to understand (you need to take a look at the Choicefunct() function, which basically handles all the reading of the information from the answers of the user).
Maybe when we get a working version of parameter passing I will add that in on the old version but at this moment we have quite a lot of other bugs to fix in our current release "candidate".
CupricWolf #11
Posted 29 March 2013 - 03:09 PM
Well resuming any code is a pain and most of the time it requires GPS and a saved file or just saved file recording the last position in the code it ran and the variables + or - it was on within the code. But as said below I am still learning lua.

All I was asking really was if there was a way to make the turtle fill in the information for me. like a write command or a io.read("*a") then trigger a write()? things like that to fill in the information.

I understand you want to get the code out first but by the time I get the code I might be finished building my project manually. Which is a long time from now my point is that I just wanted a quick fix or work around.

I am grateful people are working on this code it seems to be really handy. I am learning turtle lua as fast as I can but every time I spend on it the less time I spend on building. and being on a server I fall behind everyone else. heh
And to answer your question, I don't think there are any ways other than manually placing the turtle and running shape each time, sorry >_<. I would do it like this anyways because minecraft isn't the most stable thing and you would have to reprogram your construction program every time the turtle got unloaded (alot)
ughzug #12
Posted 31 March 2013 - 01:33 PM
hexagons and octagons please ^_^/>
xInDiGo #13
Posted 31 March 2013 - 01:54 PM
hexagons and octagons
CupricWolf #14
Posted 31 March 2013 - 07:10 PM
hmm, sounds interesting. I'll see what can be done. I'll have to brain storm which parameters are needed and what not. The problem is that those aren't easily defined shapes, with rectangle based shapes its easy, just place a line then turn and place another, for circular objects its checking if a block is in the range radius to (radius + sqrt(3)) away from the center. Octagons and hexagons are different, they have to more thought out and the code will be much more complex, especially with hexagons. Hexagons will be harder to code than octogons because of the steepness of the "diagonal" parts, there are only two non-diagonals in a hexagon, the other four sides are diagonal, and those will be complicated because they are at 120° from the non-diagonals which is 90+30 and 30° is up-one-over-one-up-one-over-two, whereas in octogons the diagonals are at 135° from the non-diagonals which is 90+45 and 45° is just up-one-over-one, etc. Figuring out when to stop the diagonal and going back to non-diagonal will be semi-difficult to code in the hexagon.

EDIT: I got the turtle movments wrong with the hexagon, its not up-one-over-one-up-one-over-two but it is up-two-over-one-up-one-over-one-up-one-over-one-up-two-over-one… so like the following

- - - - - - +
- - - - - - +
- - - - - + -
- - - - + - -
- - - + - - -
- - - + - - -
- - + - - - -
- + - - - - -
+ - - - - - -
+ - - - - - -
where + is a block and - is empty space
CupricWolf #15
Posted 31 March 2013 - 07:17 PM
That's also assuming regular hexa-, octa-gons. Irregular polygons would be more difficult. And why stop at hexa-, octa-gons, why not have an n-gon builder, adding these shapes open the door for people to ask for more options and might cause us to have to add more and more shapes, and way more complexity. As far as I understand this is supposed to be a compilation of simple shape constructors. I'm not the only one involved in this project, so I am not the last word, I'll wait until the others get a chance to look at the thread. Also, I will try to make a program that can do it.
xInDiGo #16
Posted 03 April 2013 - 02:13 PM
bummer! some unique planes would be great!

i imagine it would ask the user for how many sides and how long each side would be. but then again i'm not so great at this coding business. the best i can do is a hopper turtle xD
Keridos #17
Posted 05 April 2013 - 08:00 PM
Hexagons and Octagons are being added soonish, other shapes are too difficult (at least happydude said that on github).
I will be looking into GPS Support and inverted building in the next days. Command line interfacing will be added soon too.
Just to warn you: Minecraft is not very stable and even chunkloading turtles get unloaded sometimes (for a reason that I have not found yet) so do not expect long programs to run smoothly. At least not without GPS support.
CupricWolf #18
Posted 08 April 2013 - 07:03 AM
bummer! some unique planes would be great!

i imagine it would ask the user for how many sides and how long each side would be. but then again i'm not so great at this coding business. the best i can do is a hopper turtle xD
What do you mean by unique planes?
CupricWolf #19
Posted 08 April 2013 - 07:28 AM
Hexagons and Octagons are being added soonish, other shapes are too difficult (at least happydude said that on github).
I will be looking into GPS Support and inverted building in the next days. Command line interfacing will be added soon too.
Just to warn you: Minecraft is not very stable and even chunkloading turtles get unloaded sometimes (for a reason that I have not found yet) so do not expect long programs to run smoothly. At least not without GPS support.
If other n-gons are to be added, their patterns will need to be hard coded. I don't think this is worth it because shapes larger than octagons are (IMHO) just used to approximate circles, and we already have code that does circles. A triangle constructor might be nice though.
lalophobia #20
Posted 08 April 2013 - 09:27 AM
Is there a way I can trigger a sequence of build scripts back to back?
[]
a way to trigger the shapebuilder within my script. is it possible?

I'm not part of the project you're asking.. but surely you could brute force it.

open your project in notepad or something so you can edit it a lot easier as in the ingame gui

copy section of the code you need to functions within your code and make it read variable(s) for each shape you want built with it instead of actual input.

if you need two circles of different sizes make two functions with different variables .. etc
lalophobia #21
Posted 08 April 2013 - 09:32 AM
cool program
Just a heads up. I'm pretty sure a relatively famous youtuber recently used your script, but it seems like he found a way older version of it

http://www.youtube.com/watch?v=SwuTFD1ZG3c

left a similar comment there to use this url instead of the pastebin link. but felt like saying it here as well :)/>
firerebel #22
Posted 10 April 2013 - 10:14 AM
I want the resume build so bad haha. I play on a server that restarts freakin constantly and I want to build a huge sphere :)/>
CupricWolf #23
Posted 12 April 2013 - 12:55 PM
Its still kinda beta, but if you go to the GitHub repo, all of the most recent features are there. It will sometimes start one position off, and might be disabled.
EDIT: It is disabled in my fork. To re-enable go to ContinueQuery() on line 882, delete the first line of the function (return false), and then uncoment the rest of the function. :)/>

On Another note:
I've added in Hexagons, and Octagons, and prisms with those as bases. I've also added in tentative command line access. :)/>
CupricWolf #24
Posted 12 April 2013 - 01:24 PM
Well resuming any code is a pain and most of the time it requires GPS and a saved file or just saved file recording the last position in the code it ran and the variables + or - it was on within the code. But as said below I am still learning lua.

All I was asking really was if there was a way to make the turtle fill in the information for me. like a write command or a io.read("*a") then trigger a write()? things like that to fill in the information.

I understand you want to get the code out first but by the time I get the code I might be finished building my project manually. Which is a long time from now my point is that I just wanted a quick fix or work around.

I am grateful people are working on this code it seems to be really handy. I am learning turtle lua as fast as I can but every time I spend on it the less time I spend on building. and being on a server I fall behind everyone else. heh

I've added command line access to my fork on github, and it will be in the main branch soon :)/>. On pastebin in the meantime at EPwMT1ug. Please note that paste is not the official stable release, and is also beta, some bugs may exist (so post about them here or on github if you find one).
wakafanykai123 #25
Posted 13 April 2013 - 06:46 AM
This is amazing, worked perfectly for my FTB base :)/>
CupricWolf #26
Posted 14 April 2013 - 10:38 AM
This is amazing, worked perfectly for my FTB base :)/>
Thats good to hear, thanks for sharing! :)/>
wakafanykai123 #27
Posted 16 April 2013 - 03:35 PM
This is amazing, worked perfectly for my FTB base :)/>
Thats good to hear, thanks for sharing! :)/>
I used it to dig out a wall, while replacing it with blocks. Now i dont need to break every single block in the wall, i can just place a turtle. Btw, you need to place it one behind, it does not start where it stands, this is intended right?
CupricWolf #28
Posted 17 April 2013 - 04:07 PM
I didn't author the wall script, but I would Imagine it might be. I'll check the code…. After checking the code it seems that it should start right where it is started and go up/forward from there, it doesn't seem intended.
Keridos #29
Posted 20 April 2013 - 03:50 AM
I should have fixed the wall code at some point because the original code was quite derping around much, building the wall in a rather strange way.
Havent checked on the newest version yet but i guess it builds to the front and upwards from its starting point atm.

The new version is up now, prisms added and the command line interface is added, if you find any bugs, just report here or on github.
Steven McWayne #30
Posted 20 April 2013 - 08:31 AM
I think that he means is that the 20x20 platform building is still bugged. When the turtle is building, he has slot 1 and 2 filled with dirt. When slot 1 runs out of dirt, it picks up cobble and uses the cobble while it doesnt touch the slot 2 filled with dirt.

Same issue with Cuboids, it empties slot 1 then use whatever he just picks up. :/
Keridos #31
Posted 21 April 2013 - 07:02 AM
I think that he means is that the 20x20 platform building is still bugged. When the turtle is building, he has slot 1 and 2 filled with dirt. When slot 1 runs out of dirt, it picks up cobble and uses the cobble while it doesnt touch the slot 2 filled with dirt.

Same issue with Cuboids, it empties slot 1 then use whatever he just picks up. :/

Fixed in the latest release. Turtle now leaves 1 Block in each slot and compares the slot it uses to the first slot. If the items do not match, the item from the selected block is dropped and the turtle continues to look for the correct material.
steelblueskies #32
Posted 22 April 2013 - 07:21 AM
hm. too bad i didn't see this updated post earlier. have been using earlier versions of this, and the works it incorporates for a while.

wouldn't a diamond builder have been a better place to start before the hexagon, (ie 45 degree rotation of the square pattern about the central axis). once that'd been done an octagon could have been a diamond with the points skipped more or less.

would have also nicely served as a basis for a diamond pyramid.

ie diamond
ooxoo
oxoxo
xooox
oxoxo
ooxoo

vs square
xxxxx
xooox
xooox
xooox
xxxxx

but then it might be a bit of a pain with the new bounding box start position method being used. proper diamond style pyramids are about twice as big a pain in the hind end to make by hand, especially hollow. no blocks touching any others ever >.> .

for large structures in built up regions i'm finding i need the old sphere and dome builder instead of this to avoid blowing holes in things just to give the turtle his lead space he will never build in from the bounding box corner, when starting say a large dome.
edit: this sounds harsh. what i meant was the ability to switch between starting in the center point and the corner outside for say a dome is extremely useful. sometimes you are building a dome from the ground around a cluster of structures and going from the center won't work, so this version is handy. the other times you are doming over some things in the midst of others or have nice even roadways in the inside region to be domed, which makes the other older version handy, even if it must be babysat to a greater degree. end edit.

that aside it is a handy and useful compilation, and the possibility of self resume support should be an excellent addition, thank you for all the work.
Steven McWayne #33
Posted 22 April 2013 - 08:00 AM
I think that he means is that the 20x20 platform building is still bugged. When the turtle is building, he has slot 1 and 2 filled with dirt. When slot 1 runs out of dirt, it picks up cobble and uses the cobble while it doesnt touch the slot 2 filled with dirt.

Same issue with Cuboids, it empties slot 1 then use whatever he just picks up. :/

Fixed in the latest release. Turtle now leaves 1 Block in each slot and compares the slot it uses to the first slot. If the items do not match, the item from the selected block is dropped and the turtle continues to look for the correct material.
Porno, thx for effort :P/>
Alexi320 #34
Posted 24 April 2013 - 05:08 AM
Handy program, but please add a "Filled Cube/Rectangular Prism" option! Thanks!
Niseg #35
Posted 24 April 2013 - 06:31 AM
I took a peek at the code and In my opinion there is a way to optimize the placement. I bet everything worked fine by itself but by separating the part of the program that figure out where to place the block and the part that actually places the block should give a significant improvement in performance.

I've made a similar program that build rectangular room and it's fairly fast despite the same inefficiency issues . If the same method is applied to my program it would be faster. My program place 3 blocks at a time when building a wall which saves fuel . I measured its runtime about 8.5 minutes for building a 12x12 tank which is 0.7s per block. I still have a very inefficient floor/roof builder which places 1 block at a time.

The idea is to first calculate the stracture and put where blocks need to be placed in a 3d array . this can be done your program by "simulating " and instead of placing setting values in the arrray . afterwards there need to be a pathing algorithm which try to minimize move distance .

I think my suggestion might be too complicated to implement .

I noticed that command line parameters would allow you to make more complicated shapes using programs that use "shell.run(). I'll still need to try it myself but according to the video the wall building seem to have a nasty overhead because the program doesn't look past the next block it has to place. if you use an x,y plane oriented building you can keep the turtle free while building more blocks and having less overhead .
Keridos #36
Posted 24 April 2013 - 09:14 AM
Niseg, since you the project is opensource you can add those optimizations in even yourself :)/>
We even have a suggestion on the github mentioning even exactly that optimization. We figured that the turtles VRam might be not big enough for this, pruby (the guy who did the sphere and circle code) even mentioned that somewhere either in his thread or in his code.

Handy program, but please add a "Filled Cube/Rectangular Prism" option! Thanks!
I will add that in in the next few days. (already added now, see edit)
Rectangular Prism are in, called "cuboids" in the program, now even hollow and nonhollow.

/edit (1:36, 24/04/13): Added nonhollow cuboids and fixed wide/deep being switched.
CupricWolf #37
Posted 24 April 2013 - 02:05 PM
I noticed that command line parameters would allow you to make more complicated shapes using programs that use "shell.run().
Thats why I added the command line stuff :P/>
Kravyn #38
Posted 30 April 2013 - 09:19 PM
Im attempting to build with the cylinder code and it first moves away from me then starts building I did cylinder 9 radius 2 high

What I wanted was a tube that was 9 wide and 2 high for testing purposes and it just does not work where I place it
it moved like 9+ blocks from where I placed it and then starts to build and then builds the wrong location

are you going to be adding the room code back in? that was the one I was really wanting
I am having to use the old code for that again because you have changed the pastebin and removed the room code

edit – ok well I used the cuboid code and it works good now I am trying to figure out how to use the repeat code setup

codename square -z 13 square -z 15

could you make a square code that could start at one size lets say the starting size is 11 and ends at 30 if set because what if your in the air its not like its that simple to get to the corner you want but if you have a center point it could build out in a spiral from the starting point to the end point
Keridos #39
Posted 02 May 2013 - 07:33 PM
Im attempting to build with the cylinder code and it first moves away from me then starts building I did cylinder 9 radius 2 high

What I wanted was a tube that was 9 wide and 2 high for testing purposes and it just does not work where I place it
it moved like 9+ blocks from where I placed it and then starts to build and then builds the wrong location

are you going to be adding the room code back in? that was the one I was really wanting
I am having to use the old code for that again because you have changed the pastebin and removed the room code

edit – ok well I used the cuboid code and it works good now I am trying to figure out how to use the repeat code setup

codename square -z 13 square -z 15

could you make a square code that could start at one size lets say the starting size is 11 and ends at 30 if set because what if your in the air its not like its that simple to get to the corner you want but if you have a center point it could build out in a spiral from the starting point to the end point

We are adding in the ability to select that the starting point of the turtle is the center of the build (for uneven sidelenghts only). Actually it is not hard to calculate where the turtle is starting. Imagine you draw a square around what you try to build. The turtle is in the bottom left corner of that square (when seen from above) when it starts the build.
Kravyn #40
Posted 03 May 2013 - 01:32 AM
yeah got it working just not repeatable but is there a way to repeat the square command like I posted?
Keridos #41
Posted 04 May 2013 - 10:20 AM
yeah got it working just not repeatable but is there a way to repeat the square command like I posted?
I'll leave that question to Happydude as he wrote that system and I currently have a bit other things to do (Writing the Xycraft Wiki, updating my private server and some other things).
CupricWolf #42
Posted 05 May 2013 - 11:12 PM
yeah got it working just not repeatable but is there a way to repeat the square command like I posted?

shell.run("scriptName", "square", "sideLength", "-z")
shell.run("scriptName", "square", "sideLength", "-z")
Just run the program twice from a different script
(sorry about the late reply, with finals soon I have been forgetting to check out the forums)
CupricWolf #43
Posted 08 May 2013 - 08:02 AM
For example if you wanted to build a 20x20 square centered on top of a 10x10 you would use

shell.run("shape", "square", "10", "-z")
for i = 1 , 5 do
	turtle.back()
end
turtle.turnRight()

for i = 1 , 5 do
	turtle.back()
end
turtle.turnLeft()
turtle.up()
shell.run("shape", "square", "20")
CupricWolf #44
Posted 08 May 2013 - 08:06 AM
One thing I should probably mention is that -z was more intended for spheres/domes/bowls/circles/cylinders but then works with all of the other shapes. Try out the script on a smaller version of the shape to know how -z effects that shape.
Fronts #45
Posted 11 May 2013 - 11:06 AM
I can't get this to place blocks in Lite 0.6.5 but it worked a charm in 0.6.1, any help?
CupricWolf #46
Posted 12 May 2013 - 01:52 AM
I can't get this to place blocks in Lite 0.6.5 but it worked a charm in 0.6.1, any help?
What mod pack are you referring to?
uberadiant #47
Posted 14 May 2013 - 12:04 PM
Hi guys, I've been following this for a little while but I have to point something out.

The circles that the turtle builds aren't very…umm, well, round. I understand that this code has come from another program but I think it should be mentioned (there is a pic below to illustrate this). I'm building a Star Trek museum world so as you can imagine, circles and ellipses have to be spot on for there to be any semblance of accuracy. Not sure if it's something that anyone feels is worth fixing, but thought I would point it out anyway. The various sphere generators available online all render circles almost perfectly, depending on the radius obviously. However, when I'm trying to create circles with radii of dozens or hundreds of metres, building them manually is both extremely tedious and horrifically time consuming.


Please don't take this is a criticism of anyone's work! The fact that you guys create these programs for others to use is great! I'm just being picky :P/>

SpoilerThe circle on the left was built using this program. The one on the right was built by me using an online generator.

CupricWolf #48
Posted 14 May 2013 - 07:07 PM
Hi guys, I've been following this for a little while but I have to point something out.

The circles that the turtle builds aren't very…umm, well, round. I understand that this code has come from another program but I think it should be mentioned (there is a pic below to illustrate this). I'm building a Star Trek museum world so as you can imagine, circles and ellipses have to be spot on for there to be any semblance of accuracy. Not sure if it's something that anyone feels is worth fixing, but thought I would point it out anyway. The various sphere generators available online all render circles almost perfectly, depending on the radius obviously. However, when I'm trying to create circles with radii of dozens or hundreds of metres, building them manually is both extremely tedious and horrifically time consuming.


Please don't take this is a criticism of anyone's work! The fact that you guys create these programs for others to use is great! I'm just being picky :P/>

SpoilerThe circle on the left was built using this program. The one on the right was built by me using an online generator.

Thanks for the criticism, alert. :)/> I have been working on trying to optimise this in my free time (when I'm not working on new stuff for this program) but all of my attempts have failed. The method we use to generate circles is to go block by block and determine how far away the center of that block is from the center of the circle/sphere. If that distance is in the range between the radius and the radius plus the square root of 3, the program places a block there. I personally don't know exactly why we add on the square root of 3 but when I try smaller values it leave holes and larger values create overlap. (in my tests at least) There are other parameters that I haven't tested yet. Like right now we only do the radius check on the center of the block, we could try different points (closer/farther to the center). What if we used points closer to the center the closer we get to 45° from the x or z axis. There is a lot more that I have yet to try. This isn't very high on my priorities right now though, because it works and I have yet to see a case where it doesn't meet the goals, so "If it ain't broke, don't fix it." is sort of taking effect for me. I do agree though that smaller circles could look more circular. You are always welcome to take a look at the source code on github and see if there is anything you can do about it ;)/> I will move this up my personal priority list though since I've seen a few people mention this.
uberadiant #49
Posted 15 May 2013 - 07:35 AM
Thanks for the reply :)/>

I understand it's not a particularly important issue, and please don't make this a priority over anything else you might be doing. As I said, I'm just really picky. Admittedly, I've only tried it using circles with relatively small radii. I haven't attempted to create 100m radius circles or anything like that yet (the idea of waiting ages for the turtle to do it's thing to only then find out it's not exactly to my ridiculously pedantic standards and have to destroy it…me no likey that thought).

As for me trying to alter the code…I used to be a barely competent programmer, but to be honest it's something that I find a bit boring, so I'll leave it to the experts! If I could maybe make a (possibly silly) suggestion, maybe have a look at the online circle/sphere generators and see if you can see at a glance how they do the maths. Just a thought, and only if you think it might help, of course :)/>

Thanks for having a look at it though, I appreciate it a lot :)/>
CupricWolf #50
Posted 17 May 2013 - 12:39 AM
Thanks for the reply :)/>

I understand it's not a particularly important issue, and please don't make this a priority over anything else you might be doing. As I said, I'm just really picky. Admittedly, I've only tried it using circles with relatively small radii. I haven't attempted to create 100m radius circles or anything like that yet (the idea of waiting ages for the turtle to do it's thing to only then find out it's not exactly to my ridiculously pedantic standards and have to destroy it…me no likey that thought).

As for me trying to alter the code…I used to be a barely competent programmer, but to be honest it's something that I find a bit boring, so I'll leave it to the experts! If I could maybe make a (possibly silly) suggestion, maybe have a look at the online circle/sphere generators and see if you can see at a glance how they do the maths. Just a thought, and only if you think it might help, of course :)/>

Thanks for having a look at it though, I appreciate it a lot :)/>
Thanks for the suggestion. May I ask which online generator you used for your circle on the right? Also the radius used, I'm pretty sure it's 6, but I want to be sure.
Edited on 16 May 2013 - 10:44 PM
uberadiant #51
Posted 17 May 2013 - 11:43 AM
I use the following -

http://oranj.io/blog/VoxelSphereGenerator

http://www.plotz.co.uk/plotz.php

http://donatstudios.com/PixelCircleGenerator


I had a very quick look at the source for the third one. There's a link to a github repository, and the code for the generator is there. Also, the licence seems to indicate that it is open source, so could be useful! And you're right, the radius I used was 6.
CupricWolf #52
Posted 19 May 2013 - 09:10 PM
I use the following -

http://oranj.io/blog...SphereGenerator

http://www.plotz.co.uk/plotz.php

http://donatstudios....CircleGenerator


I had a very quick look at the source for the third one. There's a link to a github repository, and the code for the generator is there. Also, the licence seems to indicate that it is open source, so could be useful! And you're right, the radius I used was 6.
Unfortunatly I don't know javascript well enough to follow that donat studios one :(/> and the others aren't open source.
per #53
Posted 20 May 2013 - 12:32 AM
How is your GPS/persistence bit coming along ?
I'm EAGERLY awaiting this (I even had a hack at it myself..no joy :(/> ) as I have 64 block radius dome to build :D/>
Keridos #54
Posted 22 May 2013 - 08:29 AM
Hi guys, I've been following this for a little while but I have to point something out.

The circles that the turtle builds aren't very…umm, well, round. I understand that this code has come from another program but I think it should be mentioned (there is a pic below to illustrate this). I'm building a Star Trek museum world so as you can imagine, circles and ellipses have to be spot on for there to be any semblance of accuracy. Not sure if it's something that anyone feels is worth fixing, but thought I would point it out anyway. The various sphere generators available online all render circles almost perfectly, depending on the radius obviously. However, when I'm trying to create circles with radii of dozens or hundreds of metres, building them manually is both extremely tedious and horrifically time consuming.


Please don't take this is a criticism of anyone's work! The fact that you guys create these programs for others to use is great! I'm just being picky :P/>

SpoilerThe circle on the left was built using this program. The one on the right was built by me using an online generator.


Ok I thought it was only my brain tricking me, but I actually opened a bug report on github for this.
How is your GPS/persistence bit coming along ?
I'm EAGERLY awaiting this (I even had a hack at it myself..no joy :(/> ) as I have 64 block radius dome to build :D/>

I did not really work that much on that in the past few weeks, we still have to layout the basic concept of how we want to store the coordinates etc.
CupricWolf #55
Posted 23 May 2013 - 05:57 PM
Out of curiosity, Has anybody had any problems with 1.53? I can't get my turtles to move at all.
psyestorm #56
Posted 26 May 2013 - 09:31 AM
This has saved me a lot of time. Thanks for your hard work
Steven McWayne #57
Posted 27 May 2013 - 10:25 AM
One question,
is it possible to let the turtle place Platforms and roofs of rooms over his head instead placing under him?
At the moment it leaves 1 line/row of space between roofs and the natural rocks.
Niseg #58
Posted 29 May 2013 - 05:25 AM
One question,
is it possible to let the turtle place Platforms and roofs of rooms over his head instead placing under him?
At the moment it leaves 1 line/row of space between roofs and the natural rocks.

Most build programs build plates from above . My build program does the same (for plates). You might need a code modification to do this I'm not sure how flexible their code is.It's based on getting to a spot above and placing the block.

I've once made a piece of code called "universal floor/roof breaker". I just modified the code a little to create a "universal floor placer" . Be warned I have not debugged It seems to work.and make sure the turtle is in an enclosed room (preferably rectangular). place blocks from slot 1 and on and pre refuel it. The inventory handling is very simplistic . the turtle should be on the corner facing out (use turn command) and you need to tell it which of its sides has an empty space. it will continue until it hits a corner(that's why preferably rectangular)
Cupcakecreator #59
Posted 30 May 2013 - 08:36 AM
Can someone help please, when i use the cylinder program and make a 75 x 5 cylinder underground after about 30 blocks it keeps giving this error:
shape:846: attempt to index ? (a nil value)
CupricWolf #60
Posted 03 June 2013 - 06:12 PM
This has saved me a lot of time. Thanks for your hard work

You are welcome :)/>

One question,
is it possible to let the turtle place Platforms and roofs of rooms over his head instead placing under him?
At the moment it leaves 1 line/row of space between roofs and the natural rocks.

Because the code to build platforms is also used to build the roof of a cuboid we cannot change this to work from below, I'm sorry.

Can someone help please, when i use the cylinder program and make a 75 x 5 cylinder underground after about 30 blocks it keeps giving this error:
shape:846: attempt to index ? (a nil value)

Are you running the most up to date code? If so, can your turtles write to the file system? Can you also try EPwMT1ug
CupricWolf #61
Posted 12 June 2013 - 01:50 PM
I just found a major bug in EPwMT1ug and I have fixed it.
Cupcakecreator: Are you still getting the error?
Basilio #62
Posted 18 June 2013 - 06:05 AM
Guys found an interesting effect if digging in sand. If you start digging some levels below the surface, there is a chance that the turtle will eventually come into a situation when it digs a block in front of it, then the sand behind it collapses and when the turtle tries to move back, it can't anymore and just sits there waiting for someone to press enter in the console. Is there any chance you could add a check for that situation, so that it would automatically dig the sand behind it?
Jowajon #63
Posted 29 June 2013 - 07:41 PM
I use this all the time. I only wish it would stop and not go back to the beginning. I was building a wall on my castle with sand and it tried to go back to the beginning and killed a section of my wall.
Keridos #64
Posted 30 June 2013 - 04:54 AM
I use this all the time. I only wish it would stop and not go back to the beginning. I was building a wall on my castle with sand and it tried to go back to the beginning and killed a section of my wall.

I will look into this, I guess I will add a question that asks if the turtle should do that, maybe later check the return code.
Not 100% sure, but I recall having a similar problem once on my server.

/edit: added the choice for the user to set wether the turtle should return to its starting point.

Guys found an interesting effect if digging in sand. If you start digging some levels below the surface, there is a chance that the turtle will eventually come into a situation when it digs a block in front of it, then the sand behind it collapses and when the turtle tries to move back, it can't anymore and just sits there waiting for someone to press enter in the console. Is there any chance you could add a check for that situation, so that it would automatically dig the sand behind it?

This could be a minor bug in the safemovement functions.
Will create an issue on github for this. Thanks for bringing it to our attention.
/edit: tried to fix that, try it again with the new version (still the same pastebin link).

Update: Resume function now added!

Resume function now is fixed even without GPS, I cannot guarantee it to be 100% working, but I think I got it correct most of the time now. Please report any issues with the resume function here or on the GitHub since I can not test it that extensive alone.
CupricWolf #65
Posted 03 July 2013 - 09:22 PM
Sorry, I put the "return to home" feature in an forgot to mention that you can stop it with -z. And I never use the questions so I forgot to include that as a question. my bad.

On another note: The one time I take my eye off this project you do lots of work keridos :P/> I'm sorry I've kinda neglected to check this; my life got really busy recently :(/>
Niseg #66
Posted 04 July 2013 - 04:15 AM
I took a peek at how the resume function was implemented and I wouldn't recommend to use this function on a server. Maybe a GPS can help but if the user can get the turtle into the position it thinks it's in it can continue with part of the structure missing.

The way I suggest you do it is this.

1. save starting fuel level and number of blocks in a file
2. start building
3. to recover from a crash set curfuel=turtle.getFuelLevel()
4. read the start fuel level from file and calculate target_fuel= start_fuel-curfuel
5. run the script in simulation mode until you reach close enough to target_fuel or to it
6. figure out which way you are facing (use things you know on previous placements to figure it)
7. continue building from that point

keeping track of the number of blocks will tell will give you a hint on weather the block was placed or not. the main problem is searching for your location. if you have a gps finding the direction you face is trivial

The fuel level is a new thing that came to my attention. using number of blocks is also an option.

I haven't been working much on my build script but it's somewhat improved. I'm mainly working on my mining well script and the new buildcraft version created a new challenge mainly in the power generation field. I need to figure out a minimal setup that will push 180Mj/t while generating only 34~Mj/t :(/> .
Keridos #67
Posted 04 July 2013 - 07:35 AM
I tried this by terminating the program quite some times and it looks that if the turtle does not stop in a vertical movement it returns fine with this setup. I am pretty sure it will not be able to recover in 100% of the cases but this is better than no resuming at all. We are using the number of blocks placed, the facing and the turtles position to track our progress. Seems to work fine now. Basically on restart we simulate the turtles movement without moving it or placing blocks, when the tracking variables reach the save file states, we simply turn off simulation and start building for real again.
REMNANSE #68
Posted 09 July 2013 - 11:48 AM
Is it possible to get a circular platform added?
CupricWolf #69
Posted 09 July 2013 - 02:14 PM
Is it possible to get a circular platform added?
I'll see what I can do. The way we generate circles only finds the outside edge right now, I'll have to play with it a bit to try to also fill it in
REMNANSE #70
Posted 09 July 2013 - 10:19 PM
Thanks, It would be most useful when used in conjunction with the cylinders, spheres, domes and even prisms that are already present. Currently the easiest way to create such a platform is to create the square version and then remove the four corners.
Niseg #71
Posted 10 July 2013 - 04:21 AM
You can make concentric circles height 1 if you want a round floor that would probably require writing a front end program to keep the turtle moving to a valid start position.. I think starting from the edges is best. just tell it to build circles with n,n-1,n-2…1 and it will eventually build a floor.

I'm not sure exactly what the parameters of shape builders but something like this should work provided it returns to start position. The turnLeft and turnRight might need to be swapped according to the build dirrection .

args={...}
for i = args[1],1,-1 do
shell.run("shapebuilder circle "..i)
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
REMNANSE #72
Posted 11 July 2013 - 11:14 AM
Currently I'm finding that the returning to start position is actually 1 block left/right from the original start position, from memory its definitely the case with spheres or cylinders. It may also be an idea to specify the height of a dome/spere to 1 and therefore builds a platform.
kao #73
Posted 12 July 2013 - 11:53 AM
Hey I'm pretty new to CC and coding in general, so I was reading through your code just to see what I could learn from it. The circle code, to my untrained eye, seems to have some typos in it. Specifically, the variations on "OffsetX" and "OffsetY" are spelled inconsistently. Some variations of the spelling include "Offset", "Offeset", and "Offest". Is this intentional? Just curious what the purpose would be. Thanks!


function circle(radius)
width = radius * 2 + 1
sqrt3 = 3 ^ 0.5
boundaryRadius = radius + 1.0
boundary2 = boundaryRadius ^ 2
z = radius
cz2 = (radius - z) ^ 2
limitOffsetY = (boundary2 - cz2) ^ 0.5
maxOffestY = math.ceil(limit[b]Offset[/b]Y)
-- We do first the +x side, then the -x side to make movement efficient
for side = 0, 1 do
  -- On the right we go from small y to large y, on the left reversed
  -- This makes us travel clockwise (from below) around each layer
  if (side == 0) then
   yStart = radius - max[b]Offest[/b]Y
   yEnd = radius + maxOffestY
   yStep = 1
  else
   yStart = radius + maxOffestY
   yEnd = radius - maxOffestY
   yStep = -1
  end
  for y = yStart, yEnd, yStep do
   cy2 = (radius - y) ^ 2
   remainder2 = (boundary2 - cz2 - cy2)
   if remainder2 >= 0 then
    -- This is the maximum difference in x from the centre we can be without definitely being outside the radius
    maxOffesetX = math.ceil((boundary2 - cz2 - cy2) ^ 0.5)
	 -- Only do either the +x or -x side
    if (side == 0) then
	 -- +x side
	 xStart = radius
	 xEnd = radius + max[b]Offeset[/b]X
    else
	 -- -x side
	 xStart = radius - maxOffesetX
	 xEnd = radius - 1
    end
    -- Reverse direction we traverse xs when in -y side
    if y > radius then
	 temp = xStart
	 xStart = xEnd
	 xEnd = temp
	 xStep = -1
    else
	 xStep = 1
    end
	 for x = xStart, xEnd, xStep do
	 cx2 = (radius - x) ^ 2
	 distanceToCentre = (cx2 + cy2 + cz2) ^ 0.5
	 -- Only blocks within the radius but still within 1 3d-diagonal block of the edge are eligible
	 if distanceToCentre < boundaryRadius and distanceToCentre + sqrt3 >= boundaryRadius then
	  offsets = {{0, 1, 0}, {0, -1, 0}, {1, 0, 0}, {-1, 0, 0}, {0, 0, 1}, {0, 0, -1}}
	  for i=1,6 do
	   offset = offsets[i]
	   dx = offset[1]
	   dy = offset[2]
	   dz = offset[3]
	   if ((radius - (x + dx)) ^ 2 + (radius - (y + dy)) ^ 2 + (radius - (z + dz)) ^ 2) ^ 0.5 >= boundaryRadius then
	    -- This is a point to use
	    navigateTo(x, y)
	    placeBlock()
	    break
	   end
	  end
	 end
    end
   end
  end
end
end
CupricWolf #74
Posted 14 July 2013 - 09:56 PM
Hey I'm pretty new to CC and coding in general, so I was reading through your code just to see what I could learn from it. The circle code, to my untrained eye, seems to have some typos in it. Specifically, the variations on "OffsetX" and "OffsetY" are spelled inconsistently. Some variations of the spelling include "Offset", "Offeset", and "Offest". Is this intentional? Just curious what the purpose would be. Thanks!


function circle(radius)
width = radius * 2 + 1
sqrt3 = 3 ^ 0.5
boundaryRadius = radius + 1.0
boundary2 = boundaryRadius ^ 2
z = radius
cz2 = (radius - z) ^ 2
limitOffsetY = (boundary2 - cz2) ^ 0.5
maxOffestY = math.ceil(limit[b]Offset[/b]Y)
-- We do first the +x side, then the -x side to make movement efficient
for side = 0, 1 do
  -- On the right we go from small y to large y, on the left reversed
  -- This makes us travel clockwise (from below) around each layer
  if (side == 0) then
   yStart = radius - max[b]Offest[/b]Y
   yEnd = radius + maxOffestY
   yStep = 1
  else
   yStart = radius + maxOffestY
   yEnd = radius - maxOffestY
   yStep = -1
  end
  for y = yStart, yEnd, yStep do
   cy2 = (radius - y) ^ 2
   remainder2 = (boundary2 - cz2 - cy2)
   if remainder2 >= 0 then
	-- This is the maximum difference in x from the centre we can be without definitely being outside the radius
	maxOffesetX = math.ceil((boundary2 - cz2 - cy2) ^ 0.5)
	 -- Only do either the +x or -x side
	if (side == 0) then
	 -- +x side
	 xStart = radius
	 xEnd = radius + max[b]Offeset[/b]X
	else
	 -- -x side
	 xStart = radius - maxOffesetX
	 xEnd = radius - 1
	end
	-- Reverse direction we traverse xs when in -y side
	if y > radius then
	 temp = xStart
	 xStart = xEnd
	 xEnd = temp
	 xStep = -1
	else
	 xStep = 1
	end
	 for x = xStart, xEnd, xStep do
	 cx2 = (radius - x) ^ 2
	 distanceToCentre = (cx2 + cy2 + cz2) ^ 0.5
	 -- Only blocks within the radius but still within 1 3d-diagonal block of the edge are eligible
	 if distanceToCentre < boundaryRadius and distanceToCentre + sqrt3 >= boundaryRadius then
	  offsets = {{0, 1, 0}, {0, -1, 0}, {1, 0, 0}, {-1, 0, 0}, {0, 0, 1}, {0, 0, -1}}
	  for i=1,6 do
	   offset = offsets[i]
	   dx = offset[1]
	   dy = offset[2]
	   dz = offset[3]
	   if ((radius - (x + dx)) ^ 2 + (radius - (y + dy)) ^ 2 + (radius - (z + dz)) ^ 2) ^ 0.5 >= boundaryRadius then
		-- This is a point to use
		navigateTo(x, y)
		placeBlock()
		break
	   end
	  end
	 end
	end
   end
  end
end
end
No this is a mistake (one that still works since all forms of "maxOffsetX" are misspelled "maxOffesetX" ect). Thank you very much for pointing this out!
pandax #75
Posted 15 July 2013 - 09:22 AM
One feature I would like to see, if possible, would be the ability to specify the thickness of walls. For instance, say I could build a cylinder with wall thickness of 3. You can "kind of" do this now by build 3 different sizes of cylinder or circle. The problem is this leaves holes in the walls at spots where the circles do not match up.
Keridos #76
Posted 22 July 2013 - 01:51 AM
We can add additional shapes and methods if they work correctly, the currently used algorithms can not all be modified for doing this.
zorn #77
Posted 24 July 2013 - 10:39 PM
Is there a bug with platforms? I tried to make one and it would ask if I wanted to calculate the cost and then asked about returning to the start after it was done. Each time it would move a few blocks and say 'done'. Then i tried again, after 4 or 5 tries, and this time it asked me no questions and just started moving, adn made the platform.

I see the first comment in this thread is about issues iwth the platform. is there still an issue with it?
Keridos #78
Posted 25 July 2013 - 01:02 AM
the first commment was made due to the platform picking up blocks and using them for building stuff. The error you described is something I never saw. I will try to reproduce it.
Drew956 #79
Posted 25 July 2013 - 04:17 PM
I use the following -

http://oranj.io/blog...SphereGenerator

http://www.plotz.co.uk/plotz.php

http://donatstudios....CircleGenerator


I had a very quick look at the source for the third one. There's a link to a github repository, and the code for the generator is there. Also, the licence seems to indicate that it is open source, so could be useful! And you're right, the radius I used was 6.
Unfortunatly I don't know javascript well enough to follow that donat studios one :(/>/> and the others aren't open source.


Don't worry, while I don't know javascipt very well either, I had tons of time on my hand so I went through and commented the entire thing, and for the past two days I just worked on it :)/>/>

I just took his github javascript and translated that into processing js code, and then translated that into lua, and then wrote the part where the turtle actually builds the circle…
Took a lil while to see how all the pieces came together, but they work now :D/>/>

Oh! And I added one of my own programs to it too, 'spiral'. Which just builds a spiral staircase of specified width.
(square shaped staircase. Tho I want to try to see if I can do a circular one too, based on the smooth circle program I hacked together for this)

You can find it here:
http://pastebin.com/qjehGFsM

I tested it and it works now, but if you find an issue lemme know :)/>/>
Should be fine.
I also intend on adding in spiral tunnels of specified width to my modification at some point, but for now just those two additions are fine.

I kept the other circle code in there, just made a little user specification as to whether they want a 'smooth' circle or not.
So yeah…
Was fun :]

@uberadiant your ocd should be satisfied now.. lol :)/>/>



EDIT: I added in some code to make it so you can do 'smooth' cylinders too.
Had to debug it though, but now it is good :)/>/>
However, I noticed the default cylinder looks better for small cylinders than the other one.
But I think the other one looks better for larger diameters? idk
The option is there though :P/>/>
Same link as before ^-^
Oh and I added my code in the post below into it, just to simplify the parts where I do something that matches the function :)/>/>

EDIT 2: Added a lil code in to make it check if you want a filled smooth circle or a filled smooth cylinder, which it will do now.
Whenever I ask it to return to home it is always slightly off, I might look into that and do some digging… :)/>/>
Drew956 #80
Posted 25 July 2013 - 04:37 PM
Just curious

When I get user input I like to do the following:
local input = "no"
writeOut("Would you like to have blah blah option? (yes or no)")
while true do
input = io.read()
if input ~= "yes" and input ~= "no" then
writeOut("You didn't enter in the proper values did you? Try again please")
else
break
end
end

I was thinking, when I was answering one of the things with the little y/n thing I just blasted through and typed yes
I don't know and I didn't check if it accepts "yes" instead of 'y' or 'n', but was wondering if it would be useful to write a function that loops until it get's what you want.

like..

local function getInput(message, option1, option2)

local input = ""
writeOut(message.. "(" ..option1 .. " or "..option2..")" )
while true do
input = io.read()
if input ~= option1 and input ~= option2 then
writeOut("You didn't enter in " ..option1.." or "..option2 .. " did you? Please try again")
else
return input
end
end
end

and then be all like

smooth = getInput("Would you like a smooth circle?", "yes", "no")
?

It would prevent users from entering things that aren't valid.
Idk just curious lol.
CupricWolf #81
Posted 28 July 2013 - 05:12 PM
(…)
You can find it here:
http://pastebin.com/qjehGFsM
(…)
Just curious
(…)
local function getInput(message, option1, option2)
(…)
smooth = getInput("Would you like a smooth circle?", "yes", "no")?
It would prevent users from entering things that aren't valid.
Idk just curious lol.

Thank you very much! I will work on implementing both of your Ideas/Code! I cant wait to see what results I get. Sorry I am late in replying, I've been very busy preparing for college and getting a job recently and I haven't had time to do any coding :(/> I have some free time now though! :D/> Thank you again for working on this! Don't be afraid to fork us on github, and making your edits directly to our code. Fork us here —>(link)

Edit: I never asked if I could use your code. >_> So, May I (and by extension everyone using the github linked above) use your code?
Drew956 #82
Posted 28 July 2013 - 07:58 PM
Of course you can use my code lol
Thats why I wrote it xD
I wanted to help :P/>
Besides, the circle code is mostly Jesse Donat's.

The only thing is I need to figure out how to best include Mr. Donat's license.
I think linking to it is fine right?
Edit:
I have his permission to link to it. :)/>

Oh and, if you dont mind me asking, what are you majoring in? :D/>
Keridos #83
Posted 29 July 2013 - 07:26 PM
(…)
You can find it here:
http://pastebin.com/qjehGFsM
(…)
Just curious
(…)
local function getInput(message, option1, option2)
(…)
smooth = getInput("Would you like a smooth circle?", "yes", "no")?
It would prevent users from entering things that aren't valid.
Idk just curious lol.

Thank you very much! I will work on implementing both of your Ideas/Code! I cant wait to see what results I get. Sorry I am late in replying, I've been very busy preparing for college and getting a job recently and I haven't had time to do any coding :(/> I have some free time now though! :D/> Thank you again for working on this! Don't be afraid to fork us on github, and making your edits directly to our code. Fork us here —>(link)

Edit: I never asked if I could use your code. >_> So, May I (and by extension everyone using the github linked above) use your code?

Ok, I will wait with my code stuff until you made your pull request so we (or rather you) do not have to rebase again. I am gonna try to get my head around gps tracking soonish.

BTW: That Idea for getInput really is a good idea, would make our ChoiceFunction quite easier to the eye than it is now.
Drew956 #84
Posted 29 July 2013 - 11:42 PM
I got permission to link to Mr. Donat's license, and just need to add a link to 'donatstudios.com' into the credits.

So we should be all set :)/>
Oh and I'll fork your code later today, and will see what I can do :P/>

Edit:
Oh and I wanna give the n-agon algorithm a go, idk if it'll work but I am going to try ;)/>

Edit 2:
N-sided regular polygon algorithm is done.
Just need some more testing and some extended options, and it will be set :D/>
Extended options hopefully will be thickness, filled, and cylinders and prisms.
I'll update when they are done.
I might break the code while testing it, but as always you can get the latest version at pastebin.com/qjehGFsM :)/>

Lemme know what you think :P/>


Edit 3:
The shapes created by the n-agon algorithm are quite ugly.
I will try to improve them, does anyone know of a good line drawing algorithm?
The one I am using doesn't seem to be very suitable for small shapes…
(anything < 50~100 blocks radius, yup => 100 ~ 200 blocks width )
The algorithm works fine for extremely large shapes viewed from a ways back, but up close the shapes are really quite terrible.
I'm not sure if it is how I have implemented it, but I think it is due to the line algorithm I have utilized.

I will report back once if I have any improvements or ideas to add :)/>

Edit 4:
I've added in some rounding to the shapes, and I think they look somewhat better now :)/>
However, they still look best if the shape is relatively large (like idk, say 20 blocks diameter)
I will see how bad the smaller one's look like and see if there are any other changes I can make to make it better.
I have a hunch that it is just that odd numbered shapes are asymmetrical, which just seems to bug me.
idk

Anyway, I found a bug in my spiral staircase code, and need to quash it. ;)/>

Edit 5:
The bug is still there, I will fix it tomorrow *yawn* going to bed… lol

Edit 700:
Fixed the bug :)/>
And made it so the initial cost_only and return_home things use getInput() now, so no way to enter incorrect answers!
djpanda #85
Posted 31 July 2013 - 12:43 PM
THXTHXTHX for all the great work..

And i have a question to all the pros in here.

Is it able for anyone to add a script for a Hyperbola where radius for bottom, middle and top circles and the hight could be chossen ?

http://www.grg21oe.a...urs/drehhyp.jpg
http://bibliothek.un...erboloidWeb.jpg
Drew956 #86
Posted 31 July 2013 - 11:57 PM
Hmm.. sure, I'll give it a try.
Don't expect it to be perfect though.. lol
I am writing the algorithm now, I'll complete it and test it later today.
It's almost done, just needs testing.

I'll post back/edit this post with the status of the program later :)/>

Edit:
I have it mostly working, but there is a bug that needs fixing.
I will see how good it looks after I have actually built a complete hyperboloid
djpanda #87
Posted 01 August 2013 - 04:56 PM
Did it worked Drew ?
Drew956 #88
Posted 02 August 2013 - 01:57 AM
Hmm..
I kinda works, but it isn't very good.
I'm going to be busy for a week or two now, intermittenly, so maybe someone else should give it a try?

I am going to play around with it a bit more soon, and see wha I can do to fix it, but I think someone else could probably make a better one idk.
(plus mine has a bug right now, aside from making slanted hyperboloids)

I'll post back if I have gotten anything to work.
Nostaire #89
Posted 04 August 2013 - 06:31 PM
Firstly, since its my opening post, I have to say how friggin' sweetass this turtle program is. Three thumbs up, just don't ask where the other one came from. On to business:

I've been scaling up spheres as tests and a 32r sphere, approximately 60% complete, was unable to resume after a server restart. It asked me (after starting the build program) if I wanted to resume, but after inputting "y" ("yes" seems to bring you back to the shapes list, never to resume again…) it threw up some error that I cant quite remember along the lines of "871:build function too long" or something similar.

Also, I know there's commands for pulling stock from ender chests, but your scripting is set to toss unrelated items (including ender chests) instead of pulling items from it. Is there a variation release yet that uses slot 1 ender chest and then, perhaps, the rest of the slots for fuel?

…and uh… I'm probably doing it all wrong so yeah…

<—it DOES say clueless, after all.
CupricWolf #90
Posted 06 August 2013 - 08:41 PM
Oh and, if you dont mind me asking, what are you majoring in? :D/>
Computer Science :)/> Also feel free to fork us on github and make a pull request! It would save us some time re-implementing your code :P/>

Firstly, since its my opening post, I have to say how friggin' sweetass this turtle program is. Three thumbs up, just don't ask where the other one came from. On to business:

I've been scaling up spheres as tests and a 32r sphere, approximately 60% complete, was unable to resume after a server restart. It asked me (after starting the build program) if I wanted to resume, but after inputting "y" ("yes" seems to bring you back to the shapes list, never to resume again…) it threw up some error that I cant quite remember along the lines of "871:build function too long" or something similar.

Also, I know there's commands for pulling stock from ender chests, but your scripting is set to toss unrelated items (including ender chests) instead of pulling items from it. Is there a variation release yet that uses slot 1 ender chest and then, perhaps, the rest of the slots for fuel?

…and uh… I'm probably doing it all wrong so yeah…

<—it DOES say clueless, after all.

Thanks for the 3 thumbs up! I'm not all up to date on our resume functionality. Keridos would know more about that. As for enderchests, I've never before seen a command to pull stock from an enderchest, in vanilla Computercraft. If you could link to one that would be great!

EDIT: To Keridos: I'm sorry I am not on all that much anymore :(/> I really wish I had more time!
CupricWolf #91
Posted 06 August 2013 - 08:50 PM
Ok, I will wait with my code stuff until you made your pull request so we (or rather you) do not have to rebase again. I am gonna try to get my head around gps tracking soonish.

BTW: That Idea for getInput really is a good idea, would make our ChoiceFunction quite easier to the eye than it is now.

Go ahead and get working on what you were thinking of doing. I wont be able to work for a while, and I have your code base now so you won't have to worry about rebasing problems for me.
Nostaire #92
Posted 08 August 2013 - 12:38 PM
Ehh from what I'm reading the command to get things out of a block with inventory is turtle.suck

http://computercraft.info/wiki/Turtle

Unless I'm reading it wrong, thought it seems to refer to stationary blocks, placed in the world. I don't see why it couldn't do the same to a block in it's own inventory. I've flitted around these forums a bit and found other people mentioning using chickenbones enderchests and the suck command, but how and where the chest is, I'm not sure.
dronf #93
Posted 15 August 2013 - 09:11 PM
I'm very new to CC, and have a quick question that I didn't see the answer to in the first post: what slot does the fuel go in by default?

thx!
Keridos #94
Posted 18 August 2013 - 06:42 AM
I'm very new to CC, and have a quick question that I didn't see the answer to in the first post: what slot does the fuel go in by default? thx!
It asks for fuel when it runs out of fuel at this moment. Best is to give the turtle a Label and refuel it before building anything.

Ehh from what I'm reading the command to get things out of a block with inventory is turtle.suck http://computercraft.info/wiki/Turtle Unless I'm reading it wrong, thought it seems to refer to stationary blocks, placed in the world. I don't see why it couldn't do the same to a block in it's own inventory. I've flitted around these forums a bit and found other people mentioning using chickenbones enderchests and the suck command, but how and where the chest is, I'm not sure.
Basically you put the enderchest with turtle.placeUp() over the turtle then turtle.suckUp() to get something out of the enderchest then turtle.digUp() to get the enderchest back into the turtle.
I am thinking of adding enderchest compability for the script at some time in the future since some people mentioned it.

On to business: I've been scaling up spheres as tests and a 32r sphere, approximately 60% complete, was unable to resume after a server restart. It asked me (after starting the build program) if I wanted to resume, but after inputting "y" ("yes" seems to bring you back to the shapes list, never to resume again…) it threw up some error that I cant quite remember along the lines of "871:build function too long" or something similar.
Could you please try to reproduce that bug and tell me exactly how you did that? I am not 100% sure but maybe I know what could cause that but it might need a bit more testing.

Hmm.. I kinda works, but it isn't very good. I'm going to be busy for a week or two now, intermittenly, so maybe someone else should give it a try? I am going to play around with it a bit more soon, and see wha I can do to fix it, but I think someone else could probably make a better one idk. (plus mine has a bug right now, aside from making slanted hyperboloids) I'll post back if I have gotten anything to work.
Would be great if you could help us getting that code into this program aswell. I see the problem with the custom hyberbolic thingie that it needs to have no holes in it, and that is fas far as i know not that easy to accomplish.
Actually creating a github account and making pull requests to us would be the easiest way for both of us to get what we want. I can give you a small introduction to Git (the managing system for the code) if you need one.

/edit: Made the choice function much more compact and removed hell of a lot unnecessary code and implemented an advanced version of the getInput function.
WC_Shill #95
Posted 18 August 2013 - 04:08 PM
Is there any documentation on the command line interface?
Keridos #96
Posted 18 August 2013 - 06:11 PM
Is there any documentation on the command line interface?

Just added this here: this is btw shown when starting the program with -h.
https://github.com/Keridos/Shape-Builder/wiki/Command-Line-Interface
WC_Shill #97
Posted 19 August 2013 - 10:27 AM
Just added this here: this is btw shown when starting the program with -h.
https://github.com/K...-Line-Interface


Thank you kind sir.
CountJankula #98
Posted 19 August 2013 - 11:35 PM
I have been working on a sphere building program for a while and thought you could use it (if you want it).

It first calculates the coordinates of all the points for a sphere and stores them in a table, then builds from that table.

This code calculates coordinates and checks for duplicate solutions while preventing duplicates from being entered into the solution table
Spoiler

function calSolTable(rad)
--p is the polar angle (in radians) and ps is the polar angle step size (in radians)
ps = math.pi/(round((2*math.pi*rad)/4)*4)
solTable = {}
--start at the bottom of the sphere (p = ~pi) and moves up in steps of ps to the top (p = ~0)
for p = math.pi-ps, 0+ps, -ps do
  print("Calculation is ", round(10000*(math.pi-p)/math.pi)/100, "% complete.")
  --a is the azimuthal angle (in radians) and as is the azimuthal angle step size (in radians)
  as = 2*math.pi/(round((2*pi*math.ceil(math.sin(p)*rad))/8)*8)
  sleep(0.01)
  for a = 0, 2*math.pi - as, as do
   x = round(math.sin(a)*math.sin(p)*rad)
   y = round(math.cos(a)*math.sin(p)*rad)
   z = round(math.cos(p)*rad)
   xyz = x .. "," .. y .. "," .. z
   if not ckDups(solTable) then
	table.insert(solTable, xyz)
   end
  end
end
end

function ckDups(tblName)
--check if table is empty and if it is return false.
if #tblName == 0 then
  return false
  break
end
--checks if string is the same as the last entry in the table, if not then searches the table.
if xyz ~= tblName[#tblName] then
  maxSearchArea = #tblName - 2*rad
  if maxSearchArea < 0 then
   maxSearchArea = 0
  end
  for k = maxSearchArea, #tblName - 1 do
   --if we have searched the whole table then we are done.
   if xyz == tblName[k] then
	return true
	break
   elseif k == #tblName - 1 then
	return false
   end
  end
else
  return true
end
end

The function to build the sphere from the generated table
Spoiler

function buildFromTable()
xyztable = {}
for k,v in pairs(solTable) do
  for part in string.gmatch(v, "[^,]+") do
   table.insert(xyztable, part)
  end
  x = tonumber(xyztable[#xyztable - 2])
  y = tonumber(xyztable[#xyztable - 1])
  z = tonumber(xyztable[#xyztable])
  navigateTo(x, y, z)
  placeBlock()
end
end

This is a utility function for rounding numbers
Spoiler

function round(num)
if num >= 0 then
  return math.floor(num+.5)
else
  return math.ceil(num-.5)
end
end

This code will make a nice circle
Spoiler

function circle(rad)
--a is the azimuthal angle (in radians) and as is the azimuthal angle step size (in radians)
as = 2*math.pi/(round((2*pi*math.ceil(math.sin(rad)*rad))/8)*8)
for a = 0, 2*math.pi - as, as do
  x = round(math.sin(a)*rad)
  y = round(math.cos(a)*rad)
  navigateTo(x, y)
end
end
Keridos #99
Posted 21 August 2013 - 04:24 AM
I have been working on a sphere building program for a while and thought you could use it (if you want it). It first calculates the coordinates of all the points for a sphere and stores them in a table, then builds from that table.
We currently have a circle/sphere building code, could you please check the issues in our github? We have a discussion there for circular platform implementation and we are not sure how we want to do that. You can easily sign up on github, fork the project and modify it and put up a pull request. I will after that check the code and give feedback and accept the pull request after that. Before doing that though you may want to drop a message in an Issue regarding that that you want to work on something, I will then hold back my commits until you made your pull request since you would need to rebase if I did a commit during that time. Currently we are working on some things and I do not really want to read through 200 lines of code then compare to the 200 lines of code in the shape builder code and then decide on anything. It would be far easier for me and happydude if you just took a look at our code yourself and then post here if it actually is an improvement.
Me and happydude have modified the code in the past few months (after taking up the inactive project) so that it should be fairly easy to read, It is very well seperated into different functions and we even renamed most of the strange variable names to a more straightforward system.
pderuiter #100
Posted 29 August 2013 - 08:28 AM
I was browsing through the code and i noticed that your dome code could easily just use the circle code.

like so


function dome(typus, radius)
  if typus == "dome" then
	zstart = radius
  elseif typus == "sphere" then
	zstart = 0
  elseif typus == "bowl" then
	zstart = 0
  end
  if typus == "bowl" then
	zend = radius
  else
	zend = width - 1
  end

  for z = zstart,zend do
	if not cost_run_only and z ~= zstart then
	  safeUp()
	end
	circle(z)
  end
end
Maya81 #101
Posted 23 September 2013 - 10:57 AM
I'm having an issue where, I am asking the turtle to build a platform..

I fill it with a ton of redwood blocks, all the same type.. Then I set the turtle out in space, nothing underneath it. I tell it to build a 40 x 10 platform or whatever.. It will place a few blocks, sometimes 3, sometimes 12, sometimes 40… Then it will drop out all the maining blocks from its inventory and say it has no more inventory.. It didn't pick up any blocks during this time.. So why would the compareTo(1) be failing?
Maya81 #102
Posted 23 September 2013 - 11:11 AM
I also notice the turtle randomly ends up with diamond swords inside of it. Hmmmm…
Maya81 #103
Posted 23 September 2013 - 11:18 AM
Could this possible be a bug when 2 instances of the program is running on 2 different turtles with 2 different sets of blocks?
iXô #104
Posted 25 September 2013 - 02:08 PM
I there !

I tried this great program with no luck :(/>

First sometimes my turtle throw my construction material away and wait because of empty inventory (I am using dirt), not really a big deal, but strange.

But I have a blocking problem : I want to build a 64 radius bowl.

Not very long after starting (first layer is built, and the second layer is started) the program stop with : turtle:18: Too long without yielding



What is the problem ? How can I work around this ?


Thanks.
Keridos #105
Posted 02 October 2013 - 09:48 AM
Could this possible be a bug when 2 instances of the program is running on 2 different turtles with 2 different sets of blocks?
I'm having an issue where, I am asking the turtle to build a platform..

I fill it with a ton of redwood blocks, all the same type.. Then I set the turtle out in space, nothing underneath it. I tell it to build a 40 x 10 platform or whatever.. It will place a few blocks, sometimes 3, sometimes 12, sometimes 40… Then it will drop out all the maining blocks from its inventory and say it has no more inventory.. It didn't pick up any blocks during this time.. So why would the compareTo(1) be failing?

2 Turtles should not interfere at all with each other. I rewrote the Material Checking Function to check all blocks against slot 1. Make sure you put at least 1 blocks of the construction material in there and only one material at once. The turtle checks all blocks in the slots 2-16 and drops everything that is not equal to the block/item in slot 1. I did not touch this code since a few months, so It should still be working.
Could you please try to reproduce the problem and provide me with additional info regarding this?


But I have a blocking problem : I want to build a 64 radius bowl.

Not very long after starting (first layer is built, and the second layer is started) the program stop with : turtle:18: Too long without yielding
What is the problem ? How can I work around this ?

It might be a bug within Computercraft, the turtle building function should run without any problem and in any size. Since we do not store the building data it just builds procedurally.


Could you all please write me which ComputerCraft version you are running?

It looks as if the MC1.6.2 version of CC might be the reason for those bugs.
It ran pretty well with the MC1.5.2 Version of CC and I guess that something might have changed there. I will check the changelogs for any info regarding this.
Lying_Cak3 #106
Posted 07 October 2013 - 09:36 PM
I'm having an issue where, I am asking the turtle to build a platform..

I fill it with a ton of redwood blocks, all the same type.. Then I set the turtle out in space, nothing underneath it. I tell it to build a 40 x 10 platform or whatever.. It will place a few blocks, sometimes 3, sometimes 12, sometimes 40… Then it will drop out all the maining blocks from its inventory and say it has no more inventory.. It didn't pick up any blocks during this time.. So why would the compareTo(1) be failing?

I too had this problem with resupplying turtles. Seems that if you use resupplying moduals (not sure about plain mining turtles) from Misc Perperhials the turtle will only pull the inital stack and then randomly stop after that. I was able to get the turtle to finish the job by only placing one stack in the turtle then the remaining stacks in the resupply station. The turtle will run thru the intial stack then pull from the resupply station with no problems in every build I have done since.

This has quickly become one of my must have programs for any computercraft modded minecraft server I play on. I love the program and use it constantly to build large structures with out the worry of building it incorrectly or worst falling off and dieing :lol:/>.

Thanks for the great program.
Landstryder #107
Posted 05 November 2013 - 01:53 PM
Love this program, only thing I think you could do to improve it is make it dig more sand or gravel before it errors and pauses.

Made an awesome stargate style base and pyramid using this. Also awsome for making containment spheres for nucular reactors.
Fryo Knight #108
Posted 08 December 2013 - 09:37 PM
I am having a bit of an issue, every time I try to make a dome, I get "<Program name>:859: Too long without yielding"… I am making my structure in the sky, if that is any help, but is there any way of fixing this?
Letherin #109
Posted 12 December 2013 - 08:24 PM
Would be good to be able to build stairs DOWN. A lot of the time, I might be at ground level, in my house and want a good staircase to bedrock.

Knowing exactly where to stand on bedrock to get the turtle to build to the exact spot in my house i want is nigh impossible ;)/>
Edited on 12 December 2013 - 07:24 PM
buildybuildyjr's #110
Posted 13 December 2013 - 02:58 PM
So I've been building a sphere of diameter 100, a nice round number, by hand out of end stone.
I just found the sphere and dome builder, and then by extention shape builder, but in testing I've found a massive problem-
They can only build spheres of odd diameters. What would be the reason to effectively halve the sphere and dome building possibilities like that, and how can I change it to actually build a sphere of radius 50, instead of radius 50.5?

****EDIT****
nevermind, I wrote a program that works specifically with even-diameter sphere blueprints from that post on the minecraft forums… you know the one.
Edited on 15 December 2013 - 05:45 PM
Arkavile #111
Posted 16 January 2014 - 05:04 PM
I'm blown away at how easy your program makes it to build, especially large projects.

I do have a request/suggestion for the pyramid shape.
Would it be possible to add to the height and width of each wall and ceilling?
For an example the pyramid could have walls 4 high and then ceillings 4 wide, then 4 high, then 4 wide.. So the pyramid would not be 1 block steps but tiers of 4 block high, 4 wide.

Just an idea, again thanks for sharing your awesome work for us non-coders.
mcdodge34 #112
Posted 17 January 2014 - 12:27 AM
Wow, this thing is awesome, exactly what I wanted, only problem is would it be able to do an extra big structure like a 64 radius dome in the ocean, testing it out at the moment, only downside is it doesn't seem to auto-ressuply itself from any chest with anything, with a big project like I have it would be extremely annoying to chase the turtle to feed her, I know nothing about programming please don't show me any code, if its a code, give me a pastebin link that would work on the turtle, I appreciate the people that love to program seriously, but its not for me, the only though of writing any program, I would prefer to kill myself instead, all thoses lines of coding are a headache just thinking of it…

Your hard work is appreciated…
Arkavile #113
Posted 18 January 2014 - 06:16 PM
Wow, this thing is awesome, exactly what I wanted, only problem is would it be able to do an extra big structure like a 64 radius dome in the ocean, testing it out at the moment, only downside is it doesn't seem to auto-ressuply itself from any chest with anything, with a big project like I have it would be extremely annoying to chase the turtle to feed her, I know nothing about programming please don't show me any code, if its a code, give me a pastebin link that would work on the turtle, I appreciate the people that love to program seriously, but its not for me, the only though of writing any program, I would prefer to kill myself instead, all thoses lines of coding are a headache just thinking of it…

Your hard work is appreciated…

If you use the MiscPeripherals mod there is a resupply module and block. Add the resupply module to your turtle and place a resupply block to it's left. Keep the resupply block full of materials and you'll be fine.
Keridos #114
Posted 22 February 2014 - 09:32 PM
Wow, this thing is awesome, exactly what I wanted, only problem is would it be able to do an extra big structure like a 64 radius dome in the ocean, testing it out at the moment, only downside is it doesn't seem to auto-ressuply itself from any chest with anything, with a big project like I have it would be extremely annoying to chase the turtle to feed her, I know nothing about programming please don't show me any code, if its a code, give me a pastebin link that would work on the turtle, I appreciate the people that love to program seriously, but its not for me, the only though of writing any program, I would prefer to kill myself instead, all thoses lines of coding are a headache just thinking of it…

Your hard work is appreciated…

If you use the MiscPeripherals mod there is a resupply module and block. Add the resupply module to your turtle and place a resupply block to it's left. Keep the resupply block full of materials and you'll be fine.
Is MiscPeripherals being updated again? Last thing I heard is that RichardG dropped development.

Also guys, sorry for the long time since the last update. Had some other projects to go. If you find a serious bug: Post it on the Github, Github notifies me about this. If you can program a bit, check out the code, everybody is invited to contribute. Just sign in on GitHub, fork the repository and modify your copy. If you want me to merge your stuff in, just make a pull request, I will then check the code and if bug free and working will commit it into the main repository.

/edit: Added ender chest refill mode and updated the program. No more hassle with refilling manually, just place the enderchest in slot 16 and select ender chest refill yes when asked. Keep plenty of building material in the chest and the turtle will automatically take out of it.
Edited on 27 February 2014 - 07:29 PM
IMarvinTPA #115
Posted 15 March 2014 - 01:04 PM
I also tried this builder for domes and my 4 radius dome does not render the same as http://www.plotz.co.uk/ for a 9 diameter sphere. I'm not sure that these are being built correctly.

Thanks,
IMarv
Keridos #116
Posted 15 March 2014 - 09:30 PM
I also tried this builder for domes and my 4 radius dome does not render the same as http://www.plotz.co.uk/ for a 9 diameter sphere. I'm not sure that these are being built correctly.

Thanks,
IMarv


There is no definition of being built "correctly". We are using pruby's sphere building code because it produces 1 layer thick spheres of a pretty good quality.
While I can maintain the program I did not write much of the actual building code, but helped with pretty much anything. I will not modify the code being currently used just because some one sais, that maybe some sphere may look better. We need code that can progressively build such a sphere and be of high quality from small to huge scale and pruby's code scales pretty well and works like a charm.
CometWolf #117
Posted 15 March 2014 - 10:01 PM
I don't know how either of these codes are set up, but 9 diameter and 4 radius is not the same >.>
Keridos #118
Posted 16 March 2014 - 12:39 AM
I don't know how either of these codes are set up, but 9 diameter and 4 radius is not the same >.>

Ah you mean that one. I think our code is limited to uneven diameters.
And I do not know how that guy makes his spheres, but as far as I know prubys code uses those blocks, that the longest part of the Circles line (if you'd draw it) would be in.
IMarvinTPA #119
Posted 16 March 2014 - 03:47 AM
The comparison is apples to apples. The "radius" parameter becomes a width of 2*radius + 1 which means a 4 radius input becomes a 9 diameter dome. I have a version that does not produce Plotz's spheres, but uses http://www.hardijzer.nl/MinecraftSpheres.html sphere engine (because I can easily read the javascript.) My version is at http://pastebin.com/JH3ATidy but it is not quite right yet. When I tried to do a 9 diameter dome, it started a layer too low, so I adjusted it, and my 49 diameter dome started a layer too high. It'll need a little more tweaking before it's golden. I also changed it to ask for diameters instead of radii so an even sized sphere or dome could be generated.

Thanks,
IMarv
Keridos #120
Posted 16 March 2014 - 12:47 PM
The comparison is apples to apples. The "radius" parameter becomes a width of 2*radius + 1 which means a 4 radius input becomes a 9 diameter dome. I have a version that does not produce Plotz's spheres, but uses http://www.hardijzer...aftSpheres.html sphere engine (because I can easily read the javascript.) My version is at http://pastebin.com/JH3ATidy but it is not quite right yet. When I tried to do a 9 diameter dome, it started a layer too low, so I adjusted it, and my 49 diameter dome started a layer too high. It'll need a little more tweaking before it's golden. I also changed it to ask for diameters instead of radii so an even sized sphere or dome could be generated.

Thanks,
IMarv

Well we already had a discussion about another sphere engine, to add an alternative for pruby, because I and a few others think that it produces too cubish spheres in low diameters. Hm, maybe when you succeed we may integrate it into the shape builder here if you allow us to.
Edited on 16 March 2014 - 11:48 AM
IMarvinTPA #121
Posted 16 March 2014 - 03:41 PM
The comparison is apples to apples. The "radius" parameter becomes a width of 2*radius + 1 which means a 4 radius input becomes a 9 diameter dome. I have a version that does not produce Plotz's spheres, but uses http://www.hardijzer...aftSpheres.html sphere engine (because I can easily read the javascript.) My version is at http://pastebin.com/JH3ATidy but it is not quite right yet. When I tried to do a 9 diameter dome, it started a layer too low, so I adjusted it, and my 49 diameter dome started a layer too high. It'll need a little more tweaking before it's golden. I also changed it to ask for diameters instead of radii so an even sized sphere or dome could be generated.

Thanks,
IMarv

Well we already had a discussion about another sphere engine, to add an alternative for pruby, because I and a few others think that it produces too cubish spheres in low diameters. Hm, maybe when you succeed we may integrate it into the shape builder here if you allow us to.

Yeah, I was testing it with the radius 4 option and was not satisfied, which lead me to not trust it for something gargantuan. Permission is granted. I just need to understand and fix the vertical jitter.

Edit: I'm happy with http://pastebin.com/JH3ATidy now. The vertical jitter was me counting incorrectly, Even diameters are handled slightly differently than odd diameters to keep the shape within the desired size. Enjoy!

IMarv
Edited on 16 March 2014 - 04:30 PM
Keridos #122
Posted 16 March 2014 - 09:58 PM
The comparison is apples to apples. The "radius" parameter becomes a width of 2*radius + 1 which means a 4 radius input becomes a 9 diameter dome. I have a version that does not produce Plotz's spheres, but uses http://www.hardijzer...aftSpheres.html sphere engine (because I can easily read the javascript.) My version is at http://pastebin.com/JH3ATidy but it is not quite right yet. When I tried to do a 9 diameter dome, it started a layer too low, so I adjusted it, and my 49 diameter dome started a layer too high. It'll need a little more tweaking before it's golden. I also changed it to ask for diameters instead of radii so an even sized sphere or dome could be generated.

Thanks,
IMarv

Well we already had a discussion about another sphere engine, to add an alternative for pruby, because I and a few others think that it produces too cubish spheres in low diameters. Hm, maybe when you succeed we may integrate it into the shape builder here if you allow us to.

Yeah, I was testing it with the radius 4 option and was not satisfied, which lead me to not trust it for something gargantuan. Permission is granted. I just need to understand and fix the vertical jitter.

Edit: I'm happy with http://pastebin.com/JH3ATidy now. The vertical jitter was me counting incorrectly, Even diameters are handled slightly differently than odd diameters to keep the shape within the desired size. Enjoy!

IMarv

You replaced the code in our program? I will most probably add that in the official release within the next days, will check it out before though.
IMarvinTPA #123
Posted 16 March 2014 - 11:58 PM
You replaced the code in our program? I will most probably add that in the official release within the next days, will check it out before though.

Yes. The framework around it has features that are very nice to have. The ender chest reloading thing was vital for a 49 diameter dome. (I think it stopped and topped up about 4 times.) Most of the work was in changing when it detected that a block was needed. The general test-the-area-we-think-is-part-of-the-surface I kept relatively intact. (Now that I'm thinking about it, there may be some active but otherwise unused code left behind.)

IMarv
Edited on 16 March 2014 - 10:58 PM
Keridos #124
Posted 23 March 2014 - 03:16 PM
You replaced the code in our program? I will most probably add that in the official release within the next days, will check it out before though.

Yes. The framework around it has features that are very nice to have. The ender chest reloading thing was vital for a 49 diameter dome. (I think it stopped and topped up about 4 times.) Most of the work was in changing when it detected that a block was needed. The general test-the-area-we-think-is-part-of-the-surface I kept relatively intact. (Now that I'm thinking about it, there may be some active but otherwise unused code left behind.)

IMarv

I am testing your code right now, Looks as if you have a small bug where it does not start where it does for all other programs. Will see if I can fix this: It actually builds the first layer of the sphere one above the starting layer, where all other shapes start on their starting y level. Basically the first layer of the build should be the one the turtle stands on since it always places the blocks below it.
At least the small spheres look noticeable better with your code. The bigger spheres look smaller with your code, but also a small bit better.
Btw: awesome work with including our methods, I see you have completetly used our movement and Block place functions.

Now there is just this one small bug that makes it build a bit higher than intended.
Edited on 23 March 2014 - 03:30 PM
Sakata #125
Posted 23 March 2014 - 05:24 PM
Is there any way to make it so that the program can use radius and calculate the values, to build from the center?

It's quite difficult to figure up these values – I'm by no means a mathematics guy. Basically I want to place the turtle in the 'center', and have it build from there. (If there is some tool I could use to visually see the size, and then input the correct values for what I'm wanting that would be awesome as well)

Sphere, circle, and 6-prism could really use this (it already asks for radius). Imagine others would work well with this as well.

Love it so far, that calculation bit aside :D/>

Also that even-sided sphere (and hopefully circle/cylinder) would be really nice as well. I tend to build inside chunk boundaries.
Edited on 23 March 2014 - 04:28 PM
Keridos #126
Posted 23 March 2014 - 05:27 PM
it is pretty easy actually, Imaging you put a square about what you build?
The turtles starting point is the left bottom edge of that square. We will add the functionality to set the turtles point as starting point somewhen. But it is not as simple as you might think as that only works for uneven side lenghts f.ex.
Sakata #127
Posted 23 March 2014 - 06:52 PM
Also, a cool feature for the 'line' part. I ended up having to build the hexagon myself with the build guide from openblocks, but now I want nice pretty lines going from the center point (a 2x2, but that is no problem) to each 'corner'. When I saw the line program I hoped for a line in any direction, but it seems to only do straight lines.

Could a function be built, in which you enter the starting and ending points of the line, and it calculates the correct build-path? For example: place turtle, run shapebuilder, select 'line' mode, and tell it how many blocks forward and right the end of the line is, perhaps the line 'thickness', and then it digs/places the materials as it goes?
Edited on 23 March 2014 - 05:52 PM
Keridos #128
Posted 23 March 2014 - 09:31 PM
1. of all, the line feature is not easy and only digging the parts out where the wall needs to be is pretty much impossible (you will almost always end up with more stuff being digged away than blocks placed. And to be honest, I do actually fix this program, check its functionality and add several smaller parts in but I have (soon 2) Minecraft Mod(s) that I need to maintain atm, so I do not spend much time for this anymore. The whole not straight line stuff is possible, but a bit of work, especially when building with a specified thickness (efficient movement etc).Though I will open up an issue on github for that, but it might take quite a while to add that in (except when somebody like MarvinTPA actually writes the code of course).

Btw: I will most likely include MarvinTPAs sphere code in this program. Huge Thanks for him for writing it, especially nice that he actually took a look at our program and integrated it. Just 1 minor bug in there left to be fixed.
Edited on 23 March 2014 - 08:34 PM
CupricWolf #129
Posted 04 August 2014 - 02:04 AM
Also, a cool feature for the 'line' part. I ended up having to build the hexagon myself with the build guide from openblocks, but now I want nice pretty lines going from the center point (a 2x2, but that is no problem) to each 'corner'. When I saw the line program I hoped for a line in any direction, but it seems to only do straight lines.

Could a function be built, in which you enter the starting and ending points of the line, and it calculates the correct build-path? For example: place turtle, run shapebuilder, select 'line' mode, and tell it how many blocks forward and right the end of the line is, perhaps the line 'thickness', and then it digs/places the materials as it goes?

I have made a new line generation algorithm and I will be implementing it into the line shape (and other places the line shape is used) soon.

Is there any way to make it so that the program can use radius and calculate the values, to build from the center?

It's quite difficult to figure up these values – I'm by no means a mathematics guy. Basically I want to place the turtle in the 'center', and have it build from there. (If there is some tool I could use to visually see the size, and then input the correct values for what I'm wanting that would be awesome as well)

Sphere, circle, and 6-prism could really use this (it already asks for radius). Imagine others would work well with this as well.

Love it so far, that calculation bit aside :D/>

Also that even-sided sphere (and hopefully circle/cylinder) would be really nice as well. I tend to build inside chunk boundaries.
Centering certain shapes will be next on my list of things to do once I replace the old line code everywhere.
CupricWolf #130
Posted 04 August 2014 - 11:35 AM
I have updated the code to have the ability to draw a line between any two points. The most up to date version is hosted at http://pastebin.com/495JkmS4
Edited on 04 August 2014 - 09:35 AM
Keridos #131
Posted 05 August 2014 - 02:06 AM
Updated the main post and the main download link to the newest code to reflect CupricWolfs (old name was happydude) changes.
CupricWolf #132
Posted 07 August 2014 - 11:05 AM
There was a bug in the code you pulled, the code will not build a sphere because of a typo. I suggest pulling from github asap!

EDIT: I'm in the middle of a small overhaul of the syntax. Please wait just a bit longer until I can do that (like in 2 hours from now, 2014-08-07 UTC 11:00 AM)

EDIT2: There we go! The current stable version is now live on github. Please pull from there to your pastebin. (Time is now 2014-08-07 UTC 11:24 AM, I overestimated by a whole hour and a half! oops)

EDIT3: Keridos, this is still broken in your pastebin!!! It's now been broken for over a week!!! (Time is now 2014-08-12 UTC 10:40 PM)

EDIT4:For those of you still waiting for the main Pastebin to update, http://pastebin.com/495JkmS4 is currently up to date. Additionally http://pastebin.com/c956Dbp0 is up to date and includes pruby's old circle code instead of the newer one for those of you with nostalgia. (Time is now 2014-8-19 UTC 11:30 AM)

EDIT 4: Thanks for updating Keridos!
Edited on 20 August 2014 - 06:47 PM
Wooki_inthetrees #133
Posted 22 August 2014 - 06:23 PM
may i recommend a circular platform instead of just a hollow circle?
CupricWolf #134
Posted 23 August 2014 - 09:22 PM
may i recommend a circular platform instead of just a hollow circle?

We have that shape as a potential future shape. Unfortunately that shape doesn't really work with the way that we generate circles right now. We will work on it when we have time.
Thanks for the suggestion!
heimdall116 #135
Posted 27 August 2014 - 07:45 PM
Very cool plug-in for turtles! I had been working on something similar (here's my patchy dome) with the intention of eventually getting to a castle builder…n-sided polygon ramparts with towers (cylinders and pyramids) on the corners, for example. You guys are way ahead of me though, and if there's any way I could hitch a ride on your train instead of lone wolfing it, I'd love to pitch in.

Looking through your code, I thought it was funny that I coincidentally picked some of the same variable names (like "facing") you did, and just implemented them slightly differently (like 1-4 instead of 0-3). By the way, in that particular case I might be able to help you out already: here's a script that ensures the turtles always move *forward* (never in reverse) with the same efficiency. xRel and yRel would by my "GPS" variables.


local function face(f)
-- Re-orient the turtle WRT original facing: 1=forward; 2=right; 3=back; 4=left
		if f-facing == 0 then return
		elseif math.abs(f-facing) == 2 or f-facing == 1 or f-facing == -3 then
				while f-facing ~= 0 do
						turtle.turnRight()
						facing = facing + 1
						if facing == 5 then facing = 1 end
				end
		else
				turtle.turnLeft()
				facing = facing - 1
				if facing == 0 then facing = 4 end
		end
end

local function getThereX(dist)
		if dist == 0 then
				return
		elseif dist > 0 then
				face(1)
		else
				face(3)
		end
		
		for n = 1,math.abs(dist) do
				tryDig()
				tryForward()
		end
		
		xRel = xRel + dist
		return 0
end

local function getThereY(dist)
		if dist == 0 then
				return
		elseif dist > 0 then
				face(4)
		else
				face(2)
		end
		
		for n = 1,math.abs(dist) do
				tryDig()
				tryForward()
		end
		
		yRel = yRel + dist
		return 0
end

local function goTo(x2,y2)
		local dx = round(x2-xRel)
		local dy = round(y2-yRel)
		
		-- Check for low-hanging fruit first
		if facing == 1 and dx > 0 then
				dx = getThereX(dx)
		elseif facing == 2 and dy < 0 then
				dy = getThereY(dy)
		elseif facing == 3 and dx < 0 then
				dx = getThereX(dx)
		elseif facing == 4 and dy > 0 then
				dy = getThereY(dy)
		end
		
		-- do the shorter angle next
		if facing % 2 == 1 then
				dy = getThereY(dy)
				dx = getThereX(dx)
		else
				dx = getThereX(dx)
				dy = getThereY(dy)
		end
end

Here are some other suggestions, which I would love to (and think I am able to) help implement if you're interested. I realize that a few of these (like the n-prism) are more challenging, but I have some ideas on how to go about them all.

Optional command line entry interface
- type "versatileShape dome 7 -d -e -f" to make a dome with diameter 7, "dig down" flag, "use ender chest" flag, "fill in" flag
- Suggest writing a function to populate the "parameters table" right away, by looping through #argTable if inputs are provided
- Good for scripting larger projects (like a castle!!! :)/> )

Re-organize the (already brand new) input menu (sorry, CupricWolf! We could use the same layout?)
- Choose 2-D foundation first (line, circle, n-sided poly)
- Then choose solid form (solid, tube, pyramid, 2-D)
— So Circle choices would be "sphere, cylinder, cone, flat circle"
— But Square choices would be "cuboid, square tower, pyramid, flat square"
— And n-sided poly choices would be "n-prism, n-tower, n-pyramid, polygon"
- Seems like the only hard one would be the n-prism, which would require a new "angled surface" algorithm

Write a builder for imperfect n-sided polygons (aka, not all angles equal)
— Construct by angle/side length
— Possibly develop a GUI, or see what's already out there
— Probably skip the "prism" option on this one ;)/>

New external scripts to help showcase the code
— Castle/fort!!!

If any of these seems like a priority and you're not already working on it, I'd be happy to get started myself. Thanks for your consideration. :)/>
Edited on 27 August 2014 - 05:53 PM
252-rer #136
Posted 31 January 2015 - 10:28 PM
I know this may not be being developed anymore but;
I'm not sure why but every time the turtle refills from an ender chest it draws out way to many stacks and some of them are in numbers like 80-100 stacks, then drops the ender chest.
Lyqyd #137
Posted 01 February 2015 - 01:12 AM
You're on an outdated version. One of the past versions of CC had a bug like you describe, where turtle.suck would duplicate items.
252-rer #138
Posted 01 February 2015 - 03:38 AM
Ah that explains it, yeah im currently using 1.63.
oxgon #139
Posted 01 February 2015 - 04:31 PM
If this is not being worked on any more, does anyone know of a good shapes that is working?
wakafanykai123 #140
Posted 25 February 2015 - 07:32 AM
If this is not being worked on any more, does anyone know of a good shapes that is working?
This still works.
raven0ak #141
Posted 18 May 2015 - 06:41 AM
just to point ,builder has slight bug: return to start will ALWAYS return it to 1 back and one left past starting point:
|

[r]

s=start
r=where it returns


also really could use ability to invert cuboid building
Mengiiel #142
Posted 27 June 2015 - 09:12 PM
I am stuck on Version 1.6.4 is the whole turtle.suck command buggy or is this just a problem with the enderchest. if so, do you think its possible to change the code in a way the Turtle goes back to startpossition if out of materials and refill from a lokal chest there? than go back and continue its job?
IMarvinTPA #143
Posted 02 November 2015 - 10:10 PM
I am testing your code right now, Looks as if you have a small bug where it does not start where it does for all other programs. Will see if I can fix this: It actually builds the first layer of the sphere one above the starting layer, where all other shapes start on their starting y level. Basically the first layer of the build should be the one the turtle stands on since it always places the blocks below it.
At least the small spheres look noticeable better with your code. The bigger spheres look smaller with your code, but also a small bit better.
Btw: awesome work with including our methods, I see you have completetly used our movement and Block place functions.

Now there is just this one small bug that makes it build a bit higher than intended.

Replying a year and a half later, cause I'm a slacker. ;)/> The bug is probably more of a usage difference between me and the normal design of the program. For my domes, I needed to place the turtle on the top of the wall and build up from there, so I needed it to build one higher than where it was placed.

It was a pleasure to update the existing code. I didn't see a need to reinvent the wheel. All of the code was there already and all I needed to do was improve the math.

IMarv
ShoeLace1291 #144
Posted 30 July 2018 - 12:17 PM
Great script! Been using it constantly! Quick question, though: How come the cuboid command doesn't build a roof, aka the top face?