18

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?

1
  • 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. May 9, 2012 at 9:26

1 Answer 1

13

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.
3
  • 2
    There has been a change in the LXFML file. I didn't check since which version, the change was applied, but LDD 4.3 (Sep-2018) has a different structure. e.g., <Part> is now <Brick> and attributes angle, ax, ay, az, tx, ty, tz are now a single transformation attribute
    – RaamEE
    Sep 26, 2018 at 14:59
  • Do you remember what ay was? Oct 2, 2022 at 20:20
  • 1
    @tommy.carstensen I believe the ax, ay and az denoted the axis of rotation, and then tx, ty and tz are the "transform" or positional axis. Oct 3, 2022 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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