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

Sphere and Dome Builder

Started by pruby, 08 April 2012 - 10:41 AM
pruby #1
Posted 08 April 2012 - 12:41 PM
Hi all,

I've been experimenting with computercraft turtles and have put together a program for building spheres and domes based on the method descibed at http://www.minecraft...eprints-inside/ with some optimisations. The spheres produced are completely sealed (no holes) and include no unneccesary blocks - removing and block will leave a hole. This is purely a construction program, will never clear space and does not require a mining turtle. To use, extract and copy sdbuild to the turtle (or cc-get install sdbuild), place the turtle at the bottom centre of where you want to build the sphere or dome, and run:

For a sphere:
sdbuild sphere <radius>

For a dome:
sdbuild dome <radius>

You might want to do this from in front of it - it starts by moving backwards. The structure will extend the radius to each side of the centre.

The turtle will stop and wait for assistance if any movement is blocked or it runs out of materials, allowing the player to remove obstructions or top up materials without it losing track of where it's up to. It will not stop if it can't place a block - continues on. Tall grass can make it leave gaps at the base - check and tidy up if needed. If it stops, check the screen to see why.

Maybe just a small shelter for the night? Wooden planks, radius 3:




I built a larger one out of glass to create a pleasant, safe place to sleep with a fountain and trees. Glass block dome, radius 16:



This should be able to scale to very large sizes - plans the structure in small slices as it builds so shouldn't hit the processing limits.

Some tweaks may come - some little cosmetic issues and efficiency gains. In particular the movement is efficient for the "steep" layers (bottom of dome, mid sphere) but gets pretty inefficient on the nearly flat layers (i.e. top of the dome, top and bottom of spheres).
wilcomega #2
Posted 08 April 2012 - 04:08 PM
very nice work i have to say
EatenAlive3 #3
Posted 10 April 2012 - 10:10 PM
Awesome!
Halleyelec #4
Posted 10 May 2012 - 09:21 AM
Hi,

first of all I love this!

Secondly, Im not sure if its an issue with Turtles in general but when my Turtle is say creating a sphere, I save and exit then reload, the turtle running your program seems to stop. Are you aware of this?

Like I said, im not sure if its all programs or just yours…
BigSHinyToys #5
Posted 10 May 2012 - 06:01 PM
Hi,

first of all I love this!

Secondly, Im not sure if its an issue with Turtles in general but when my Turtle is say creating a sphere, I save and exit then reload, the turtle running your program seems to stop. Are you aware of this?

Like I said, im not sure if its all programs or just yours…
all computers and turtles shutdown when you leave the game. that means when you boot it again the turtle or computer will have lost all its vars and the program will not be running. This can be fixed bt maing the turtle save its pos in a file but that is not realy a good solution. for the time being just make shore you have finished any builds before closing.
Halleyelec #6
Posted 10 May 2012 - 06:54 PM
Hi,

first of all I love this!

Secondly, Im not sure if its an issue with Turtles in general but when my Turtle is say creating a sphere, I save and exit then reload, the turtle running your program seems to stop. Are you aware of this?

Like I said, im not sure if its all programs or just yours…
all computers and turtles shutdown when you leave the game. that means when you boot it again the turtle or computer will have lost all its vars and the program will not be running. This can be fixed bt maing the turtle save its pos in a file but that is not realy a good solution. for the time being just make shore you have finished any builds before closing.

Thanks for this! Least I know now!

Dammit I have 5 half complete death stars!! lol Maybe I can make them into "Honey I shrunk the kids" and turn them into cereal bowls!!
neto333 #7
Posted 17 May 2012 - 08:38 PM
Thank you :P/>/>.
Cranium #8
Posted 25 July 2012 - 09:37 PM
WOW, I love this! I just started my turtle running a 50 wide dome, and after 10 minutes, it finally completed it's second layer! I suspect feeding it a LOT of blocks.

Tempted to tell it to build a 100 wide sphere on a flat world, but afraid to think how long I would have to leave my computer running just to start that first layer…Also, whoever can have it constantly save it's position and state would be my absolute HERO, since I have to constantly restart my private server I run.
ManWhoCrafts #9
Posted 18 August 2012 - 11:09 PM
First of all thanks to pruby for this awesome program. Is there anyway I can start the programs at a particular level? My problem is I've started building a 160 Diameter sphere (it's going to be a Death Star!) that stopped around level 43 due to Minecraft crashing, and I don't really fancy starting again as it took about 6 hours to get this far! Any help would be appreciated….
Cranium #10
Posted 19 August 2012 - 12:21 AM
First of all thanks to pruby for this awesome program. Is there anyway I can start the programs at a particular level? My problem is I've started building a 160 Diameter sphere (it's going to be a Death Star!) that stopped around level 43 due to Minecraft crashing, and I don't really fancy starting again as it took about 6 hours to get this far! Any help would be appreciated….
Not without making changes to the program. It doesn't save its state as it goes. Maybe in a future release?
Warlordjones #11
Posted 25 September 2012 - 09:41 PM
Any chance of an ellipse builder?
Cranium #12
Posted 25 September 2012 - 09:50 PM
Any chance of an ellipse builder?
I suppose if you worked on the code a little, you could tweak the math and have it do what you want.
Orwell #13
Posted 26 September 2012 - 10:19 PM
I took a look at the code real quick (used it before btw, very handy). The code isn't really made for such an adaption I believe. It's mainly written from a symetric perspective. The implementation of two different radi would be rather hard IMO.
Cranium #14
Posted 26 September 2012 - 10:21 PM
I'd say that if you are a math wiz, feel free to make your own version. I am no such person, so nope….
Orwell #15
Posted 26 September 2012 - 10:31 PM
Well, the algorithm used is very good for spheres. I couldn't even get near that efficiency when using an ellipse as base. I don't think I could make something build ellipses as good as this programs builds spheres. And I don't really need ellipse-shaped sphere thingies anyways. :P/>/>
Cranium #16
Posted 26 September 2012 - 10:33 PM
What do you need an ellipse for anyway?
pruby #17
Posted 27 September 2012 - 01:15 AM
Any chance of an ellipse builder?

I'm not entirely sure that the gap-free condition will hold but you could scale along the x axis fairly easily.

Given:


local stretch = 1.2

You'd need to change everywhere that sets xstart and xend:


		  xstart = math.floor(radius * stretch)
		  xend = math.ceil((radius + max_offset_x) * stretch)

And divide x axis distances by this when doing radius checks:


(((radius - (x + dx)) / stretch) ^ 2 + (radius - (y + dy)) ^ 2 + (radius - (z + dz)) ^ 2) ^ 0.5 >= boundary_radius

Those aren't the only pieces of code you'd need to change but it's all the same theme. I'm not planning to put in ellipse support, but please let us know if you do!
psidingu #18
Posted 23 November 2012 - 03:08 AM
Hi all,
how can I install this in Minecraft? Thanks in advance
pruby #19
Posted 23 November 2012 - 11:26 AM
1. Install computercraft mod.
2. Follow instructions at http://cc-get.djranger.com/ to turn on http and install cc-get.
3. Build a turtle and type "cc-get install sdbuild" on the console.

Good luck ;)/>/>
psidingu #20
Posted 24 November 2012 - 01:35 AM
How can I install computercraft? It says on yt that I have to install too many items or other stuff for it to work. Is this true?

Thank you!
ChunLing #21
Posted 24 November 2012 - 04:37 PM
Go here, select the latest version that is appropriate for your version of minecraft, download the zip, place it in your mods folder. You do need the correct version of Forge, but no other mods are required.
Expenox #22
Posted 24 November 2012 - 04:43 PM
Nice! I'm going stick with my simple 9 by 9 though. ;)/>/>
Still need some more learning. ^^
Heracles421 #23
Posted 25 November 2012 - 01:16 AM
It's quite nice, congrats
yamidarkstar #24
Posted 26 November 2012 - 07:15 PM
is there a pastebin file for this by chance or if not can you put one up?
pruby #25
Posted 26 November 2012 - 07:35 PM
Done, should make it easier :)/>

http://pastebin.com/KBJ1wDz0
yamidarkstar #26
Posted 26 November 2012 - 08:50 PM
thank you everything else i tried made the program give me an error this method worked great
Viproz #27
Posted 02 December 2012 - 11:35 PM
thanks a lot for this program, work fine and do a nice job :)/>
guamie #28
Posted 15 December 2012 - 07:45 PM
Hi Pruby,

This looks like such a cool program!

I want to use it, however when I try to run the program, I get the error:
Blocked attempting to move up.
Please clear and press enter to continue.

The turtle I am using shouldn't be blocked. I place it in a totally flat area.

Any help with what I am doing wrong would be great!

even simple things like:

sdbuild dome 3

won't work, I get the error in all projects
Ikkalyzte #29
Posted 15 December 2012 - 08:06 PM
Did you remember to use fuel? Sounds like that's what happened :)/>
Nice program, btw. I've looked at it, and have yet to find a use for it, but it looks awesome.
Metylan #30
Posted 25 December 2012 - 01:59 AM
The Sphere and Dome builder dosnt work for me @MC 1.2.5, turtles simply fly off and do its thing, but it dosnt use blocks to build anything. When it finish it says Used blocks ect. but it used no blocks.
Sorry for my bad english…
remiX #31
Posted 25 December 2012 - 02:35 AM
Wow, this is amazing xD

I'd take a guess and say you made this for CC 1.3 :P/> Because it only uses slots 1-9
xInDiGo #32
Posted 11 January 2013 - 11:25 PM
any chance on an update on this one? seems to be broken, and i'm not even remotely good enough to fix this myself! first error i get is on line 202: attempt to perform arithmetic __mul on nil and number

this is on my wish list for sure!
theoriginalbit #33
Posted 11 January 2013 - 11:34 PM
any chance on an update on this one? seems to be broken, and i'm not even remotely good enough to fix this myself! first error i get is on line 202: attempt to perform arithmetic __mul on nil and number
when running it are you giving it a radius argument? i.e.

sdbuild <type> <radius>
outlawgb #34
Posted 14 January 2013 - 01:45 PM
pruby any chance you could add a layer start please ie (sdbuild dome 32 layer 44) my lua is not good enough ive looked at the code dont think it would be to hard im just not good enough yet some times things happen that you have to quit or something on big domes/spheres would be a big help
pruby #35
Posted 14 January 2013 - 02:10 PM
Hi outlaw,

Roughly threw together a changed version, can't test atm. Could you have a look and see if works?

http://pastebin.com/SUJsjAqi

I got rid of the dome/sphere distinction - to build a dome set -sz to radius .

sdbuild 32 -sz 32

To do just the first layer:

sdbuild 32 -sz 32 -ez 32

So on and so forth
outlawgb #36
Posted 14 January 2013 - 02:32 PM
dont matter managed to do it it my self can continue building domes now even after i quit easyer thatn i thought it would be :)/>
outlawgb #37
Posted 14 January 2013 - 02:34 PM
oh cool will test it even though mine works its abit crude and have to start the turtle at right level
bluechiken #38
Posted 02 February 2013 - 09:57 PM
i am getting the error where it tells me it cant move due to being obstructed, i have fuel and blocks in its inventory, and it is on flat grass. please help
Morberis #39
Posted 11 February 2013 - 10:11 AM
i am getting the error where it tells me it cant move due to being obstructed, i have fuel and blocks in its inventory, and it is on flat grass. please help

It means you haven't run the refuel command in the turtle. Putting fuel in the turtle doesn't refuel it.


I'm just getting into computer craft, and I'm working through some LUA tutorials. I was wondering if I could get permission to change your program so it makes inverted domes, or if you could advise me on how to convert it to do that.
solaris187 #40
Posted 07 March 2013 - 01:55 AM
Hi outlaw,

Roughly threw together a changed version, can't test atm. Could you have a look and see if works?

http://pastebin.com/SUJsjAqi

I got rid of the dome/sphere distinction - to build a dome set -sz to radius .

sdbuild 32 -sz 32

To do just the first layer:

sdbuild 32 -sz 32 -ez 32

So on and so forth

I am attempting to build a dome using this command. I enter into the turtle (that has just been refueled) sdbuild -28 -sz 28 and it returns an invalid argument on the 28
Keridos #41
Posted 07 March 2013 - 12:42 PM
I have an idea: I am thinking of making the shape builder program a project on github so it can easily be changed. You may know that he incorporated your program (he of course credited you) into his.
Since the creator of the shape builder is not really online since quite a few days and he has not responded to questions in his thread and per pm it might be he is gone now.

And since a versatile shape builder could be more useful than like 5 small ones, I am asking you if you would like that idea and might want to help with it.
pruby #42
Posted 07 March 2013 - 02:41 PM
I am attempting to build a dome using this command. I enter into the turtle (that has just been refueled) sdbuild -28 -sz 28 and it returns an invalid argument on the 28

Try with 28 instead of -28?

sdbuild 28 -sz 28
pruby #43
Posted 07 March 2013 - 02:43 PM
I have an idea: I am thinking of making the shape builder program a project on github so it can easily be changed. You may know that he incorporated your program (he of course credited you) into his.
Since the creator of the shape builder is not really online since quite a few days and he has not responded to questions in his thread and per pm it might be he is gone now.

And since a versatile shape builder could be more useful than like 5 small ones, I am asking you if you would like that idea and might want to help with it.

Sure, encourage moving this on to a github repo. If you post the URL I'll look it up and may well contribute. In particular this could use some tidying up.
Keridos #44
Posted 07 March 2013 - 03:33 PM
Ok, i created the repo here:
https://github.com/Keridos/Shape-Builder/

Since you are one of the original authors and i would like to have at least a second man with commit privileges, would you like to get the authorization to push commits?
pruby #45
Posted 07 March 2013 - 04:41 PM
Hi Keridos,

Great thing with github is you don't need to have multiple people committing to the same repo. I maintain quite a few projects through github, often where the original author has disappeared entirely. I'll fork it over the weekend and send you back a pull request with any changes.

Cheers,

Tim
R167 #46
Posted 08 March 2013 - 02:44 PM
Hi, first of all I love this! Secondly, Im not sure if its an issue with Turtles in general but when my Turtle is say creating a sphere, I save and exit then reload, the turtle running your program seems to stop. Are you aware of this? Like I said, im not sure if its all programs or just yours…
This is just the turtles and not the program. Turtles have a bug (i believe that it is this) that stops there program when you relog into the game.
R167 #47
Posted 08 March 2013 - 02:45 PM
I have an idea: I am thinking of making the shape builder program a project on github so it can easily be changed. You may know that he incorporated your program (he of course credited you) into his.
Since the creator of the shape builder is not really online since quite a few days and he has not responded to questions in his thread and per pm it might be he is gone now.

And since a versatile shape builder could be more useful than like 5 small ones, I am asking you if you would like that idea and might want to help with it.

Sure, encourage moving this on to a github repo. If you post the URL I'll look it up and may well contribute. In particular this could use some tidying up.
I would favor this to be on pastebin personally. That way you can download it using the pastebin program.
NIckodemus #48
Posted 08 March 2013 - 06:59 PM
Would indeed be very nice to see this up on Pastebin. :)/>
sjkeegs #49
Posted 09 March 2013 - 04:07 AM
This is just the turtles and not the program. Turtles have a bug (i believe that it is this) that stops there program when you relog into the game.
This is not a bug. When the chunk that a turtle or computer gets unloaded they stop operating, and when they get loaded again they boot up to the OS screen. To make them continue to operate the program that they are running has to be designed to work that way (saving its state), and there has to be a startup mechanism to start the program up again.
Keridos #50
Posted 09 March 2013 - 10:32 AM
As long as it is on the github repo I will update the pastebin code whenever we fix/add something.
The pastebin code in the shape builder thread in my last post is up to date.
Soon I will start its own Thread here and link to the pastebin code and the github repo.
Just waiting a bit more for Aeolun but it looks as if he does not get back online (hasn't been here since a few weeks)

Shape Builder on pastebin: http://pastebin.com/RAHj4r2K
KriLL3 #51
Posted 15 March 2013 - 05:53 AM
This might be an obvious suggestion but why not add a feature that basically does the reverse of what the excavate command does? return to the starting point to load up on materials from a chest (can use a big chest to ensure it lasts, or feed it using RP2/BC/hopper etc if a really big prodject.
Keridos #52
Posted 17 March 2013 - 06:56 AM
pruby you think a new shape builder thread might be appropriate?
Seems as Aeolun is not getting back online so I thought about starting a new Thread for the shape builder. Also take a look at the github, I recently restructured the program a bit and you said that you may need to take a look at your code. Did not find the time yet to fully understand it. Also added a branch that contains code that you can use with a resupply turtle and station (from Miscperipherals).

/edit: merged the branch into the main program. So now we only have 1 program for all turtles. It automatically detects and uses mining and resupply modules. Chunkloader modules make the turtle not stop when you leave the age they work in (in smp)
KriLL3 #53
Posted 18 March 2013 - 02:26 PM
Also why does the turtle not use the last 7 slots of it's inventory?
luochen1990 #54
Posted 19 March 2013 - 02:59 AM
Well, the algorithm used is very good for spheres. I couldn't even get near that efficiency when using an ellipse as base. I don't think I could make something build ellipses as good as this programs builds spheres. And I don't really need ellipse-shaped sphere thingies anyways. :P/>/>
It's easy to describe a ellipse so it's not hard to get a ellipse one in fact . :)/>
luochen1990 #55
Posted 19 March 2013 - 03:07 AM
Hi,

first of all I love this!

Secondly, Im not sure if its an issue with Turtles in general but when my Turtle is say creating a sphere, I save and exit then reload, the turtle running your program seems to stop. Are you aware of this?

Like I said, im not sure if its all programs or just yours…
all computers and turtles shutdown when you leave the game. that means when you boot it again the turtle or computer will have lost all its vars and the program will not be running. This can be fixed bt maing the turtle save its pos in a file but that is not realy a good solution. for the time being just make shore you have finished any builds before closing.
I had also found that problem , which makes automatic production impossible. If this could be solved (better if without a file writting authority) , the cc mod will be the most useful and interesting mod !
Orwell #56
Posted 19 March 2013 - 02:40 PM
Well, the algorithm used is very good for spheres. I couldn't even get near that efficiency when using an ellipse as base. I don't think I could make something build ellipses as good as this programs builds spheres. And I don't really need ellipse-shaped sphere thingies anyways. :P/>/>
It's easy to describe a ellipse so it's not hard to get a ellipse one in fact . :)/>
Mathematically, not at all. But approximating it as accurate as possible with cubes and building it with as less moves as possible is something this program is very good at for spheres. It's not at all that practical to do so for ellipses. I didn't say it's impossible of course. The truth is simply that spheres and cubes are directly related through one variable (even if the relation isn't linear), thus finding an equivalency between a sphere and cubes is easier than between an ellipse/ellipsoid and cubes. It's a matter of interpolation really. It's still possible for ellipsoids though, the approximation would just be worse (that's what you get with a cuboid world).
luochen1990 #57
Posted 20 March 2013 - 02:53 AM
Well, the algorithm used is very good for spheres. I couldn't even get near that efficiency when using an ellipse as base. I don't think I could make something build ellipses as good as this programs builds spheres. And I don't really need ellipse-shaped sphere thingies anyways. :P/>/>
It's easy to describe a ellipse so it's not hard to get a ellipse one in fact . :)/>
Mathematically, not at all. But approximating it as accurate as possible with cubes and building it with as less moves as possible is something this program is very good at for spheres. It's not at all that practical to do so for ellipses. I didn't say it's impossible of course. The truth is simply that spheres and cubes are directly related through one variable (even if the relation isn't linear), thus finding an equivalency between a sphere and cubes is easier than between an ellipse/ellipsoid and cubes. It's a matter of interpolation really. It's still possible for ellipsoids though, the approximation would just be worse (that's what you get with a cuboid world).
yes , i posted a ellipsoid dome builder , which is based on a 3d printer and not work as less moves as possible , but that is not hard anyway , just a pre search for a path .
Keridos #58
Posted 20 March 2013 - 09:54 AM
luochen, you might want to work that in the shape builder program, it is open source and we could need the addition of a ellipsoid building routine.
pruby already has his code in the program: https://github.com/Keridos/Shape-Builder/
If you need any more info or do not know how to use github, just pm me.
Orwell #59
Posted 20 March 2013 - 10:52 AM
Well, the algorithm used is very good for spheres. I couldn't even get near that efficiency when using an ellipse as base. I don't think I could make something build ellipses as good as this programs builds spheres. And I don't really need ellipse-shaped sphere thingies anyways. :P/>/>/>
It's easy to describe a ellipse so it's not hard to get a ellipse one in fact . :)/>/>
Mathematically, not at all. But approximating it as accurate as possible with cubes and building it with as less moves as possible is something this program is very good at for spheres. It's not at all that practical to do so for ellipses. I didn't say it's impossible of course. The truth is simply that spheres and cubes are directly related through one variable (even if the relation isn't linear), thus finding an equivalency between a sphere and cubes is easier than between an ellipse/ellipsoid and cubes. It's a matter of interpolation really. It's still possible for ellipsoids though, the approximation would just be worse (that's what you get with a cuboid world).
yes , i posted a ellipsoid dome builder , which is based on a 3d printer and not work as less moves as possible , but that is not hard anyway , just a pre search for a path .
You don't quite get it. The approximation is the hard part. The algorithm Prudy uses is optimal and ellipsoids made out of cubes couldn't ever have the same accuracy. That was my statement. You seem to have missed the essence two times in a row. Minimalising movement for example wasn't the essence.
Shini #60
Posted 25 March 2013 - 03:01 AM
>_> is there a way to make continue its work after reloading/restart
CupricWolf #61
Posted 25 March 2013 - 01:07 PM
>_> is there a way to make continue its work after reloading/restart
I'm working on it but it is very hard. My solution is to write to a file its current X, Y, Z coordinates, then facing, the radius, the type,and it's current used blocks. The program correctly writes the file and when it starts back up again it correctly reads the file, but due to the complexity of the loops used i don't know where to put ways of rewriting the variable to the values from the save file.
Keridos #62
Posted 25 March 2013 - 01:20 PM
>_> is there a way to make continue its work after reloading/restart
I'm working on it but it is very hard. My solution is to write to a file its current X, Y, Z coordinates, then facing, the radius, the type,and it's current used blocks. The program correctly writes the file and when it starts back up again it correctly reads the file, but due to the complexity of the loops used i don't know where to put ways of rewriting the variable to the values from the save file.

Take a look at the shape builder here: https://github.com/Keridos/Shape-Builder
prubys code is included here and I considered that a startover script for reboots would be nice. If you want, you can try to add that to the shape builder as pruby and me are trying to consolidate all shape builders into one program, for better overview.
CupricWolf #63
Posted 25 March 2013 - 02:55 PM
>_> is there a way to make continue its work after reloading/restart
I'm working on it but it is very hard. My solution is to write to a file its current X, Y, Z coordinates, then facing, the radius, the type,and it's current used blocks. The program correctly writes the file and when it starts back up again it correctly reads the file, but due to the complexity of the loops used i don't know where to put ways of rewriting the variable to the values from the save file.

Take a look at the shape builder here: https://github.com/K...s/Shape-Builder
prubys code is included here and I considered that a startover script for reboots would be nice. If you want, you can try to add that to the shape builder as pruby and me are trying to consolidate all shape builders into one program, for better overview.
Ok, thanks. Also check out my thread I just made http://www.computercraft.info/forums2/index.php?/topic/11487-circular-structure-builder/ that is about the project in which I'm working on it. You might want to include the cylinder building function I have made. And maybe the progress bar. Are you doing any kind of work on resuming from a save file?
CupricWolf #64
Posted 25 March 2013 - 04:57 PM
>_> is there a way to make continue its work after reloading/restart
I'm working on it but it is very hard. My solution is to write to a file its current X, Y, Z coordinates, then facing, the radius, the type,and it's current used blocks. The program correctly writes the file and when it starts back up again it correctly reads the file, but due to the complexity of the loops used i don't know where to put ways of rewriting the variable to the values from the save file.
Take a look at the shape builder here: https://github.com/K...s/Shape-Builder prubys code is included here and I considered that a startover script for reboots would be nice. If you want, you can try to add that to the shape builder as pruby and me are trying to consolidate all shape builders into one program, for better overview.
Ok, thanks. Also check out my thread I just made http://www.computercraft.info/forums2/index.php?/topic/11487-circular-structure-builder/ that is about the project in which I'm working on it. You might want to include the cylinder building function I have made. And maybe the progress bar. Are you doing any kind of work on resuming from a save file?
I took a look at it, and I see you already have a cylinder function. I have forked you and will soon make a pull request because I have added a new shape, the bowl. I hope you take a look at it.
Keridos #65
Posted 26 March 2013 - 09:19 AM
>_> is there a way to make continue its work after reloading/restart
I'm working on it but it is very hard. My solution is to write to a file its current X, Y, Z coordinates, then facing, the radius, the type,and it's current used blocks. The program correctly writes the file and when it starts back up again it correctly reads the file, but due to the complexity of the loops used i don't know where to put ways of rewriting the variable to the values from the save file.
Take a look at the shape builder here: https://github.com/K...s/Shape-Builder prubys code is included here and I considered that a startover script for reboots would be nice. If you want, you can try to add that to the shape builder as pruby and me are trying to consolidate all shape builders into one program, for better overview.
Ok, thanks. Also check out my thread I just made http://www.computerc...ucture-builder/ that is about the project in which I'm working on it. You might want to include the cylinder building function I have made. And maybe the progress bar. Are you doing any kind of work on resuming from a save file?
I took a look at it, and I see you already have a cylinder function. I have forked you and will soon make a pull request because I have added a new shape, the bowl. I hope you take a look at it.

I will take a look at it as soon as you send the pull request. New functions are always welcome. Btw I am trying to make this project a bit more communitydriven, not just 1 person administering all of it. Since that Aeolun guy who took the program was online for like 3 weeks and then disappeared entirely (for almost 6 weeks now), I have tried to update the program and get people into helping with it.
CupricWolf #66
Posted 26 March 2013 - 06:54 PM
I will take a look at it as soon as you send the pull request. New functions are always welcome. Btw I am trying to make this project a bit more communitydriven, not just 1 person administering all of it. Since that Aeolun guy who took the program was online for like 3 weeks and then disappeared entirely (for almost 6 weeks now), I have tried to update the program and get people into helping with it.
Thanks for including! I'll try to be more active then :)/>
Scotty #67
Posted 29 March 2013 - 04:22 PM
I am attempting to build a dome using this command. I enter into the turtle (that has just been refueled) sdbuild -28 -sz 28 and it returns an invalid argument on the 28

Try with 28 instead of -28?

sdbuild 28 -sz 28

Hi Pruby,

I'm using your sdbuild as it's the only one I can find which lets me position the turtle in the center of the construction, which is necessary as I'm stacking domes and spheres of different radius on top of each other.

The version I'm running is http://pastebin.com/SUJsjAqi

Unfortunately when I go for a dome with the command line: sdbuild 24 -sz 24 the result is:


Unrecognized argument: 24
Usage: sdbuild <radius> [-c] [-sz
<start layer>] [-ez <end layer>]
sdbuild:218: attempt to call nil

I verified that it's the argument for -sz that's the problem by trying sdbuild 24 -sz 28 and got back

Unrecognized argument: 28

I'm hoping you have a fix for this.
Vas #68
Posted 08 June 2013 - 07:10 AM
This thing needs a fuel checker so when it runs out of fuel, it can be resumed when more fuel is added.
Drazlak #69
Posted 10 June 2013 - 04:45 AM
could you add something to build a floor for you because i use ftb and i have lots of rooms i like making
Jevoney #70
Posted 03 July 2013 - 12:31 AM
This turtle program looks fantastic sadly I have been unable to get it to even activate. I have downloaded the cc-get file (unpacked it) then merged it with computercraft.zip once in game however I get a program not found error when I enter "cc-get" into the turtle ….so either I have done this incorrectly over and over or this does not support multiplayer server?

Any assistance would be appreciated!

Update: Managed to get it working did not realize had to do a "pastebin get (filename) rename" to get it to work , again nice work excellent program!
Niseg #71
Posted 03 July 2013 - 03:22 AM
>_> is there a way to make continue its work after reloading/restart
I'm working on it but it is very hard. My solution is to write to a file its current X, Y, Z coordinates, then facing, the radius, the type,and it's current used blocks. The program correctly writes the file and when it starts back up again it correctly reads the file, but due to the complexity of the loops used i don't know where to put ways of rewriting the variable to the values from the save file.

I can tell you exactly how to do this conversion in the code but it has two parts - 1 converting the code into a state machine 2 finding a reliable way to keep the state

if for example we have this code

for i=1,16 do
a()
for j=1,16 do
b()
end
c()
end
d()

this is how it would look as a state machine

local endstate=10
local state=0
local i=1
local j=1

while state~= endstate do
	if state==0 then
	a(); state=1
	elseif state==1 then
		b()
		if j==16 then
			state= 2
		else
			j=j+1
		end

	elseif state == 2 then
		c()
		if i==16 then
			state=3
		else
			i=i+1
		end
	elseif state==4 then
		d()
		state=endstate
	end
-- save state ,j and i here
end


(part 1)
I think I did it correctly if i didn't mess it up . the whole idea is to have 1 loop which is "infinate" until reaching the end state . In the example code you actually have 3 states to save - state,i and j . So if you write a function with this state machine and you want to continue the process you will need to give it the state,i,j values it stopped in and it will continue from that exact point.

When getting into coding you should keep in mind that you don't have to keep a state to every action. You only need to save actions that drastically change the environment or position/face of the turtles . Digging air for example doesn't necessarily effect it but placing an item from inventory over a block can depend on how your program handle it (if it doesn't dig it - nothing happens).

(part 2)
Recovering with a state machine will work provided you can save your state reliably but unfortunately in Computercraft it's not always the case especially if using the file system to save variable because on servers the turtle inventory and position are usually asynchronous to the turtle file saves (instant) which makes figuring out the state you are in a gamble.

There are a few solution for this one of them is use the inventory to keep track of the state - because you have a certain amount of blocks at the beginning of the program you can figure out i and j according to the number blocks you started up with . after that you will also need to identify what state you are in and where are you facing.

Because of the inherent problems of saving states this can make identifying the state you are in even more complicated than turning your whole build function into a state machine. this makes it a better idea to keep the turtle in a predictable spot at all times.

You can let the user identify the state of the turtle or bring it to some predictable location but automatic restart can be a real gamble.
Keridos #72
Posted 03 July 2013 - 05:42 PM
Recovering with a state machine will work provided you can save your state reliably but unfortunately in Computercraft it's not always the case especially if using the file system to save variable because on servers the turtle inventory and position are usually asynchronous to the turtle file saves (instant) which makes figuring out the state you are in a gamble.

There are a few solution for this one of them is use the inventory to keep track of the state - because you have a certain amount of blocks at the beginning of the program you can figure out i and j according to the number blocks you started up with . after that you will also need to identify what state you are in and where are you facing.

Because of the inherent problems of saving states this can make identifying the state you are in even more complicated than turning your whole build function into a state machine. this makes it a better idea to keep the turtle in a predictable spot at all times.

You can let the user identify the state of the turtle or bring it to some predictable location but automatic restart can be a real gamble.

This is why me and happydude kind of decided that we need gps functionality for the persistency of the whole program (the versatile shape-builder) since the save file really often is not synchronized to the current position/facing of the turtle. The problem lies in the fact that you managed to describe very accurately, saving instant but the movement actually takes time. Basically you will end up with an invalid save file almost all of the time. In our code, since our buildscripts all are all kind of hardcoded we can retrieve all information needed to return by using a simple function to get coordinates and facing -> and using that to correct the position of our turtle and then start executing the functions again. But that makes us limited to a certain design of functions, making some thing pretty hard to implement (like inverted building or improving build routines or optimizing them.

/edit: Made our programs resume function work in most cases now. Basically I assume that the turtle gets stuck while moving or turning around. So I just save the progress before I actually move and return the building process after reaching the saved state. That actually worked pretty good so far.
Sangar #73
Posted 21 July 2013 - 05:04 AM
Regarding the persistent position issue, shameless self-plug: I wrote an API that should properly take care of keeping track of a turtle's position. It exploits the fact that you can check whether the turtle moved after a forced reboot by comparing the current fuel level to the one before the last move command was issued: if it's one less, the turtle moved, if it's equal it did not. This obviously only works when the turtles use fuel. I'd be curious to see how it holds up in more complex projects such as this one :)/>
Geforce Fan #74
Posted 22 July 2013 - 05:26 PM
Upload it to pastebin! That way we can use it on SMP without having to upload ourselves.
Keridos #75
Posted 23 July 2013 - 06:09 AM
Regarding the persistent position issue, shameless self-plug: I wrote an API that should properly take care of keeping track of a turtle's position. It exploits the fact that you can check whether the turtle moved after a forced reboot by comparing the current fuel level to the one before the last move command was issued: if it's one less, the turtle moved, if it's equal it did not. This obviously only works when the turtles use fuel. I'd be curious to see how it holds up in more complex projects such as this one :)/>

You might want to check out the shape builder from here: http://www.computercraft.info/forums2/index.php?/topic/11520-the-versatile-shape-builder-updatedactive/
We have a pretty good resume functionality even without gps. WE keep track of the blocks used and the moves done in a safe file. If the turtle restarts during that it is assumed that it has moved at the point of the restart (which is the case really often) and it continues to build correctly in most cases. For perfect resumability you need to have GPS though.
Sangar #76
Posted 23 July 2013 - 09:33 AM
Ah, I see. When placing blocks that's a pretty robust way to keep track of movement for sure.
Geforce Fan #77
Posted 23 July 2013 - 11:28 PM
Hey, could you add the option to made domes pre-filled with dirt or something? For like, underwater support. Maybe not remove the dirt because that's pretty easy but hard to do with a turtle, but at least place it. Maybe have like 8 slots (1-8) have glass, and 8-16 have dirt to make sure it doesn't fill it with glass, lol. It's too hard to fill, let's say 16 radius domes with dirt
Also, you need to add "refuel" at the thing where it stops b/c it can't move so if it's stopping b/c there's no more fuel you can refuel it.
sha263 #78
Posted 02 August 2013 - 07:08 AM
Hi iv got this and it keeps saying it cant move and to press enter but there is no blocks around it
Acuena #79
Posted 21 August 2013 - 02:08 PM
Found a bug.

I am making a sphere radius 20 and at the begining it worked well with the check if it has blocks in the selected slot. But now when it is on slot 9, it complains it don't have blocks even if slot 10 have blocks. It looks like it dont go to the next slot. Did a test when I had to refill the turtle, and it happened on slot 9.
gunther222 #80
Posted 24 August 2013 - 12:53 PM
I've made modified versions of this program to optionally clear blocks in the way of biulding, and also to get it's fill material from an enderchest.

My bases tend to be large 64x64 squares, and I used your code, with the above modifications to biuld a glass dome over the entire base.
I would have been clearing land and refilling the turtle with glass constantly if not for the added features.

Other than that, this is great peace of code. It makes really clean domes/spheres. Thanks!


Setting the two variables clear_blocks and ender_fill enable this behavior.

The ender chest linked to your fill material should go in slot 16.


http://pastebin.com/7wFqnhr3
zanskrila #81
Posted 04 September 2013 - 10:38 AM
It work's great, but sometimes it doesn't realise it's out of blocks i guess and keeps moving forward without placing anything. Other than that, Great script!
Andale #82
Posted 12 September 2013 - 10:29 PM
i've noticed mine also doesn't realize it is out of blocks
campicus #83
Posted 13 September 2013 - 03:37 AM
I replaced the placeBlock function with this:


local slot = 1
function placeBlock()
  -- Cost calculation mode - don't move
  blocks = blocks + 1
  if cost_only then
	return
  end

  repeat
	if turtle.getItemCount(slot) < 1 then
	  slot = slot + 1
	  if slot == 16 then
		turtle.select(16)
		turtle.placeUp()
		turtle.select(1)
		repeat
		  turtle.suckUp()
		  sleep(0)
		until turtle.getItemCount(15) > 0
		turtle.select(16)
		repeat
		  turtle.dropUp()
		  sleep(0)
		until turtle.getItemCount(16) == 0
		turtle.digUp()
		turtle.select(1)
		slot = 1
	  end
	  turtle.select(slot)
	end
  until turtle.getItemCount(slot) > 0

  turtle.placeDown()
end

I have not tetsted it yet, but if you put an enderchest in slot 16 (with building material in it) then it should stay full forever. You WILL need a mining turtle now though.

EDIT: Fixed typo, cheers Kreezxil :P/>
kreezxil #84
Posted 14 September 2013 - 09:24 AM
I replaced the placeBlock function with this:
Spoiler

local slot = 1
function placeBlock()
  -- Cost calculation mode - don't move
  blocks = blocks + 1
  if cost_only then
	return
  end

  repeat
	if turtle.getItemCount(slot) < 1 then
	  slot = slot + 1
	  if slot == 16 then
		turtle.select(16)
		turtle.palceUp() -- here's your typo!
		turtle.select(1)
		repeat
		  turtle.suckUp()
		  sleep(0)
		until turtle.getItemCount(15) > 0
		turtle.select(16)
		repeat
		  turtle.dropUp()
		  sleep(0)
		until turtle.getItemCount(16) == 0
		turtle.digUp()
		turtle.select(1)
		slot = 1
	  end
	  turtle.select(slot)
	end
  until turtle.getItemCount(slot) > 0

  turtle.placeDown()
end

I have not tetsted it yet, but if you put an enderchest in slot 16 (with building material in it) then it should stay full forever. You WILL need a mining turtle now though.

Dude! You have a typo, perhaps you should test before posting. Btw did you know you can use the pastebin command to push your code to the internet, it'll respond with a link that you can put into here. An even better way would be to use any of the pastebin replacements, my favorite is "market" from turtlescripts.com because it is better on the management side of things.
campicus #85
Posted 14 September 2013 - 11:47 AM
Thanks for finding that typo mate, I didn't have access to minecraft at the time and I just wanted to quickly help those who were having issues. Should definitely test before posting, my bad.

Had not heard of "market", I just use pastebin in conjunction with Smart Paste (which I changed so it replaces previously existing files). Quick and painless :)/>

Still have not tested that code… it's been a long few days lol
IMarvinTPA #86
Posted 15 March 2014 - 12:59 PM
The problem I'm having with this program is that a radius 4 dome does not make a 9 diameter dome as http://www.plotz.co.uk/ would make it. I'm concerned it does not make domes and spheres correctly.

Thanks,
IMarv
Keridos #87
Posted 16 March 2014 - 01:37 AM
Btw: prubys code is merged into the shape builder here: http://www.computercraft.info/forums2/index.php?/topic/11520-the-versatile-shape-builder-updated-260214-now-with-enderchest-refill-mode/

it even supports resuming and enderchest refilling and can build a variety of other shapes aswell. You might want to check that out…
FastPoke82 #88
Posted 31 March 2014 - 12:44 PM
When I run the program, it gives me the message "Blocked attempting to move up. Please clear and press enter to continue." I get this even when the turtle is floating in midair with nothing blocking it. Help?
Cranium #89
Posted 31 March 2014 - 02:23 PM
When I run the program, it gives me the message "Blocked attempting to move up. Please clear and press enter to continue." I get this even when the turtle is floating in midair with nothing blocking it. Help?
Make sure your turtle has fuel, or fuel is disabled in your config. That may be the reason it won't work.
kornichen #90
Posted 31 March 2014 - 03:20 PM
When I run the program, it gives me the message "Blocked attempting to move up. Please clear and press enter to continue." I get this even when the turtle is floating in midair with nothing blocking it. Help?
Make sure your turtle has fuel, or fuel is disabled in your config. That may be the reason it won't work.

I think it is a problem in the program because I tested it with the new ComputerCraft version 1.6 and the last version before 1.6 and both did not work. I took a look at the source code but even if I remove the part that stops the program, it won't work.
FastPoke82 #91
Posted 02 April 2014 - 12:00 AM
Hmm… can anyone recommend another sphere builder that will work? Or do we just have to wait for this to update?