An Introduction to 3DML
or, 3DML for the Unadventurous
A 3DML world or scene is called a "Spot". Once you're in a spot, you can navigate around with the arrow keys or with the mouse; most people find the arrow keys easier. Of course, there's no hint, from what's on the screen, that you're in an XML context; what it usually looks like (at least so far in the life of 3DML) is a fairly-amateurish shoot-em-up videogame.
What sets it apart from some other entry-level 3D environments is that it's quick; you can move and look around very promptly. As well as being fast, 3DML files are ridiculously small; the 3DML demo available on XML.com is only about 10K in size, but it portrays a large, quite visually interesting scene that you can do a lot of moving around in.
Is it XML?
If you take a good close look at the XML that encodes the 3D scene, well, it's, uh, not really XML. Flatland's software is obviously not using a real XML parser -- you can have free-floating "&" characters, and there don't seem to be any entities or default attributes (both of which would be very handy in 3DML).
There are other irritants about 3DML; for example, the tags and attributes are all case-insensitive, and all the text and instructions and interesting stuff has to be in attribute values, not content. We'll give Flatland the benefit of the doubt and assume that they'll patch up their XML problems, because the software is very impressive stuff.
How They Do It
Flatland achieves this speed and compactness by not trying to solve all the problems of Virtual Reality. You build your Spots with "blocks", each of which occupies a 256x256x256 space. You have to organize these blocks into a (small) number of levels, each of which is rectangular and the same size. Our 3DML demo has 5 15-by-30-block levels.
There are a couple of block sets that you can build with, named "basic" and "village" - for now you have to download them as a compressed binary, but Flatland is getting ready to open up that format so people can build their own. The first custom block-set just showed up at the Flatland site - it is designed to build "Lara Croft - Tomb Raider" environments. This is no accident; the whole design of 3DML seems strongly videogame-influenced. And there's nothing wrong with that; to date, twitch games have been the only real killer app for 3D, so why not go with what works?
The "basic" set has about 50 different block shapes (some of them have no shape and are for sound and light effects). You can customize each block by rotating it (in 90-degree increments of course, these are blocks after all), and by painting it with your own textures and colors.
The really clever trick is that once you've defined your blocks, you assign each a single-character code, and then you define your geometry just by mapping it out in ASCII-art style. Here's one level of our demo Spot:
<LEVEL> .............................. .............................. ..aaaaaaaaaaaaaaaaaaaaaaaaaa.. ..a........................a.. ..a...................I..I.a.. ..a.....m................I.a.. ..a.....M..................a.. ..a..I.dd..................a.. ..a....d...................a.. ..addddd...................a.. ..ad..................I....a.. ..addddddYY................a.. ..aaaaaaaaaaaaaaaaaaaaaaaaaa.. .............................. .............................. </LEVEL>
Is 3DML A Good Thing?
It's (almost) XML, which is nice, and it's lightweight and fast, which is very nice indeed. Nicest of all, it's easy to learn, which is in the spirit of the Web. I invested almost no time (using Flatland's excellent tutorial) in learning it well enough to produce a somewhat-convincing demo.
On the other hand, 3DML is, to some degree, in competition with an existing ISO/Industry standard for 3D on the Web, namely the Virtual Reality Modeling Language (VRML). VRML could never have been XML-compatible because it was invented a couple of years before XML; its syntax is somewhat like a bastard child of Java and PostScript.
VRML is immensely more sophisticated than 3DML - your worlds can be any old size and shape, and there are remarkable built-in behavior and scripting capabilities. Here is an example of a small VRML world VRML that couldn't be built in a system like 3DML. You'll notice, though, that it's a bit bigger than the 3DML stuff, and if you have to download both Flatland's Rover and the VRML brower, you'll notice that the VRML browser is immensely bigger.
VRML has been around, in one form or another, since 1994 or so, and even its fans admit that it hasn't yet really taken off. It has a few big problems:
- VRML is quite difficult to author; you need either pretty slick software, or programming ability combined with a good basic grasp of trigonometry (not to mention enough aesthetic sense to build a convincing 3-D world).
- VRML files tend to be rather large, because since you're not building with blocks, you have to say where everything goes, exactly, usually with lots of x,y,z triples of floating-point numbers. However, a combination of cleverness and compression can work wonders.
- VRML browsers tend to be kind of big and slow. Probably the best is Cosmo, which was born at SGI but now lives at Platinum; when you come to understand what VRML can potentially do, it is not surprising that a fast browser is hard to write.
The second and third problems will probably take care of themselves as computers and networks get faster - since I started using 266MHz+ processors and a hardwired ADSL Internet link, I've found VRML really starting to enter the domain of usability. So that leaves 3DML with two temporary pluses, and one big, huge, permanent advantage - it comes with a "View Source" and anyone can learn to write it in a day or so.
It's worth mentioning that there has been desultory activity in the VRML community concerning the compatibility of VRML and XML - at the very least, it might be nice to have a DOM interface, since it lives in the browser.
Lessons and Predictions?
If nothing else, 3DML proves that you can make XML do some surprising things. Anyone who issues a sweeping prediction, at this moment in Internet history, about which standards and protocols are going to win, has more courage than intelligence.
I can only speak personally and say that I find 3DML tremendously aesthetically pleasing. Virtual worlds built of blocks do, on the other hand, have a bit of a kindergarten feel, but then we are just starting to learn how to build them. If someone could write a full-bore VRML browser that had the liveliness and responsiveness of the Flatland software, it might just turn the world inside out.