Lego Island World Database

From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name Lego Island World Database
Ontology
Extension(s) .wdb
Released 1997

The Lego Island World Database format is for a particular file in the Mindscape game Lego Island. This file stores all of the models and textures used in the game. The path to the file from the Lego Island installation directory is "LEGO Island\lego\data\WORLD.WDB".

Format

This format is not complete in that not every model can be extracted using this method, but it is the closest description of the format that works at this time.

// Documentation info
// struct groups[x] -> A data structure called groups that is repeated x number of times.
// uint32 -> An unsigned integer that is 32 bits in size.
// float32 -> a floating point number that is 32 bits in size.
// char[x] -> A string of characters that is x characters long.
// if (INDEX/subgroups) == 1 -> If the index of the subgroups data structure is 1 execute the following indented.
// SEEK 10 -> Seek to byte 10 in the binary file.
// SEEKREL -1 -> Seek 1 byte backwards in the binary file.
// MARKER HELLO -> A marker definition that can be accessed with GOTO HELLO.
// GOTO HELLO -> Go to the marker HELLO.

uint32 number_of_groups

struct groups[number_of_groups]
  uint32 size_of_group_title
  char[size_of_group_title] group_title

  struct subgroups[2]
    uint32 num_sub_items
    struct sub_items[num_sub_items]
      uint32 size_of_sub_item_title
      char[size_of_sub_item_title] sub_item_title
      uint32 size_of_item
      uint32 item_offset

      if (INDEX/subgroups) == 1
        size_of_presenter_title I
        presenter_title s size_of_presenter_title
        byte[37] unknown

uint32 gif_chunk_size
byte[gif_chunk_size] unknown
uint32 model_chunk_size


//gifchunk
uint32 num_images
struct images[num_images]
  uint32 size_of_string
  char[size_of_string] gif_name
  uint32 width
  uint32 height
  uint32 num_colors

  struct colors[num_colors]
    uint8 r
    uint8 g
    uint8 b

  struct rows[height]
    struct pixels[width]
      uint8 color_index

	  
//modelchunk
uint32 size_of_chunk
uint32 num_bins
struct bins[num_bins]
  uint32 size_of_string
  char[size_of_string] bin_name
  uint32 num_models
  uint32 end_bin_offset
  SEEK end_bin_offset


//model
uint32 magic_number
uint32 bytes_left_in_subgroup
uint32 version
byte[8] unknown
uint32 size_of_file_name
char[size_of_file_name] file_name

uint32 u1

struct unknowns1[u1]
  float32 some_float1
  float32 some_float2
  float32 some_float3
  float32 some_float4

uint32 u2

struct unknowns2[u2]
  uint32 some_int1
  uint32 some_int2
  uint32 some_int3
  uint32 some_int4

uint32 number_of_components

struct component_header[number_of_components]
  uint32 size_of_string
  char[size_of_string] component_header_name

  uint16 num_things
  struct things[num_things]
    uint16 unknown1
    uint16 unknown2
    float32 ufloat1
    float32 ufloat2
    float32 ufloat3

  uint16 num_things2
  struct things2[num_things2]
    uint16 unknown1
    uint16 unknown2
    float32 ufloat1
    float32 ufloat2
    float32 ufloat3
    float32 ufloat4

  uint16 num_things3
  uint16 num_things4

  uint32 some_int

//components
struct components[number_of_components+1]
  uint32 size_of_string
  char[size_of_string] component_name

  struct random_floats2[10]
    float32 random_float2

  byte[4] unknown
  uint8 defined_elsewhere
  if (defined_elsewhere) == 1
    byte[4] unknown
    GOTO ENDCOMP

  //number of lod models in this component
  uint32 number_of_models

  if (number_of_models) == 0
    GOTO SKIPCOMPOFFSET

  uint32 end_component_offset
  MARKER SKIPCOMPOFFSET

  //this means lod, all models in a chunk are the same, just different poly
  struct models[number_of_models]
    byte[4] unknown
    uint16 number_of_parts
    byte[2] unknown
    uint16 number_of_verts
    uint16 number_of_normals
    uint16 number_of_coordinates
    byte[2] unknown

    struct vertices[number_of_verts]
      float32 x
      float32 y
      float32 z

    struct normals[number_of_normals/2]
      float32 x
      float32 y
      float32 z

    struct coordinates[number_of_coordinates]
      float32 u
      float32 v

    struct parts[number_of_parts]
      uint16 num_tris
      uint16 num_index_definitions

      struct indices[num_tris]
        struct axis[3]
          uint16 first
          uint16 second

      uint32 num_coordinate_indices

      struct coordinate_indices[num_coordinate_indices/3]
        struct axis[3]
          uint32 coordinate_index

      uint8 part_color_red
      uint8 part_color_green
      uint8 part_color_blue
      byte[8] unknown
      uint32 size_of_texture_name
      char[size_of_texture_name] texture_name
      uint32 size_of_material_name
      char[size_of_material_name] material_name

  byte[4] unknown
  MARKER ENDCOMP

//modelgifs
uint32 num_images
byte[4] unknown
struct images[num_images]
  uint32 size_of_string
  //store gif_char for later use, then go back and read entire gif_name
  uint8 gif_char
  SEEKREL -1
  char[size_of_string] gif_name

  uint32 width
  uint32 height
  uint32 num_colors

  struct colors[num_colors]
    uint8 r
    uint8 g
    uint8 b

  struct rows[height]
    struct pixels[width]
      uint8 color_index
	  
  //for special textures beggining with "^"
  if (gif_char) == 94
    struct  extra_images[1]
      uint32 width
      uint32 height
      uint32 num_colors

      struct colors[num_colors]
        uint8 r
        uint8 g
	uint8 b

      struct rows[height]
        struct pixels[width]
          uint8 color_index

External links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox