Take the 2-minute tour ×
LEGO® Answers is a question and answer site for LEGO® and building block enthusiasts. It's 100% free, no registration required.

I am interested in writing a game that interprets LXF files into worlds (to create a game such as Lego Universe). After finding out how to extract the LXFML file from the LXF archive, I need to know how to interpret the contained LXFML file. Are there any detailed descriptions of how the LXFML format works?

share|improve this question
1  
Note that while LU had a number of LEGO models in it, the world as a whole wasn't made of LEGO elements - the landscape was still a standard "terrain mesh" type of thing. –  Zhaph - Ben Duguid May 9 '12 at 9:26
add comment

1 Answer

up vote 5 down vote accepted

The LXFML file is an XML document, and there's an XSD document that you can use to validate any LXFML file, along with a textual description of the tags on the LUGNet forums supplied by the LDD Team a few years ago:

LXF files - info and XML schema

The key parts of the LXFML you're going to be interested in start with the <Scene> element, which contains one or more <model> elements, which in turn contains one or more <group> elements, which are made up of <part> elements.

The tricky part is getting from a <part> element to an actual model:

<Part refID="0" name="m3680_turn_plate_2x2__lower_part_0" designID="3680" 
      materialID="1" assemblyID="74340" assemblyRefID="0" 
      angle="0" ax="0" ay="1" az="0" tx="0" ty="0" tz="0" />

As you can see, the Design ID corresponds to a LEGO element [part:3680] so you'll need some way to get from those to a suitable model - I recommend taking a look at either:

  • BricksViewer - A Java app for viewing .lxf scene files - also has a brief discussion of the .lxf and .lxfml formats.
  • LDXNA - An XNA library for importing LDraw models - it does include an .lxfml document in one of its examples, but I don't recall it using it - however it does show you how to convert the LDraw parts library into a usable format.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.