Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Spheres  (Read 4827 times)

Bluesproto

  • Bay Watcher
  • Legendary Anti Hero
    • View Profile
    • My game, a Medieval RPG. Sort of.
Spheres
« on: December 09, 2011, 01:42:10 pm »

Well, i've tried a lot of times, and the wiki doesn't tell how. Everytime i've tried, it has ended bad... So, i wanted to know if you could help me. Have you ever built one? I wanted to build (or dig) one for the meeting hall in my current fort, but I simply can't manage to do it.
Logged
Dear Urist: I, the overseer, appreciate your point of view about the danger that an unarmed goblin can represent at the other side of a fortification when you try to kill it with a ballista, but, as you know, you're not paid to think. And a mindless worker is a happy worker, so shut up and do your job.

You are a Hero, an fantasy adventure with dragons, mages, ninjas and Norse mythology

WolfeyS

  • Bay Watcher
  • My wife just died. Oh, damn nice door that one is.
    • View Profile
Re: Spheres
« Reply #1 on: December 09, 2011, 01:51:36 pm »

A sphere?  In a square world? wat
Logged
My Steam Account

You just know you're screwed when a dwarf dies of old age.

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: Spheres
« Reply #2 on: December 09, 2011, 02:05:23 pm »

Once I wrote an awesome program in Perl that could give you design sheets for any kind of body, solid or hollow, that you could express as a function of coordinates to solidity, floorness, smoothness (ramps Y/N) and color. Shortly after, I broke my Linux version too hard and had to quickly reinstall Linux without backing up the data, because I went somewhere without an external backup drive and had to use my computer a lot there.

I could write another such program, if you like.
Just tell me your OS and preferred programming language.
Logged

WolfeyS

  • Bay Watcher
  • My wife just died. Oh, damn nice door that one is.
    • View Profile
Re: Spheres
« Reply #3 on: December 09, 2011, 02:09:26 pm »

If he means sphere as in a very pixilated sphere, then it would just take a bit of time with the d>d.

Otherwise...
Logged
My Steam Account

You just know you're screwed when a dwarf dies of old age.

Tharwen

  • Bay Watcher
    • View Profile
Re: Spheres
« Reply #4 on: December 09, 2011, 02:12:47 pm »

1. Draw a low resolution circle in paint which has the same diameter in pixels as the sphere has in blocks.
2. Build a circle in DF which is this shape (you might need to add some more blocks to the inside if you don't want things getting in through the diagonals)
3. Imagine a 1-pixel line is drawn straight down the centre of the first circle (or centre +1 if the circle's diameter is even). Move this line 1 pixel to the right, and count the number of pixels it covers inside the circle.
4. Draw another circle with this diameter and build it in DF.
5. GOTO 3.
Logged
[Signature]

DS

  • Bay Watcher
  • DS cancels Attend Party: no floor space.
    • View Profile
Re: Spheres
« Reply #5 on: December 09, 2011, 02:35:49 pm »

The hard way:

First, take the radius of the sphere you want. Then, for each z-level, use the Pythagorean theorem to determine the radius of the circle that forms the cross-section of each z-level of the sphere. Visualize the sphere from the side, and form a right triangle with one point at the center of the circle, one point at the edge of the circle - the triangle's hypotenuse is the radius of the circle. The other two sides are parallel to the horizontal and vertical axes. It would be easier if I had a picture. The equation:

Z^2 = X^2 + Y^2, where Z is the radius of the sphere, and one of the other variables is the z-level you are digging out and the other is the radius of the circle you are digging out on that z-level. Converted:

The radius of the circular cross-section = sqrt((spherical radius)^2 - (z-level)^2)

Bear in mind that all variables are in relation to the center point of the sphere, not the absolute z-level.

This will give you the radius of cross-sections. At this point, you can use a utility to draw various circles (link, anyone?), or you can do what I did and use the pythagorean theorem again to determine the outline of each circle with extreme accuracy (when you get close to the equator, minute changes between layers are easy to miss). Simply using the outline of a circle to determine the outline of a sphere will not be as accurate as this method.

This is the method I used to dig out Weatherwires' dome, but I'm sure there are far easier methods.
Logged
Finished: Weatherwires, the Last Mountainhome. A tragic mix of Children of Men, City of Ember, and, uh, magma.
Stymied: Correspondence from Syrupurns, a prematurely ended narrative, told through annual updates.
In Progress: Roomcarnage, a fortress clinging to life beneath a haunted glacier.

daggaz

  • Bay Watcher
    • View Profile
Re: Spheres
« Reply #6 on: December 09, 2011, 02:37:53 pm »

A sphere?  In a square world? wat

Google minecraft sphere designs.  Or minecraft circle plans.  Easy peasy and there you go.
Logged

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: Spheres
« Reply #7 on: December 09, 2011, 02:43:17 pm »

1. Draw a low resolution circle in paint which has the same diameter in pixels as the sphere has in blocks.
2. Build a circle in DF which is this shape (you might need to add some more blocks to the inside if you don't want things getting in through the diagonals)
3. Imagine a 1-pixel line is drawn straight down the centre of the first circle (or centre +1 if the circle's diameter is even). Move this line 1 pixel to the right, and count the number of pixels it covers inside the circle.
4. Draw another circle with this diameter and build it in DF.
5. GOTO 3.
Nah, that has great potential to look stupid, because the edges are not smooth and there are abrupt breaks between some z-levels, because you use a low-resolution circle.
Better idea: you draw the first circle on graph paper to remove the breaks.
Or you use my program.
Spoiler: BEHOLD (click to show/hide)
Logged

Vharuck

  • Bay Watcher
    • View Profile
Re: Spheres
« Reply #8 on: December 09, 2011, 03:08:13 pm »

I use this website, which I grabbed from a thread here (I think):
http://www.plotz.co.uk/plotz.php
Logged

Bluesproto

  • Bay Watcher
  • Legendary Anti Hero
    • View Profile
    • My game, a Medieval RPG. Sort of.
Re: Spheres
« Reply #9 on: December 09, 2011, 04:09:15 pm »

1. Draw a low resolution circle in paint which has the same diameter in pixels as the sphere has in blocks.
2. Build a circle in DF which is this shape (you might need to add some more blocks to the inside if you don't want things getting in through the diagonals)
3. Imagine a 1-pixel line is drawn straight down the centre of the first circle (or centre +1 if the circle's diameter is even). Move this line 1 pixel to the right, and count the number of pixels it covers inside the circle.
4. Draw another circle with this diameter and build it in DF.
5. GOTO 3.
Nah, that has great potential to look stupid, because the edges are not smooth and there are abrupt breaks between some z-levels, because you use a low-resolution circle.
Better idea: you draw the first circle on graph paper to remove the breaks.
Or you use my program.
Spoiler: BEHOLD (click to show/hide)

That is more or less what i meant
Logged
Dear Urist: I, the overseer, appreciate your point of view about the danger that an unarmed goblin can represent at the other side of a fortification when you try to kill it with a ballista, but, as you know, you're not paid to think. And a mindless worker is a happy worker, so shut up and do your job.

You are a Hero, an fantasy adventure with dragons, mages, ninjas and Norse mythology

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: Spheres
« Reply #10 on: December 09, 2011, 05:02:55 pm »

What's your OS then?
Logged

Tharwen

  • Bay Watcher
    • View Profile
Re: Spheres
« Reply #11 on: December 09, 2011, 07:25:53 pm »

1. Draw a low resolution circle in paint which has the same diameter in pixels as the sphere has in blocks.
2. Build a circle in DF which is this shape (you might need to add some more blocks to the inside if you don't want things getting in through the diagonals)
3. Imagine a 1-pixel line is drawn straight down the centre of the first circle (or centre +1 if the circle's diameter is even). Move this line 1 pixel to the right, and count the number of pixels it covers inside the circle.
4. Draw another circle with this diameter and build it in DF.
5. GOTO 3.
Nah, that has great potential to look stupid, because the edges are not smooth and there are abrupt breaks between some z-levels, because you use a low-resolution circle.
Better idea: you draw the first circle on graph paper to remove the breaks.
Or you use my program.
Spoiler: BEHOLD (click to show/hide)

You're using low-resolution circles too!

You just have a better way of generating them with the program...
Logged
[Signature]

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: Spheres
« Reply #12 on: December 09, 2011, 07:50:15 pm »

No, that's not what I meant.
If your first circle is pixelated, then with your pixel-counting method, you'll first get some circles of exactly the original radius, then some of the original radius - 1, and so on.
To generate a smooth transition, you need non-integer radii, therefore a perfect first circle.
If you would use your algorithm with the base of my dome as the first circle, then the bottom 7 z-levels would look identical. Now look at my first 7 z-levels. They only vary ever so slightly (look at the differences between second and third z-level), but they create a much better overall effect.
Logged

Bluesproto

  • Bay Watcher
  • Legendary Anti Hero
    • View Profile
    • My game, a Medieval RPG. Sort of.
Re: Spheres
« Reply #13 on: December 10, 2011, 04:26:21 am »

Windows 7, but i'm not very good with any programming language...
Logged
Dear Urist: I, the overseer, appreciate your point of view about the danger that an unarmed goblin can represent at the other side of a fortification when you try to kill it with a ballista, but, as you know, you're not paid to think. And a mindless worker is a happy worker, so shut up and do your job.

You are a Hero, an fantasy adventure with dragons, mages, ninjas and Norse mythology

Tharwen

  • Bay Watcher
    • View Profile
Re: Spheres
« Reply #14 on: December 10, 2011, 07:57:18 am »

No, that's not what I meant.
If your first circle is pixelated, then with your pixel-counting method, you'll first get some circles of exactly the original radius, then some of the original radius - 1, and so on.
To generate a smooth transition, you need non-integer radii, therefore a perfect first circle.
If you would use your algorithm with the base of my dome as the first circle, then the bottom 7 z-levels would look identical. Now look at my first 7 z-levels. They only vary ever so slightly (look at the differences between second and third z-level), but they create a much better overall effect.

Oh, OK. Does your program do the ramps as well?
Logged
[Signature]
Pages: [1] 2