Jump to content




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

turtle utility

143 replies to this topic

#121 IMarvinTPA

  • Members
  • 8 posts

Posted 16 March 2014 - 03:41 PM

View PostKeridos, on 16 March 2014 - 12:47 PM, said:

View PostIMarvinTPA, on 16 March 2014 - 03:47 AM, said:

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 by IMarvinTPA, 16 March 2014 - 05:30 PM.


#122 Keridos

  • Members
  • 75 posts

Posted 16 March 2014 - 09:58 PM

View PostIMarvinTPA, on 16 March 2014 - 03:41 PM, said:

View PostKeridos, on 16 March 2014 - 12:47 PM, said:

View PostIMarvinTPA, on 16 March 2014 - 03:47 AM, said:

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.

#123 IMarvinTPA

  • Members
  • 8 posts

Posted 16 March 2014 - 11:58 PM

View PostKeridos, on 16 March 2014 - 09:58 PM, said:

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 by IMarvinTPA, 16 March 2014 - 11:58 PM.


#124 Keridos

  • Members
  • 75 posts

Posted 23 March 2014 - 03:16 PM

View PostIMarvinTPA, on 16 March 2014 - 11:58 PM, said:

View PostKeridos, on 16 March 2014 - 09:58 PM, said:

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 by Keridos, 23 March 2014 - 04:30 PM.


#125 Sakata

  • Members
  • 5 posts

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 by Sakata, 23 March 2014 - 05:28 PM.


#126 Keridos

  • Members
  • 75 posts

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.

#127 Sakata

  • Members
  • 5 posts

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 by Sakata, 23 March 2014 - 06:52 PM.


#128 Keridos

  • Members
  • 75 posts

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 by Keridos, 23 March 2014 - 09:34 PM.


#129 CupricWolf

  • Members
  • 86 posts
  • LocationColorado, USA

Posted 04 August 2014 - 01:04 AM

View PostSakata, on 23 March 2014 - 06:52 PM, said:

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.

View PostSakata, on 23 March 2014 - 05:24 PM, said:

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.

#130 CupricWolf

  • Members
  • 86 posts
  • LocationColorado, USA

Posted 04 August 2014 - 10: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 by CupricWolf, 04 August 2014 - 10:35 AM.


#131 Keridos

  • Members
  • 75 posts

Posted 05 August 2014 - 01:06 AM

Updated the main post and the main download link to the newest code to reflect CupricWolfs (old name was happydude) changes.

#132 CupricWolf

  • Members
  • 86 posts
  • LocationColorado, USA

Posted 07 August 2014 - 10: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 by CupricWolf, 20 August 2014 - 07:47 PM.


#133 Wooki_inthetrees

  • Members
  • 20 posts

Posted 22 August 2014 - 05:23 PM

may i recommend a circular platform instead of just a hollow circle?

#134 CupricWolf

  • Members
  • 86 posts
  • LocationColorado, USA

Posted 23 August 2014 - 08:22 PM

View PostWooki_inthetrees, on 22 August 2014 - 05:23 PM, said:

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!

#135 heimdall116

  • Members
  • 4 posts

Posted 27 August 2014 - 06: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 by heimdall116, 27 August 2014 - 06:53 PM.


#136 252-rer

  • Members
  • 4 posts

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.

#137 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

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.

#138 252-rer

  • Members
  • 4 posts

Posted 01 February 2015 - 03:38 AM

Ah that explains it, yeah im currently using 1.63.

#139 oxgon

  • Members
  • 22 posts

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?

#140 wakafanykai123

  • Members
  • 21 posts

Posted 25 February 2015 - 07:32 AM

View Postoxgon, on 01 February 2015 - 04:31 PM, said:

If this is not being worked on any more, does anyone know of a good shapes that is working?
This still works.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users