0

Updated "Size of a chunk" section of design docs

This commit is contained in:
Andrew Brown
2012-02-19 16:34:49 -05:00
parent 4c21fb2e05
commit 1d2f908cb6
6 changed files with 3207 additions and 4337 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 83 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -14,8 +14,8 @@
id="svg2" id="svg2"
version="1.1" version="1.1"
inkscape:version="0.48.1 r9760" inkscape:version="0.48.1 r9760"
sodipodi:docname="cube_stack128.svg" sodipodi:docname="cube_stack16.svg"
inkscape:export-filename="/home/andrew/mc/overviewer/docs/design/cuberenderimgs/cube_stack128.png" inkscape:export-filename="/home/andrew/mc/overviewer/anvil/docs/design/cuberenderimgs/cube_stack16.png"
inkscape:export-xdpi="90.016075" inkscape:export-xdpi="90.016075"
inkscape:export-ydpi="90.016075"> inkscape:export-ydpi="90.016075">
<defs <defs
@@ -27,18 +27,18 @@
borderopacity="1.0" borderopacity="1.0"
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="1.4142136" inkscape:zoom="2.0000001"
inkscape:cx="194.46598" inkscape:cx="188.74041"
inkscape:cy="191.56651" inkscape:cy="142.85522"
inkscape:document-units="px" inkscape:document-units="px"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
showgrid="true" showgrid="true"
showguides="true" showguides="true"
inkscape:snap-global="true" inkscape:snap-global="true"
inkscape:window-width="1920" inkscape:window-width="1920"
inkscape:window-height="1003" inkscape:window-height="1031"
inkscape:window-x="0" inkscape:window-x="0"
inkscape:window-y="25" inkscape:window-y="0"
inkscape:window-maximized="1" inkscape:window-maximized="1"
fit-margin-top="0" fit-margin-top="0"
fit-margin-left="0" fit-margin-left="0"
@@ -294,197 +294,142 @@
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono" style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-57.055267" x="145.19473"
y="244.48524" y="473.9852"
id="text3228"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3230"
x="-57.055267"
y="244.48524">Y Offset</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m -58.80527,249.23523 80,0"
id="path3232"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-27.411713"
y="294.48523"
id="text3234"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3236"
x="-27.411713"
y="294.48523">0</tspan></text>
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-33.881439"
y="339.48523"
id="text3238"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3240"
x="-33.881439"
y="339.48523">12</tspan></text>
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-33.954681"
y="404.48523"
id="text3242"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3244"
x="-33.954681"
y="404.48523">24</tspan></text>
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-142.30527"
y="244.48524"
id="text3246"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3248"
x="-142.30527"
y="244.48524">Block #</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m -143.80527,249.23523 80,0"
id="path3232-6"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-99.0914"
y="294.48523"
id="text3234-6"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3236-0"
x="-99.0914"
y="294.48523">0</tspan></text>
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-99.272057"
y="339.48523"
id="text3289"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3291"
x="-99.272057"
y="339.48523">1</tspan></text>
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-98.827728"
y="399.48523"
id="text3293"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3295"
x="-98.827728"
y="399.48523">2</tspan></text>
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-112.0748"
y="664.48523"
id="text3297"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3299"
x="-112.0748"
y="664.48523">127</tspan></text>
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-112.29941"
y="618.48523"
id="text3301"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3303"
x="-112.29941"
y="618.48523">126</tspan></text>
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-112.05527"
y="564.48523"
id="text3305"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3307"
x="-112.05527"
y="564.48523">125</tspan></text>
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-46.952728"
y="564.48523"
id="text3309"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3311"
x="-46.952728"
y="564.48523">1500</tspan></text>
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-46.615807"
y="618.48523"
id="text3313"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3315"
x="-46.615807"
y="618.48523">1512</tspan></text>
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-47.055267"
y="664.48523"
id="text3317"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3319"
x="-47.055267"
y="664.48523">1524</tspan></text>
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="152.142"
y="483.9852"
id="text3321" id="text3321"
sodipodi:linespacing="125%"><tspan sodipodi:linespacing="125%"><tspan
sodipodi:role="line" sodipodi:role="line"
id="tspan3323" id="tspan3323"
x="152.142" x="145.19473"
y="483.9852">12*128=1536</tspan></text> y="473.9852">12*16</tspan><tspan
sodipodi:role="line"
x="145.19473"
y="498.9852"
id="tspan3342">=192</tspan></text>
<path <path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" style="fill:none;stroke:#000000;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 172.142,454.98522 0,-191.00001" d="m 170.19473,454.9852 0,-216"
id="path3325" id="path3325"
inkscape:connector-curvature="0" /> inkscape:connector-curvature="0" />
<path <path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" style="fill:none;stroke:#000000;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 172.142,494.9852 0,192" d="m 170.19473,503.98521 0,209.99997"
id="path3327" id="path3327"
inkscape:connector-curvature="0" /> inkscape:connector-curvature="0" />
<path <path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 162.142,263.98521 20,0" d="m 160.19473,263.98521 20,0"
id="path3329" id="path3329"
inkscape:connector-curvature="0" /> inkscape:connector-curvature="0" />
<path <path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 162.142,686.98521 20,0" d="m 160.19473,685.98522 20,0"
id="path3331" id="path3331"
inkscape:connector-curvature="0" /> inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 15.19473,363.9852 0,-100.00001"
id="path3325-7"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 5.19473,263.98521 20,0"
id="path3329-6"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-14.80527"
y="293.9852"
id="text3203"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3205"
x="-14.80527"
y="293.9852">12</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 5.19473,313.98521 20,0"
id="path3329-6-0"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="-14.805266"
y="343.9852"
id="text3203-0"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3205-3"
x="-14.805266"
y="343.9852">12</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 5.1947303,363.98522 19.9999997,0"
id="path3329-6-0-9"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 160.19473,238.98523 20,0"
id="path3329-6-1"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="180.19473"
y="258.9852"
id="text3203-4"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3205-4"
x="180.19473"
y="258.9852">6</tspan></text>
<text
xml:space="preserve"
style="font-size:18px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="180.19473"
y="703.98523"
id="text3203-4-3"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3205-4-1"
x="180.19473"
y="703.98523">6</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 160.19473,713.98521 20,0"
id="path3331-2"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 240.19473,493.98522 0,220"
id="path3327-2"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 230.19473,713.98522 20,0"
id="path3331-6"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 240.19473,463.98521 0,-226"
id="path3325-1"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 230.19473,237.98524 20,0"
id="path3329-6-1-7"
inkscape:connector-curvature="0" />
<text
xml:space="preserve"
style="font-size:20px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Andale Mono"
x="225.19473"
y="483.9852"
id="text3321-4"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="225.19473"
y="483.9852"
id="tspan3342-9">204</tspan></text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -307,52 +307,40 @@ directions of the offsets are changed, but the amounts are the same.
The size of a chunk The size of a chunk
------------------- -------------------
Now that we know how to place blocks relative to each other, we can begin to Now that we know how to place blocks relative to each other, we can begin to
construct a chunk section. construct an entire chunk section.
Since the block sprites are 24 by 24 pixels, and the diagonal of the 16 by 16 Since the block sprites are 24 by 24 pixels, and the diagonal of the 16 by 16
grid is 16 squares, the width of one rendered chunk will be 384 pixels. Just grid is 16 squares, the width of one rendered chunk section will be 384 pixels.
considering the top layer of the blocks: Just considering the top layer of blocks within a section:
.. image:: cuberenderimgs/chunk_width.png .. image:: cuberenderimgs/chunk_width.png
:alt: Illustrating the width of a single chunk :alt: Illustrating the width of a single chunk
Since cubes next to each other in the same "diagonal row" are offset by 24 Since blocks next to each other in the same "diagonal row" are offset by 24
pixels, this is trivially calculated. pixels, this is trivially calculated.
The height is a bit more tricky to calculate. Let's start by calculating the The height is a bit more tricky to calculate. Let's start by calculating the
height of a single stack of 128 cubes. height of a single stack of 16 blocks.
If the top of a stack of cubes is at Y value 0, the 128th cube down must be The non-overlapping edge of each block sprite is 12 pixels high. Since there are
drawn (128-1)*12=1524 pixels below. However, that's not the end of the story. 16 blocks in this stack, that's 192 pixels high. There are also 6 additional
The bottom cube has a height of 24 pixels, so the height of a rendered stack of pixels at the top and bottom of the stack as shown, giving a total height of 204
128 cube is 1548 pixels. pixels.
.. image:: cuberenderimgs/cube_stack128.png .. image:: cuberenderimgs/cube_stack16.png
:alt: A stack of 128 cubes takes 1560 vertical pixels to draw. :alt: A stack of 16 cubes takes 204 vertical pixels to draw.
You can also calculate this by looking at the sides of the cubes, which don't But that's just for one column of blocks. What about the entire chunk section?
overlap at all. They are 12 pixels each, times 128 cubes in the stack, gives Take a look at this diagram:
1536 pixels. Add in the 6 pixels for the top cube and the 6 pixels for the
bottom cube to get the total height of 1548 pixels.
So what about the entire chunk? Let's take a look at the top and bottom few
layers of a chunk.
.. image:: cuberenderimgs/chunk_height.png .. image:: cuberenderimgs/chunk_height.png
:alt: The highest and lowest positioned cubes in a chunk :alt: The highest and lowest positioned cubes in a chunk
Let's let the red cubes represent the stack from above. The one on the top we'll The green highlighted blocks are the stack we calculated just above and have a
define as position 0, with our vertical axis running positively downward (as is height of 204 pixels. The red highlighted blocks each take 12 pixels of vertical
the case in a lot of imaging library coordinate systems) Therefore, the bottom space on the image, and there are 15 of them. So 204 + 12*15 is 384 pixels.
red cube is at vertical offset 1524 below.
The green cube at the bottom most tip is the cube with the lowest vertical So the total size of a chunk section in pixels is 384 wide by 384 tall.
placement on the image, so its offset plus 24 pixels for its height will be the
chunk height. Since the green cubes each have an offset of 12 pixels, add 15*12
pixels to get the offset of the lowest green cube: 1704.
So the total size of a chunk in pixels is 384 wide by 1728 tall. That's pretty
tall!
Assembling a Chunk Assembling a Chunk
------------------ ------------------