Flatland

Tutorial

3 | The < head > tag

The < head > tag contains several tags that apply to the entire spot.

The < debug > tag

< debug > is an optional tag you can use to get more information about errors in your spot. Rover is designed to ignore these errors as much as possible, and will display a spot as best it can when errors are present in the file. But if you include the< debug > tag, Rover will display error messages that will help you to locate and correct those errors. You will want to put the < debug > tag at the very beginning of the head section of your 3DML file, so that it will catch any errors in the head section as well. The best use of the < debug > tag is to include it while you are working on your 3DML files, and then to erase it before publishing your spot to the Web.

Add the following line of code just after your < head > tag:

< debug />

The < title > tag

The < title > tag holds the title of the spot. The title text will be displayed at the bottom of the browser window in Rover’s GUI.

< title name="title text" />

Put the following code between the < head > tags in your 3DML file:

< title name="First Spot" />

The < blockset > tag

< blockset href="url" />

The < blockset > tag lets Rover know what set of blocks and default textures to use to display the spot. The blockset is expressed as a URL. The first time a user encounters a new blockset, the blockset is downloaded and placed in the Flatland cache on the user’s hard drive, where it will remain indefinitely. The next time the user encounters the same blockset, Rover will check the cache first before attempting to download the new set.

Everything in a spot is made out of blocks. The < blockset > tag tells the browser what set of blocks to use to display the spot. Currently, Flatland hosts five blocksets: the basic set (contaning mostly simple block-like shapes), the basic 2 set (more simple shapes), the island set, the interior set (containing tables, chairs, etc.), and the village set (containing houses, sidewalks, trees, etc.). You can find details about the blocks in each block set on the Blocksets page.

Put the following code between the < head> tags in your 3DML file:

< blockset href="http://blocksets.flatland.com/flatsets/basic.bset" />

The < map > tag

< map style="single|double" dimensions="(columns,rows,levels)" />

The < map > tag has two attributes: dimensions and style. Dimensions tells Rover what size your spot is going to be. Spots are measured in blocks, (columns, rows, levels). When you are building spots, remember that whenever you change the dimensions of your spot by adding new levels, columns,or rows, you will have to change the dimensions in the < map> tag as well. We will discuss the style attribute later on in the More Blocks! section of the tutorial. For now, just use style=”single”.

We are going to make a spot that is 9 blocks wide, 9 blocks long, and 1 block high. Put the following code between the < head > tags in your 3DML file.

< map style="single" dimensions="(9,9,1)" />

The < sky > tag

< sky texture="image-file-path-or-URL" color="(red,green,blue)" brightness="brightness%" />

The < sky > tag sets an image to be used as the background for your spot. This texture will appear anywhere there aren’t any blocks visible. If you don’t put a ceiling on your spot, the texture defined in the < sky > tag will appear in the sky. If you leave any holes in your walls or floors, then the sky texture will be seen there. Also, if a user sets the maximum viewing distance of Rover to a number lower than the dimensions of your spot, the resulting holes in your spot will reveal the sky texture.

If you prefer, you can set a color for the sky rather than a texture. The color is expressed by red, green, and blue values between 0 to 255. For example, pure red would be expressed as color=”(255,0,0)”, pure blue is color=”(0,0,255)”, and pure green would be color=”(0,255,0)”. All other colors can be expressed as combinations of red, green, and blue. To find the RGB value for any color, you can use this nifty RGB Color Picker.

You can also set the brightness of the sky in the < sky > tag. Brightness is expressed as a whole number percentage. If you don’t specify brightness, the default level is 100%. If you leave out the < sky > tag altogether, the background will default to the sky texture specified in the blockset. For the Basic blockset, that texture is a partly cloudy blue sky.

Remember, if your image file isn’t in the same folder as your 3DML file, then you also need to specify the path to your image:

< sky texture= "folder/image.gif" />

Put the following code between the < head > tags in your 3DML file. The image “clouds.gif” should be in a folder called “images”, which is in the same folder as your 3DML file.

< sky texture="images/clouds.gif" brightness="90%" />

The < ground > tag

< ground texture="image-file-path-or-URL" color="(red,green,blue)" />

The < ground > tag specifies a texture (or color) to be used on the ground plane of your spot. If you use the < ground > tag, then you won’t have to supply a solid floor of blocks in your map. The ground will be the same dimensions as your map. If your map is 5 blocks by 8 blocks, then your ground will be that same size as well.

You can specify either a texture or a color with which to fill the ground plane. If you leave the < ground > tag out, there will be no ground plane displayed in your spot, and you will have to supply a solid floor made of blocks in order to keep your visitors from falling endlessly through virtual space. If you want to use the default ground texture specified by the Basic blockset, then simply include an empty < ground > tag in your 3DML file: < ground />. This will generally give you a dirt-colored floor.

Put the following line of code between the < head > tags in your 3DML file:

< ground texture="images/dirt.gif" />

The < ambient_light > tag

< ambient_light brightness="brightness%" color="(red,green,blue)" />

The < ambient_light > tag has two attributes: brightness and color. Brightness defines how bright your spot will appear to be in areas where you haven’t placed any other lights. Brightness is expressed as a whole number percentage. If you set your ambient light relatively low, say around 50%, then you will have more room to play with lighting effects later. If you don’t need that kind of flexibility, go ahead and set brightness at or close to 100%. The color attribute allows you to specify what color the light is in your spot, although colored light will only appear when Rover is being run on 3D acceleration hardware.

Brightness defaults to 100%, if not otherwise specified. Color defaults to white, or (255,255,255). Lighting will be covered in more detail in the Lighting section of the tutorial. For now, leave your ambient light at the default levels.

Put the following code between the < head > tags in your 3DML file:

< ambient_light brightness="100%" />

The < ambient_sound > tag

< ambient_sound file="wave-file-path-or-URL" VOLUME="volume%"
playback="looped|random" delay="minimum..maximum" />

The < ambient_sound > tag specifies a sound file that will play throughout your spot. The ambient sound will be heard at the same volume throughout the entire spot. The sound can either be looped continuously or played at random intervals with the playback attribute. If playback=”random”, you can also specify a range of delay times between playbacks. Delay times are measured in seconds, and are measured from the time that the sound begins, rather than when it ends. For example, if your sound is 5 seconds long, playback=”random”, and delay=”5..10″, then sometimes the sound will play back to back, (as the length of the sound file is the same as the minimum delay time), and no more than 5 seconds will ever elapse between when the sound ends and when it begins again. (The maximum delay time, 10 seconds, minus the length of the sound itself, 5 seconds, leaves a maximum silence of 5 seconds.) The default values for these attributes are as follows: volume=”100%”, playback=”looped”, delay=”5..10″.

We’ll talk about other ways to use sound later in the Sound section of the tutorial.

Put the following code between the < head > tags in your 3DML file:

< ambient_sound file="sounds/waves.wav" volume="65%" playback="looped" />

After you’ve heard how this works, you may want to remove the
< ambient_sound > tag from your 3DML file, or you are likely to get very tired of hearing it throughout this tutorial!

Other < head > tags

There are three other tags that can go in the head section of the 3DML file:
< placeholder >, < orb >, and < fog >. We’ll discuss these tags later in the tutorial.

show me the code next lesson

Welcome | Starting | Head Tag | Body Tag | Multilevels | Navigation | Textures | Orientation | Linking | Sound | Lighting | Popups | Sprites | Actions | Streaming 1 | Streaming 2 | More Blocks | Tips & Tricks | Orientation Guide | Texture Styles