Block Building Guide

What is a blockset?

Blocksets contain the building blocks of 3DML spots. A blockset file (*.bset) can contain blocks (*.block), textures (*.gif, *.jpg), sounds (*.wav), and a style file (*.style).

You can examine the contents of the blocksets on your machine. First, browse to the folder where your blocksets are kept; this is usually C:\\Program Files\Flatland\Flatland. Then browse a folder like \blocksets.flatland.com\flatsets. In this folder there should be at least one blockset, like basic.bset. Copy this file to a convenient place. Change the extension of the copied file from .bset to .zip, and unzip the folder using whatever archive extraction utility you use (i.e., WinZip, Stuffit, etc.). You can now look at the blocks, textures, and sounds that were in the blockset.

What tools are recommended for building blocks?

Currently, there is no modelling program that natively creates blocks. Blocks can be created by exporting from a 3D modelling program to a RayDream Studio mesh format (.rds) and converting them, or by hand-coding them. This tutorial assumes the use of the following tools.

Metasequoia by Mizno Lab. Easy-to-use 3D modeling tool that can export to RayDream mesh format (*.rds). Unless you live in Japan, download MetasequoiaLE, the freeware version.
[download MetasequoiaLE]

Block-IT! by Simon Bailey (AKA Morpheus) at Inside Track. RayDream mesh format (*.rds) to block format (*.block) conversion utility. Essential, if you plan on the Metasequoia -> Block-IT! -> EditBset or RayDream Studio -> Block-IT! -> EditBset method of block building.
[form to download]

Block2MetaS by Mike Jost (AKA MJ). Block format to MetaS format conversion utility.
[download Block2MetaS]

EditBset by Flatland. The blockset editor, a must-have for any blockset editing.
[download EditBset]

DXF2Block by Flatland. A DXF format (*.dxf) to block format (*.block) conversion utility. If you've have models in the right proprietary DXF format, it could be useful. No instructions provided here for its use.
[download DXF2Block]

Photoshop by Adobe. Great for creating and editing textures, but expensive.

The Gimp. Free, open-source alternative to Photoshop.

GoldWave by GoldWave, Inc. An excellent shareware sound-editing utility.

WinZip, 7-Zip or another archiving and extracting utility, for opening blocksets and batch file insertions.

Notepad, or any other non-formatting text-editor. For hand-coding and examining blocks.

Building Blocks Methods

The Hand-Coded Method

It is possible to hand-code your own blocks, since blocks are simply XML files describing the vertices and polygons that make up your block. To hand-code blocks, you must understand the block syntax. See 3DML Tag Guide: General Rules About 3DML Tags.

The <block> tag

Like the <spot> tag, the <block> tag begins and ends the block.

Like in 3DML, the code is organized in some basic container tags. The whole block is enclosed by the <block> ... </block> tag. The <block> tag has (at least) two parameters: name and type. Name defines the name for the block and should be equal to the blockfile name. Type should be set to "structural", this is the setting for common building blocks.

The <vertices> and <vertex> tags

In the <vertices> tag, you will have to define the 'edges' of your block, those points in the block space that define the ends of your polygon's sides.

The <parts> and <part> tags

In the <parts> tag, you define the parts of your block with the polygons that form them.

Tip: If you plan to edit your own block basing on one of Flatland's blocks, be sure to delete all <front> and <rear> tags as well as the line saying <bsp_tree root="1"/>. These are information for the binary tree, which you can hardly code by hand. They will be generated automatically, as soon as you load your block into EditBset and click on the "Add BSP tree" button.

The <polygon> tag

NOT COMING ANY TIME SOON!

Actually, this used to say "Coming Soon". But I think the statute of limitations has run out on this one. So if you've gotten this far, I imagine you can puzzle out the rest!

The other tags

If you open up a blockset and look at block file, you might notice a few tags and parameters that you didn't put in your hand-coded block: the <bsp_tree> tag, the texcoords parameter, the front and rear parameters.

Also, if you wish to document your block code, you can add comments just like in your spots:

	<!-- your comments here -->
	

Defining the vertices

The first thing to do, is to define all the vertices of your block. You should draw your block on a piece of paper and calculate x, y, and z values for each point. Rover uses a left-handed coordinate system, with (0,0,0) in the bottom south-west corner of the block. Positive x is eastward, positive y is upward, positive z is northward.

Now for each point, add a <vertex ref="n" coords="(x,y,z)" /> tag to the vertices container, where "n" is a counting number starting with 1 and x,y,z are the above calculated coordinates. For efficiency's sake, vertices that are shared by polygons should only be defined once. You should also note the vertex's number (n) on your paper drawing. This will make things easier later.

Note: there's no rule, what vertex has to be defined first or last. Just make sure, that you have no double ref numbers and you don't define the same vertex twice.

Defining the polygons and parts

Next you'll have to define the polygons (surfaces) of your block. However, since polygons have to be nested in parts, add a <part> ... </part> container tag inside the <parts> tag.

The <part> tag here has the same attributes as the <part> tag in 3DML, so you can add everything from texture, color, faces to solid to the tag as default values for the part. One thing you have to add is the name attribute of course!

Now, inside the <part> tag, add a <polygon ref="n" vertices="v,v,v..." texcoords="..." /> tag. The ref attribute "n" is again a counting number for all polygons in the block. Don't use the same number twice! In the vertices attribute, list the associated vertices that form the polygon in clockwise order around the front face.

Note: there's no rule, what polygon has to be defined first or last. Just make sure, that you have no double ref numbers and you don't define the same polygon twice.

The texcoords define which corner of a texture will be attached to a given vertex. You just have to define a list of special parenthesis values corresponding to the vertices listed before. Set (0,0) for the top-left corner, (1,0) for the top-right corner, (1,1) for the bottom-right corner and (0,1) for the bottom-left corner. If your polygon has only 3 vertices, you'll have to decide, which of the four corners can be left out.

But wait, there's help! You don't necessarily have to define the texcoords at all. EditBset will generate all the texcoords automatically when loading the block. However EditBset isn't perfect, so it makes its best guess as to which vertex should get (0,0) so that the top edge of the texture is pointing up (or in the case of polygons that face up or down, so that the top edge of the texture is pointing north).

I would recommend that for triangles you put in the texture coordinates yourself, since EditBset may not make the correct choice. But it should figure out quads (squares, rectangles etc.) okay. Polygons with 5+ sides don't support the "stretched" texture style; EditBset will generate texture coordinates for a "scaled" texture style in that case.

Example: The Full Block

<block name="full" type="structural">
	<vertices>
		<vertex ref="1" coords="(   0.00000, 256.00000,   0.00000)"/>
		<vertex ref="2" coords="(   0.00000, 256.00000, 256.00000)"/>
		<vertex ref="3" coords="( 256.00000, 256.00000, 256.00000)"/>
		<vertex ref="4" coords="( 256.00000, 256.00000,   0.00000)"/>
		<vertex ref="5" coords="(   0.00000,   0.00000,   0.00000)"/>
		<vertex ref="6" coords="( 256.00000,   0.00000,   0.00000)"/>
		<vertex ref="7" coords="( 256.00000,   0.00000, 256.00000)"/>
		<vertex ref="8" coords="(   0.00000,   0.00000, 256.00000)"/>
	</vertices>
	<parts>
		<part name="top" texture="cement.gif">
			<polygon ref="1" vertices="1,2,3,4"/>
		</part>
		<part name="bottom" texture="cement.gif">
			<polygon ref="2" vertices="5,6,7,8"/>
		</part>
		<part name="s" texture="cement.gif">
			<polygon ref="3" vertices="1,4,6,5"/>
		</part>
		<part name="w" texture="cement.gif">
			<polygon ref="4" vertices="5,8,2,1"/>
		</part>
		<part name="n" texture="cement.gif">
			<polygon ref="5" vertices="8,7,3,2"/>
		</part>
		<part name="e" texture="cement.gif">
			<polygon ref="6" vertices="4,3,7,6"/>
		</part>
	</parts>
</block>
	

When you have finished coding your block, you will need to import it into EditBset.

The MetaSequoia to Block-Ed to EditBset Method

MetaSequoia

For modeling, I use MetaSequoia. It's easy to use, and lacks the frills of most modeling programs that would just get in the way of simple block-building.

I find that setting the View > Grid > Interval to 32 or 64 and the Mesh size to 256 makes it easy to judge the size of your model relative to the 256 x 256 x 256 block size.

Converting the Model

Convert MetaSequoia models to blocks using the following procedure:

  1. Open your MetaS. model (*.mqo) file in MetaSLE.
  2. Select Edit > select all.
  3. Select Selected > Invert.
  4. Select File > Save As....
  5. Select Save as type: RayDream Studio (*.rds) and give your file a name.
  6. Set Size : Multiply to 1.
  7. Click Axis : Swap XY.
  8. Click Axis : Swap YZ.
  9. Click OK.
  10. Open the Block-IT! program.
  11. Find and select your .rds file in the Source -RDS(.rds) folder tree.
  12. Give your block a name, and a default texture.
  13. Select a destination folder from the Desination - Flatland Rover (.block) folder tree.
  14. Click Convert.

From there, use EditBset to add the .block file to your blockset.

Using EditBset

With EditBset, you can open any blocksets, edit all blockset parameters like version, placeholder, sky, ground and orb settings. You can also create new blocksets, load textures and sounds into it. And last but not least, you can even load your very own block definition files (*.block) into the blockset and let EditBset calculate those nasty BSP trees!

Hosting your Blocksets

If you want others to be able to download your blockset, you need to upload your blockset to your server.

Your blockset will be cached by Rover in the same way as the Flatland blocksets. Once downloaded, you will find it in the Flatland folder on your hard drive in a folder named after your server's domain name. So, if your blockset is hosted on:

	http://www.yourserver.com/yourdirectory/blocksets
	

then the blockset will be downloaded to:

	C:\\Program Files\Flatland\Flatland\www.yourserver.com\yourdirectory\blocksets
	

Managing Blocksets

Rover has a built-in blockset manager. When you load a spot, click the Controls icon and select Manage blocksets on my hard drive. You can view and delete blocksets, force a blockset to reload, and set the interval that Rover waits before checking for blockset updates.


last updated Thursday December 08 2005