 








|
 This is Part II of my summary of the ongoing discussion of Flatland's beta
tester group regarding the now given possibility of making your own blocksets for Rover.
Part I covered information about what you can do with EditBset and how it should be used
in a sensible way.
Now, I will give a short overview of the tag language used to code blocks.
1. A first look at blocks
An easy way to explore the way blocks are coded, is to take a look into one of Flatland's
blocksets. Make a copy of basic.bset, then rename the copy to basic.zip.
Unzip the file and choose a .block-file in the blocks subfolder. Load it
into your editor (TextPad for example).
2. Basic container tags
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 (who thought) 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.
Nested inside the BLOCK tag, you'll find two container tags:
<VERTICES>...</VERTICES> and <PARTS>...</PARTS>.
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. Hmm, well, I think
you got the point...
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.
3. 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.
4. 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 god, so it makes it's 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. |