<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://moddingwiki.shikadi.net/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Knt47</id>
	<title>ModdingWiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://moddingwiki.shikadi.net/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Knt47"/>
	<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/wiki/Special:Contributions/Knt47"/>
	<updated>2026-05-14T05:48:31Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.11</generator>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Image_Format&amp;diff=10688</id>
		<title>The Incredible Machine Image Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Image_Format&amp;diff=10688"/>
		<updated>2022-08-12T21:33:11Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Tools */ TIM level viewer now hosted on Codeberg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Tileset Infobox&lt;br /&gt;
 | Hardware1 = EGA &lt;br /&gt;
 | Hardware2 = VGA&lt;br /&gt;
 | MaxTiles = 65535&lt;br /&gt;
 | Palette = Shared&lt;br /&gt;
 | Names = N&lt;br /&gt;
 | TileMinSize = 1x1&lt;br /&gt;
 | TileMaxSize = 65535&amp;amp;times;65535&lt;br /&gt;
 | NumPlanes = 1&lt;br /&gt;
 | PlaneArrangement = Linear&lt;br /&gt;
 | HasTransparency = Y&lt;br /&gt;
 | Metadata = None&lt;br /&gt;
 | Subtilesets = N&lt;br /&gt;
 | Compressed = Y&lt;br /&gt;
 | Hidden = Y&lt;br /&gt;
 | Games =&lt;br /&gt;
            {{Game|The Incredible Machine}}&lt;br /&gt;
            {{Game|The Even More Incredible Machine}}&lt;br /&gt;
            {{Game|The Incredible Machine 2}}&lt;br /&gt;
            {{Game|Heart of China}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The Incredible Machine&#039;&#039;&#039; (TIM) &#039;&#039;&#039;bitmap images&#039;&#039;&#039; are stored in the &amp;lt;tt&amp;gt;RESOURCE.00?&amp;lt;/tt&amp;gt; [[TIM Resource Format|resource files]] as sub-files. They have the extension &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(For full-screen images (&amp;lt;tt&amp;gt;*.SCR&amp;lt;/tt&amp;gt;), see [[RES Format (Stellar 7)#SCR: Fullscreen image|Stellar 7 RES Format]].)&lt;br /&gt;
&lt;br /&gt;
== Chunk format ==&lt;br /&gt;
&lt;br /&gt;
The files are built up out of chunks, in the typical Dynamix chunk format: a 3-character ID, followed by a &#039;:&#039;, followed by the chunk size in [[UINT32LE]] format. The highest bit of the chunk size value is not actually part of the chunk size: it is set to 1 if the chunk is a container-type chunk that contains more chunks inside itself. This chunk format is documented on the [[RES Format (Stellar 7)#BMP: images|Stellar 7 RES Format]] page.&lt;br /&gt;
&lt;br /&gt;
The BMP file is contained inside one &amp;lt;tt&amp;gt;BMP&amp;lt;/tt&amp;gt; chunk. This is a container chunk. None of chunks types embedded inside it are container chunks.&lt;br /&gt;
&lt;br /&gt;
The first chunk inside the &amp;lt;tt&amp;gt;BMP&amp;lt;/tt&amp;gt; data is the &amp;lt;tt&amp;gt;INF&amp;lt;/tt&amp;gt; chunk. Its data starts with a [[UINT16LE]] indicating the number of sub-images inside the file, followed by two UINT16LE arrays containing respectively the widths and heights of all images.&lt;br /&gt;
&lt;br /&gt;
Based on the chunk type that contains the image data, there are two types of images:&lt;br /&gt;
&lt;br /&gt;
== SCN/OFF format ==&lt;br /&gt;
&lt;br /&gt;
The majority of the image files in &#039;&#039;The Incredible Machine&#039;&#039;, including the graphics for puzzle parts, contain an &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; and an &amp;lt;tt&amp;gt;OFF&amp;lt;/tt&amp;gt; chunk. The image data is stored in the &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk, while the &amp;lt;tt&amp;gt;OFF&amp;lt;/tt&amp;gt; chunk contains an index for each sub-image&#039;s data inside the &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk. The &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk has its own compression format, described in the next section.&lt;br /&gt;
&lt;br /&gt;
=== The SCN chunk ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk contains the pixel data for each sub-image. Basically, it has an extended [[RLE Compression#Code|code-based run-length encoding]] format with 2-bit commands. This gives four commands; the classic &amp;quot;repeat&amp;quot; and &amp;quot;copy&amp;quot; ones, and two extra commands to skip ahead. These &amp;quot;skips&amp;quot; should always treat the skipped space as transparent. If the output buffer is not cleared in advance, and the decompression is not meant to directly paint the new graphics onto an existing image in the buffer, these commands might need to specifically write 0-values to fill the skipped pixels.&lt;br /&gt;
&lt;br /&gt;
The data for each sub-image starts with an &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt; byte that has a special meaning: its value is added to all non-transparent pixel values. It normally corresponds to the lowest pixel value found in the resulting image. The value of this byte is set to 0xFF in some &amp;quot;empty&amp;quot; images that contain only a few transparent pixels. &lt;br /&gt;
In 8-bit games, like [[Heart of China]], the result may be an 8-bit image, meaning &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt;, and the resulting pixel values, can be larger than 0x0F. The compression itself is based on storage of 4-bit pixels, though, so even on 8-bit images, the final data can only contain values from &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt; up to &amp;lt;code&amp;gt;addValue + 0x0F&amp;lt;/code&amp;gt;, plus the background colour. This special handling of transparency makes sure that the full range of the 4 bits can be used for colours, without the need to sacrifice one for transparency. This does make it difficult to convert to classic image formats without upgrading the image to at least 8-bit.&lt;br /&gt;
&lt;br /&gt;
The actual RLE codes start after this byte. The &amp;lt;code&amp;gt;command&amp;lt;/code&amp;gt; is made from the upper two bits, with the lower six bits serving as the &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that this &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; always denotes a number of &#039;&#039;pixels&#039;&#039;, not bytes, which may be tricky to program for 4-bit images. An alternative approach could be to decompress the image to an 8-bit buffer, and post-process the result to compact it to 4-bit (unless the &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt; makes the values too large for that, and it is intended to be 8-bit).&lt;br /&gt;
&lt;br /&gt;
The four different commands are:&lt;br /&gt;
&lt;br /&gt;
==== Command 0: Line skip ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;command&amp;lt;/code&amp;gt; made from high bits &amp;lt;tt&amp;gt;00&amp;lt;/tt&amp;gt; is meant to skip to the next line in the image. This command &#039;&#039;must&#039;&#039; be used to terminate a line in the image; the format does not seem to support automatic wraparound for progressing to a new line. This also means none of the other commands will ever write data that goes beyond the end of a line.&lt;br /&gt;
&lt;br /&gt;
The line skip command will move the output pointer down one line on the image (ending up on the same X-coordinate on the next line), and then move back by the amount of pixels specified in &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;. With wraparound included, this means the operation simply jumps (or background-fills) to the position &amp;lt;code&amp;gt;width - value&amp;lt;/code&amp;gt; pixels ahead of your current output write position.&lt;br /&gt;
&lt;br /&gt;
There are some special cases in this, though. Since this should be able to move from the end of one line to the start of the next one, it needs to be able to address the entire width of the image, which, on large images, can&#039;t be done in one 6-bit value. Because of this, the data may contain two consecutive bytes with a &#039;line skip&#039; command, and the values of both of these need to be taken together, with the second command providing the more significant seventh to twelfth bits to be added to the first read value, as &amp;lt;code&amp;gt;value = value1 | (value2 &amp;lt;&amp;lt; 6)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
However, if an image has several empty lines in it, it can be unclear whether or not such commands should be taken together. Because of this, if the second command has a &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; of 0, the rule is to always treat it as separate command. To avoid all ambiguity in these cases, and because a &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; 00 code &#039;&#039;can&#039;&#039; be extended by one with a higher &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;, if the non-empty pixels on that later line start at an X-coordinate earlier than the first empty pixel on that earlier line, the first line skip command will &#039;&#039;&#039;always&#039;&#039;&#039; align the X-coordinate with the point at which the data restarts after the gap, so that all commands following it can be non-ambiguous byte 00 full line skips. Note that if the pixel appears at an identical or higher X-coordinate, all line skips can be done with 00 bytes, and any remaining distance can simply be filled up with &#039;short skip&#039; commands (see below), which can perfectly be placed after the 00 bytes.&lt;br /&gt;
&lt;br /&gt;
==== Command 1: Short skip ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;command&amp;lt;/code&amp;gt; you get when the high bits are &amp;lt;tt&amp;gt;01&amp;lt;/tt&amp;gt; will skip (or background-fill) the amount of pixels specified in &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;. Numbers greater than 0x3F will simply be encoded in multiple &#039;short skip&#039; commands. A &#039;short skip&#039; command with a &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; of 0, resulting in a Code byte 0x40, is used to indicate the end of the decompression of the current sub-image.&lt;br /&gt;
&lt;br /&gt;
==== Command 2: Repeat ====&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;command&amp;lt;/code&amp;gt; made up of bits &amp;lt;tt&amp;gt;10&amp;lt;/tt&amp;gt; will create a sequence of pixels of the same color. The repeat count is specified by &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;. A single byte follows the Code byte, containing the pixel value. Since this is a 4-bit format, the most significant 4 bits of this byte are always zero. Note that the &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt; from the start of the data needs to be added to this to get the real pixel value to repeat.&lt;br /&gt;
&lt;br /&gt;
==== Command 3: Copy ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;command&amp;lt;/code&amp;gt; from high bits &amp;lt;tt&amp;gt;11&amp;lt;/tt&amp;gt; is the Copy command. This simply copies a sequence of pixel values to the output. The amount of pixels is specified in &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Since the amount is in pixels, the number of bytes after the Code byte does not match the &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;. It can be calculated as &amp;lt;code&amp;gt;(value + 1) &amp;gt;&amp;gt; 1&amp;lt;/code&amp;gt;. Each byte contains two pixels, with the color of the leftmost pixel stored in the most significant nibble. If the number of pixels is odd, the most significant 4 bits of the last byte contains the color of the last pixel, and the less significant nibble is zero. Note that since the  &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt; from the start of the data needs to be added to every pixel in this range, and the starting position to write pixels to may be an odd number at the start of the command, this operation requires treating all data as nibbles to process them correctly.&lt;br /&gt;
&lt;br /&gt;
==== Terminator ====&lt;br /&gt;
&lt;br /&gt;
Nearly all sub-images are &amp;quot;terminated&amp;quot; by the byte sequence 0x00 0x40; a full line skip, followed by an empty short skip command. However, there are a few exceptions, where it ends on 0x40 alone. Do note that while a 0x40 can always be considered a terminator command, since it has no real meaning on its own, a 0x00 is a perfectly valid full-line skip, and should never be treated as a signal to end the decompression.&lt;br /&gt;
&lt;br /&gt;
=== The OFF chunk ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;OFF&amp;lt;/tt&amp;gt; chunk contains the offsets for each sub-image in the &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk, as [[UINT32LE]] values. The first one should always be zero.&lt;br /&gt;
&lt;br /&gt;
The end of the current sub-image&#039;s compressed data in the &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk can be determined from the start of the next offset in the list, or the length of the &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk, if it&#039;s the final image. In practice, though, the data itself will always indicate the end with the 0x40 terminator value.&lt;br /&gt;
&lt;br /&gt;
=== Format quirks ===&lt;br /&gt;
&lt;br /&gt;
Since the &#039;line skip&#039; command is the only valid way to progress to a new line, and this can only address up to 12 bits, images in this format are technically restricted to a width of up to 4095 pixels.&lt;br /&gt;
&lt;br /&gt;
== BIN format ==&lt;br /&gt;
&lt;br /&gt;
The remaining files in &#039;&#039;The Incredible Machine&#039;&#039; use a &amp;lt;tt&amp;gt;BIN&amp;lt;/tt&amp;gt; chunk (e.g. &amp;lt;tt&amp;gt;MOUSE.BMP&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;PARTBIN.BMP&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;BIN&amp;lt;/tt&amp;gt; chunk has a small header of one byte to indicate the compression algorithm, followed by a [[UINT32LE]] giving the uncompressed size. It supports the same compression algorithms as [[Dynamix Font Format v4-v5#Compression|Dynamix fonts]]. The header is immediately followed by the compressed 4bpp pixel data.&lt;br /&gt;
&lt;br /&gt;
This format is the 4 bit per pixel version of [[RES Format (Stellar 7)#BMP: Image|the BIN/VGA-containing BMP format]] found in several 8-bit Dynamix games.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=image}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [https://codeberg.org/knt47/timgres The Incredible Machine level/image resource viewer] ([https://www.vogons.org/viewtopic.php?p=1089143#p1089143 VOGONS])&lt;br /&gt;
| Platform = Windows, Linux&lt;br /&gt;
| canView = Yes&lt;br /&gt;
| canExport = Yes&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes = &lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [https://www.vogons.org/viewtopic.php?f=5&amp;amp;t=76910 The Incredible Machine image resource reader] &amp;lt;small&amp;gt;Note: outdated version&amp;lt;/small&amp;gt;&lt;br /&gt;
| Platform = Windows, Linux&lt;br /&gt;
| canView = Yes&lt;br /&gt;
| canExport = Yes&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes = &lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Engie File Converter]]&lt;br /&gt;
| Platform = Windows&lt;br /&gt;
| canView = Yes&lt;br /&gt;
| canExport = Yes&lt;br /&gt;
| canImport = Yes&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes = Supports &amp;lt;tt&amp;gt;SCN/OFF&amp;lt;/tt&amp;gt; files with a high &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt; byte, treating them as 8-bit.&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
The SCN compression was reverse engineered by [[User:Knt47|Knt47]], with further detail research conducted by [[User:Nyerguds|Nyerguds]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;br /&gt;
&lt;br /&gt;
[[Category:Sierra/Dynamix File Formats]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10687</id>
		<title>The Incredible Machine 2-3 ANM File Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10687"/>
		<updated>2022-08-12T21:29:59Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Tools */ TIM level viewer now hosted on Codeberg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The &#039;&#039;&#039;animation&#039;&#039;&#039; (&amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt;) sub-files are found in the [[TIM Resource Format|archive file]] of [[The Incredible Machine 2]] (TIM 2) and [[Thie Incredible Machine 3|3]] (TIM 3). They contain the information required for drawing puzzle part sprites, which are often comprised of multiple sub-images of [[The Incredible Machine Image Format|image files]] and for animations of the puzzle parts. They are also used for animated parts of the game&#039;s user interface (for example the animated icons of the main menu). It can also contain commands for playing sound effects.&lt;br /&gt;
&lt;br /&gt;
Most &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files (all in TIM 2) contain two chunks, starting with &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;  and &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, respectively. Both use the typical &amp;quot;Dynamix chunk&amp;quot; format, starting with the 4-byte chunk type (&amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;/&amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, followed by the chunk size in 32-bit, little endian format. Unlike other Dynamix file formats, the most significant bit in the 32-bit size of the first chunk is not set. A small number of files in TIM 3 contain a third chunk, &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot;, with an unclear meaning.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;ANM:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
Not counting the chunk type and size, an &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt; chunk has five parts, a 16 or 22 byte header, and four sections containing the actual sprite/animation frame/animation data, labeled here as A-D.&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk (not counting the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the chunk size) starts with a header, with a size of 16 or 22 bytes, depending on the magic number. It has the following Format:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] magic_number_1;&lt;br /&gt;
  UINT16LE magic_number_2;&lt;br /&gt;
  UINT16LE size_section_a;&lt;br /&gt;
  UINT16LE size_section_b;&lt;br /&gt;
  UINT16LE size_section_c;&lt;br /&gt;
  UINT16LE size_section_d;&lt;br /&gt;
  UINT16LE anm_width;&lt;br /&gt;
  UINT16LE anm_height;&lt;br /&gt;
  /* 3 members, found only in files with a magic number of 0x54 0x42 0xEA 0x03: */&lt;br /&gt;
  UINT16LE unknown_16;&lt;br /&gt;
  UINT16LE unknown_18;&lt;br /&gt;
  UINT16LE unknown_20;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;magic_number_1&#039;&#039;&#039;, &#039;&#039;&#039;magic_number_2&#039;&#039;&#039;:  The header starts with a 4-byte magic number. The first two bytes are always 0x54 0x42. The second two bytes are a 16-bit little endian file version number. In TIM 2, the possible values 1000 (0x3E8) or 1001 (0x3E9). There is no obvious difference in the format of the files using these two numbers, however, 0x3E9 is much more common and 0x3E8 is mostly used for relatively small and simple files. In TIM 3, a small number of files use a newer version of the &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; file format, with a magic_number_2 value of 1002 (0x3EA). Such files have a slightly different format compared to files with the other two numbers. The &amp;quot;newer&amp;quot; format is used in the user interface and the game menu, but never for puzzle part graphics.&lt;br /&gt;
* &#039;&#039;&#039;size_section_a&#039;&#039;&#039;: The number of entries in the A section of the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, one entry is 2 byte (i.e. the section is an array of 16-bit integers). Several files do not have an A section (size_section_a == 0)&lt;br /&gt;
* &#039;&#039;&#039;size_section_b&#039;&#039;&#039;: The number of entries in the B section. One entry is 12 bytes in the files in files with &amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;, 10 bytes in all other files.&lt;br /&gt;
* &#039;&#039;&#039;size_section_c&#039;&#039;&#039;: The number of entries in the C section, one entry is 4 bytes.&lt;br /&gt;
* &#039;&#039;&#039;size_section_d&#039;&#039;&#039;: The size of the D section in bytes.&lt;br /&gt;
* &#039;&#039;&#039;anm_width&#039;&#039;&#039;, &#039;&#039;&#039;anm_height&#039;&#039;&#039;: Width and height of the animation. In &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts, the two structure members usually have the same value as width_1 and height_1 for the part in puzzle/level files.   &lt;br /&gt;
&lt;br /&gt;
Structure members found only in files with the longer header (&amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;unknown_16&#039;&#039;&#039;: 0x14 in all files, perhaps the size of header minus magic_number_1. Files with the longer header do not contain additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, so it cannot be a size of such a section.&lt;br /&gt;
* &#039;&#039;&#039;unknown_18&#039;&#039;&#039;: 0 in all files&lt;br /&gt;
* &#039;&#039;&#039;unknown_20&#039;&#039;&#039;: 0x17 in one file, 0 in all others. Clearly not the size of an additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section A ===&lt;br /&gt;
&lt;br /&gt;
Section A is empty in a large number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files. If present, it is an array of 16-bit little endian integers. It contains all numbers from 0 to the number of items in B section minus 1, in increasing order, with some numbers repeated. For example &amp;lt;code&amp;gt;0 1 1 1 2&amp;lt;/code&amp;gt; means that the animation frame with index 1 in section B must be shown for the duration of 3 timer ticks instead of 1.&lt;br /&gt;
&lt;br /&gt;
=== Section B ===&lt;br /&gt;
&lt;br /&gt;
Section B is a list of structures containing 16 bit integer members, 6 if magic_number_2 is &amp;lt;tt&amp;gt;0x3EA&amp;lt;/tt&amp;gt;, 5 in the other versions of the file format. It contains essential information about each animation frame. One structure has the following members:&lt;br /&gt;
&lt;br /&gt;
  [[INT16LE]] relative_pos_x;&lt;br /&gt;
  INT16LE relative_pos_y;&lt;br /&gt;
  UINT16LE width;&lt;br /&gt;
  UINT16LE height;&lt;br /&gt;
  UINT16LE section_d_offset;&lt;br /&gt;
  /* Note that the last member is only present in files with */&lt;br /&gt;
  /*     magic number 0x54 0x42 0xEA 0x03 */&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;relative_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;relative_pos_y&#039;&#039;&#039;: The coordinates where the animation frame must be drawn, relative to other frames. For the first item in the B section, the value of both tare typically 0, however there are a few exceptions. The relative position may be negative.&lt;br /&gt;
* &#039;&#039;&#039;width&#039;&#039;&#039;, &#039;&#039;&#039;height&#039;&#039;&#039;: The width and the height of the graphics in the specific animation frame.&lt;br /&gt;
* &#039;&#039;&#039;section_d_offset&#039;&#039;&#039;: An offset in section D, points to the first command required for drawing the animation frame.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: The meaning is unclear. Often, but not always a number divisible by 3. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section C ===&lt;br /&gt;
&lt;br /&gt;
A section C item has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE first_frame_id;&lt;br /&gt;
  UINT16LE state_id;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;first_frame_id&#039;&#039;&#039;: The meaning of &#039;&#039;first_frame_id&#039;&#039; is slightly different between files containing or not containing an A section. If the A section is not present, this is the index in section B for the first animation frame for a particular animation. If there is an A section, &#039;&#039;first_frame_id&#039;&#039; is an index in the A section, and the 16-bit array item at this index is the required section B index. The section B indices determined this way essentially divide the B section into sub-sectons. One sub-section corresponds to the &amp;quot;animation&amp;quot; of a puzzle part or an user interface element in one specific state. If an &amp;quot;animation&amp;quot; has only one section B item, then the puzzle part or button/icon is not animated in this state.&lt;br /&gt;
* &#039;&#039;&#039;state_id&#039;&#039;&#039;: An internal identifier used by the game for a state of the puzzle part or an user interface element. In a specific &amp;quot;state&amp;quot;, the puzzle part (or user interface element) may or may not be animated, the animation frames belonging to such a state must be determined using the first_frame_id member.&lt;br /&gt;
&lt;br /&gt;
=== Section D ===&lt;br /&gt;
&lt;br /&gt;
The D section contains the instructions on how to draw each animation frame (or to play a sound). The section_d_offset field in the corresponding section B entry determines where the sequence of commands start for each animation frame. There are 6 different types of commands, numbered 0-5. Each command starts with its number in a 16-bit, little endian format. For commands 2-5, this is followed by a list of 16-bit integer parameters, the number of the parameters depends on command number.&lt;br /&gt;
 &lt;br /&gt;
==== Command 0: End of animation frame ====&lt;br /&gt;
&lt;br /&gt;
Command 0 indicates the end of an animation frame in the file. It terminates the list of commands associated with a section B item. Command 0 has no parameters and is always 2 bytes long (the 16-bit command number).&lt;br /&gt;
&lt;br /&gt;
==== Command 1: End of &amp;quot;ANM:&amp;quot; chunk ====&lt;br /&gt;
&lt;br /&gt;
The last two bytes of section D (and the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk) are always &amp;lt;code&amp;gt;01 00&amp;lt;/code&amp;gt; (1 in 16-bit little endian format). These two bytes can be interpreted as a 2-byte command that terminates section D and the entire &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. Command 1 is not found anywhere else in section D.&lt;br /&gt;
&lt;br /&gt;
==== Command 2: Draw BMP sub-image ====&lt;br /&gt;
&lt;br /&gt;
Command 2 is an instruction for the  game engine to draw a sub-image from a &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; image stored in the archive file of the game. It should be noted that a part sprite is often &amp;quot;cut into&amp;quot; multiple &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub images, and in a few cases, they are stored in more than one file. Command 2 has five 16-bit integer parameters (size is 12 bytes, including the command number).&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 2 */&lt;br /&gt;
  UINT16LE bmp_file_num;&lt;br /&gt;
  UINT16LE bmp_sub_image_num;&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE flip;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bmp_file_num&#039;&#039;&#039;: Index of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file in the TAG: chunk. The index of the first image is 1.&lt;br /&gt;
* &#039;&#039;&#039;bmp_sub_image_num&#039;&#039;&#039;: The &amp;quot;sub-image&amp;quot; number of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file to draw. [[The Incredible Machine Image Format|&amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; images in TIM 2]]  can have multiple sub images.&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: The position of the image (top left corner), relative to the x and y coordinates in the corresponding section B item.&lt;br /&gt;
* &#039;&#039;&#039;flip&#039;&#039;&#039;: The image can be drawn horizontally and/or vertically flipped relative to its original orientation. 1 = vertical flip, 2 = horizontal flip, 3 = both, 0 = no such transform is applied.&lt;br /&gt;
&lt;br /&gt;
==== Command 3: Draw rectangle ====&lt;br /&gt;
&lt;br /&gt;
Command 3 draws a rectangle with a border and fill color provided as arguments. It is mainly used in user interface elements and in the graphics shown in the part help screen, rarely in puzzle part graphics. It has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 3 */&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE rect_width;&lt;br /&gt;
  UINT16LE rect_height;&lt;br /&gt;
  UINT16LE border_color;&lt;br /&gt;
  UINT16LE fill;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: Coordinates of the top left corner of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;rect_width&#039;&#039;&#039;, &#039;&#039;&#039;rect_height&#039;&#039;&#039;: The width and height of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;border_color&#039;&#039;&#039;: The border color for the rectangle. In TIM 2, one color from the 16-color palette.&lt;br /&gt;
* &#039;&#039;&#039;fill&#039;&#039;&#039;: The value of the &#039;&#039;fill&#039;&#039; parameter is either 0 - no fill, border only - or a value between 0x8000 and 0x800f where the least significant nibble contains the fill color.&lt;br /&gt;
&lt;br /&gt;
==== Command 4: Draw line ====&lt;br /&gt;
&lt;br /&gt;
Command 4 draws a line between two end points with a specific color. Like the rectangle command, it is mainly used for game interface graphics, not the puzzle parts. The format of the command is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 4 */&lt;br /&gt;
  INT16LE x1;&lt;br /&gt;
  INT16LE y1;&lt;br /&gt;
  INT16LE x2;&lt;br /&gt;
  INT16LE y2;&lt;br /&gt;
  UINT16LE line_color;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;x1&#039;&#039;&#039;, &#039;&#039;&#039;y1&#039;&#039;&#039;: The coordinates of one end point.&lt;br /&gt;
* &#039;&#039;&#039;x2&#039;&#039;&#039;, &#039;&#039;&#039;y2&#039;&#039;&#039;: The coordinates of the other end point.&lt;br /&gt;
* &#039;&#039;&#039;line_color&#039;&#039;&#039;: The color of the line, one color from the 16-color palette in TIM 2.&lt;br /&gt;
&lt;br /&gt;
==== Command 5: Play sound ====&lt;br /&gt;
&lt;br /&gt;
If the command list for an animation frame includes command 5, a sound effect will be played when the particular frame is shown. It has one 16-bit parameter, the ID of the sound. TIM 2 contains sounds in two different formats. Sounds with a number &amp;gt;= 3000 are stored in the archive file of the game (&amp;lt;tt&amp;gt;SX_3???.RAW&amp;lt;/tt&amp;gt;). &amp;lt;tt&amp;gt;.RAW&amp;lt;/tt&amp;gt; files are uncompressed 8-bit PCM audio files without any header. The rest of the files (with numbers &amp;lt; 300) are found in &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;.&lt;br /&gt;
TIM 3 has &amp;lt;tt&amp;gt;.WAV&amp;lt;/tt&amp;gt; files instead in the archive file an there is no &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;. ({{TODO|TIM 3 sounds with numbers below 3000}}).&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;TAG:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk contains the names of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub-files (in the archive file of the game) required for displaying the animation. Not counting the &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the 32-bit chunk size, the first two bytes of the data contains the number of image file names in 16-bit little endian format. The remaining part of the data is the list of image file name entries. A single entry is a 16-bit image ID followed by a null-terminated string containing the name of the image. In TIM 2, the ID of the first image is always 1, however, there are exceptions to this rule in TIM 3 (but never in part graphics). There is no gap in the numbering of the images, this makes the image ID field somewhat redundant.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;LAB:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is present in a small number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files in TIM 3. &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts never contain such a chunk. The structure of the &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is similar to &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, it consists of the number of entries stored as 16-bit integer, followed by item ID-null terminated string pairs. The strings are apparently not user interface texts visible to the player. &lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TODO, Does not really belong to any file format category in FileFormatTool tempate --&amp;gt;&lt;br /&gt;
[https://codeberg.org/knt47/timgres The Incredible Machine level/image resource viewer] ([https://www.vogons.org/viewtopic.php?p=1089143#p1089143 VOGONS]) supports viewing animations in TIM 2-3 &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files.&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TODO, this file format does not really belong to any file format category in this site --&amp;gt;&lt;br /&gt;
[[Category:All file formats]]&lt;br /&gt;
[[Category:The Incredible Machine 2]]&lt;br /&gt;
[[Category:The Incredible Machine 3]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10686</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10686"/>
		<updated>2022-08-12T21:28:00Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Tools */ TIM level viewer now hosted on Codeberg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar. Level files have the extension &amp;lt;tt&amp;gt;.LEV&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. Such files are saved by the game with extension &amp;lt;tt&amp;gt;.TIM&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 00 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;EF AC 12 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;). An empty string in .GKC files with magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
Hints are supported only in TIM 2 and 3 puzzles. The first two bytes of the hint data contain the number of the hints in 16-bit little endian format. This is followed by 8 hint entries, some of them may be unused. A size of an unused entry is 7 bytes. One entry consists of three 16-bit integers and a null-terminated string containing the hint text. The three integer members are (all have a 16-bit little endian format):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;position_x&#039;&#039;&#039;: The X position of the hand icon for the hint.&lt;br /&gt;
* &#039;&#039;&#039;position_y&#039;&#039;&#039;: The Y position.&lt;br /&gt;
* &#039;&#039;&#039;hint_icon_flip&#039;&#039;&#039;: The hand icon of a hint can be flipped and can have four different orientations. Possible values are 0-3.&lt;br /&gt;
&lt;br /&gt;
In TIM 2, there are 3 (?) puzzles with magic number &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;. Neither of these files contain hints. However, the size of the empty hints section is 42 bytes in them instead of the expected 58.&lt;br /&gt;
&lt;br /&gt;
== Puzzle information data structure ==&lt;br /&gt;
&lt;br /&gt;
=== In TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
In TIM and TEMIM, there are two different puzzle header information data structures, one is used by the puzzles, and the another is found in saved &amp;quot;freeform&amp;quot; machines and the GKC files.&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM / TEMIM puzzles:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] bonus_1;&lt;br /&gt;
  UINT16LE bonus_2;&lt;br /&gt;
  [[INT16LE]] pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  INT16LE unknown_8;&lt;br /&gt;
  INT16LE unknown_10;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
The information structure format in saved &amp;quot;freeform&amp;quot; machines and GKC files:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bonus_1&#039;&#039;&#039;: The value of &amp;quot;Bonus 1&amp;quot; immediately after the puzzle is loaded (its value is constantly decreasing while the player is solving the puzzle).&lt;br /&gt;
* &#039;&#039;&#039;bonus_2&#039;&#039;&#039;: The value of &amp;quot;Bonus 2&amp;quot; for the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;unknown_8&#039;&#039;&#039;, &#039;&#039;unknown_10&#039;&#039;: The value of these two members is always -8. Perhaps the top left corner of the screen in the coordinate system used for puzzle parts, which is also (-8, -8).&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1001-1016 for TIM and 1001-1021 for TEMIM.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move (e.g. walls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that move (e.g. balls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_in_partsbin&#039;&#039;&#039;: The number of parts that are placed into the parts bin. (The player needs to position them in order to solve the puzzle.)&lt;br /&gt;
&lt;br /&gt;
=== In TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM 2 and 3:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE unknown_4;&lt;br /&gt;
  UINT16LE unknown_6;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE unknown_14;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1000-1023.&lt;br /&gt;
* &#039;&#039;&#039;unknown_4&#039;&#039;&#039;, &#039;&#039;&#039;unknown_6&#039;&#039;&#039;: Meaning is unknown, always 0.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move, regardless of whether they are placed initially into the parts bin or not.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that can move.&lt;br /&gt;
* &#039;&#039;&#039;unknown_14&#039;&#039;&#039;: Value is always 0. Likely this member corresponds to num_parts_in_partsbin in TIM / TEMIM puzzle header. Unlike TIM / TEMIM, parts placed into the parts bin are not a separate section in TIM 2 / 3, therefore, its value is always zero.&lt;br /&gt;
&lt;br /&gt;
== Puzzle part data ==&lt;br /&gt;
&lt;br /&gt;
With the exception of TIM demo version (see below), the size of a part entry for the majority of puzzle parts is 48 bytes. However, there are exceptions, which are discussed in separate sub-sections. The format of the &amp;quot;default&amp;quot; part entry:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  [[BYTE]] belt_connect_pos_x;&lt;br /&gt;
  BYTE belt_connect_pos_y;&lt;br /&gt;
  UINT16LE belt_line_distance;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE rope_1_connect_pos_x;&lt;br /&gt;
  BYTE rope_1_connect_pos_y;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  BYTE rope_2_connect_pos_x;&lt;br /&gt;
  BYTE rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_type_num&#039;&#039;&#039;: A number associated with the type of the part (e.g. 0 - bowling ball). Required for identifying parts with an entry size different from the default. See [[The Incredible Machine Level Format/Part Numbers]]&lt;br /&gt;
* &#039;&#039;&#039;flags_1&#039;&#039;&#039;: A combination of flag bits.&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039; uses the following flag bits:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: Unknown meaning, used for a few &amp;quot;moving&amp;quot; parts (bucket, candle)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Set if the part is a wall.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x800&amp;lt;/code&amp;gt;: Part is placed initially into the parts bin (see num_parts_in_partsbin in part information data structure)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x4000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position (see &#039;&#039;num_parts_fixed&#039;&#039;)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: Set when 0x800 is not set ({{TODO|further testing needed}})&lt;br /&gt;
** In &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;, the bits have a known meaning:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Meaning unclear, used for &amp;quot;moving&amp;quot; parts only, but not always set, even for a single type of part.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, affected by gravity.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;, 0x4000: Used in combination for parts that do not move and are not affected by gravity.&lt;br /&gt;
* &#039;&#039;&#039;flags_2&#039;&#039;&#039;: Another word containing flag bits. The meaning of most flags is the same in all game versions.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: A belt can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: A belt is connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: A rope can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: A second rope can be connected to the part (teeter-totter)&lt;br /&gt;
** &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;: The part sprite is drawn horizontally flipped.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: The part sprite is drawn vertically flipped. Note on flip flags: Flipping a part in the game does not necessarily mean that one of the flip flags will be changed. For several parts, especially in TIM 2 / 3, flipping will affect the value of the &#039;&#039;appearance&#039;&#039; member.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Probably unused&lt;br /&gt;
** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Part can be stretched in at least one direction: inclines, conveyor belt, walls.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: Parts that can be stretched both horizontally and vertically, the walls.&lt;br /&gt;
* &#039;&#039;&#039;flags_3&#039;&#039;&#039;: Some flags are only present in TIM 2 / 3. This member of the part data structure is missing in the demo version of TIM.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: The part can be plugged into an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: The part is an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: The part can burn (e.g. candle) or has a fuse that can be lit (e.g. dynamite, cannon). Usually in combination with flag 0x8. &lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: Meaning of this flag is unclear. Used for several part types, but changing it has no apparent consequence (?) &lt;br /&gt;
** Flags present only in &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Part is &amp;quot;locked&amp;quot;, i.e not placed into the part bin.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Sizable scenery part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: {{TODO|unknown meaning}}&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: A &amp;quot;program&amp;quot; icon is shown for the part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: Scenery part&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Wall part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: A &amp;quot;Puzzle solution&amp;quot; icon is shown for the part (?)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: An identifier for the sprite that is shown for a part before the machine is started. (Once the machine is started, the state of the part can change and so can the sprite shown.) The meaning is different between TIM and TIM 2. In TIM, the sprite of some parts consists of only one image, in this case, this is often the number of the sub-image in the [[The Incredible Machine Image Format|image resource file]]. ({{TODO|For other parts, this is probably an internal identifier for the sprite (?)}}). In TIM 2 and 3, the meaning of the appearance is an index in the A section of the [[The Incredible Machine 2-3 ANM File Format|.ANM file]] for the part, or if this is absent, an index in the B section. &amp;quot;Programming&amp;quot; a part in TIM 2 and 3 often results in the change of this field.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;: The width and height of the selectable area of the part ({{TODO|more reverse engineering work needed}})&lt;br /&gt;
* &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: At least in TIM 2, witdh_2 is used for calculating the position of part sprite when the part is flipped because of the horizontal flip bit is set in flags_2.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the part, usually the top left corner of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: In TIM 2 and 3, a programmed behavior of the part. (However, for many parts, &amp;quot;programming&amp;quot; modifies the &#039;&#039;appearance&#039;&#039; member.) For example the number of shots of the phazer gun or character shown by the message computer.  Meaning is different for rope parts, see below. Unused in TIM and TEMIM (except for ropes).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Probably unused, usually 0. Note that belt parts have a value of 1 in this position.&lt;br /&gt;
* &#039;&#039;&#039;belt_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;belt_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Always positive or 0, because &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039; are the coordinates of the top left corner where the sprite starts. Note that the formulas required for calculating the exact position of the belt are slightly different between TIM and TIM 2. Parts for which connection of a belt is allowed have a distinct circular area in their sprite, corresponding to the location where the belt is connected. In TIM / TEMIM, &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; is approximately the top left corner of its bounding rectangle, while in TIM 2 /3 it is close to the center of the circle.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_line_distance&#039;&#039;&#039;: The belts in the game appear as two, usually not perfectly parallel black (TIM / TEMIM) or gray (TIM 2 / 3) lines. This parameter determines the distance between the two segments, More precisely, it is either approximately the diameter of the circular area mentioned at &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; (TIM / TEMIM) or its radius (TIM 2 / 3).&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Similarly to belt_connect_pos_x/y, always positive or 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_2_connect_pos_y&#039;&#039;&#039;: The same as &#039;&#039;rope_1_connect_pos_x&#039;&#039;, &#039;&#039;rope_1_connect_pos_y&#039;&#039;, bit for another connected rope part.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;: The index of one or two parts in the puzzle that are connected to this part with a rope. If the rope runs through pulleys, this is the part index of the first pulley. If no rope is connected or this is not possible for the part, the value of both structure members are -1. (Of course, if one rope is connected, the value of one structure member (usually connected_rope_1) is the index of the rope part and the other is -1) )In TIM 2 and 3, the &amp;quot;remote bomb&amp;quot; part actually corresponds to two entries in the puzzle file. The connected_rope_2 field contains the index of the another &amp;quot;element&amp;quot; of the bomb, in both entries.&lt;br /&gt;
* &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: These structure members are only meaningful for electric outlet parts. Electric outlets always have 2 &amp;quot;sockets&amp;quot; for parts requiring electricity. It contains the index/indices of the part/parts plugged into the electric outlet, or -1 if the &amp;quot;socket&amp;quot; is free. If the part does not support this, both values are -1.&lt;br /&gt;
&lt;br /&gt;
=== Belts ===&lt;br /&gt;
&lt;br /&gt;
Belt parts (part 8) (except in the demo version of TIM, see below) use a 52-byte entry, with the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 8 for belts */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  INT16LE belt_connected_part_1;&lt;br /&gt;
  INT16LE belt_connected_part_2;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  UINT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x40&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, belts have no true sprite (represented by two lines).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for belts, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039; In TIM / TEMIM, either 0 or -1. In TIM 2, -1 or -100 (0xff9c). Meaning of these numbers is unclear, and the usage of the two different values do not correlate with the flags.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Always 1, perhaps indicates that the part is a belt.&lt;br /&gt;
* &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;belt_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this belt. In TIM and TEMIM, both are -1 if the belt is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;, &#039;&#039;&#039;unknown_40&#039;&#039;&#039;, &#039;&#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Ropes ===&lt;br /&gt;
&lt;br /&gt;
Rope parts (part 10) (except in the demo version of TIM, see below) use a 54-byte entry. TIM 2 and 3 also have a &amp;quot;steel cable&amp;quot; part (part 76) which also behaves as a rope and the size of the part entry is also identical. The rope part entry has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 10 for rope, 76 for steel cable */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE rope_segment_length;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  INT16LE rope_connected_part_1;&lt;br /&gt;
  INT16LE rope_connected_part_2;&lt;br /&gt;
  BYTE part_1_connect_field_usage;&lt;br /&gt;
  BYTE part_2_connect_field_usage;&lt;br /&gt;
  UINT16LE unknown_44;&lt;br /&gt;
  UINT16LE unknown_46;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039;: Same flags used as in the belt part structure.&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, ropes have no true sprite (represented by one or more line segments).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for ropes, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: Similarly to belts, possible values are 0 and -1 in TIM / TEMIM; and -1 and -100 in TIM 2 / 3.&lt;br /&gt;
* &#039;&#039;&#039;rope_segment_length&#039;&#039;&#039;: The length of the rope (Euclidean distance between the two ends) if the rope does not run through pulleys. Otherwise, the length of the rope segment between the part at one end (rope_connected_part_1 (?)) and the first pulley ({{TODO|additional testing needed}}).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for pulleys.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;rope_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this rope (never the pulleys). In TIM and TEMIM, both are -1 if the rope is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;part_1_connect_field_usage&#039;&#039;&#039;, &#039;&#039;&#039;part_2_connect_field_usage&#039;&#039;&#039;: Whether &#039;&#039;connected_1&#039;&#039; or &#039;&#039;connected_2&#039;&#039; is used in the two connected parts for this rope. 0 if connected_1, 1 if connected_2. ({{TODO|additional testing needed}})&lt;br /&gt;
* &#039;&#039;&#039;unknown_44&#039;&#039;&#039;, &#039;&#039;&#039;unknown_46&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Pulleys ===&lt;br /&gt;
&lt;br /&gt;
The format of the 56-byte puzzle part entry for the pulley (part 7):&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 7 for pulley */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_y;&lt;br /&gt;
  INT16LE unknown_36;&lt;br /&gt;
  INT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE pulley_connected_1;&lt;br /&gt;
  INT16LE pulley_connected_2;&lt;br /&gt;
  INT16LE unknown_50;&lt;br /&gt;
  INT16LE unknown_52;&lt;br /&gt;
  INT16LE rope_index;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x8&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;0x0&amp;lt;/code&amp;gt; {{TODO|in some cases}})&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x48&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Pulleys can have four different sprites depending on the orientation. Possible values are 0-3.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: The size of the pulley sprite. In TIM 2 / 3, also depends on the orientation.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the pulley, top left coordinates of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;, &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for ropes.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where one rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Depends on the orientation of the pulley, like &#039;&#039;appearance&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;unknown_40&#039;&#039;, &#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_2_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where the other rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;pulley_connected_1&#039;&#039;&#039;, &#039;&#039;&#039;pulley_connected_2&#039;&#039;&#039;: Either the index of part at one of the two ends of the rope, or the index of next or previous pulley the rope is running through.&lt;br /&gt;
* &#039;&#039;&#039;unknown_50&#039;&#039;&#039;, &#039;&#039;&#039;unknown_52&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;rope_index&#039;&#039;&#039;: In TIM 2 / 3, the index of the rope part. Not used (-1) in TIM and TEMIM.&lt;br /&gt;
&lt;br /&gt;
=== Programmable ball (TIM 2 / 3) ===&lt;br /&gt;
&lt;br /&gt;
The programmable ball part is present in TIM 2 and 3, and its part type number is 87. The size of the entry is 60 bytes in total. The first 48 bytes is the same as the default part data structure, which is followed by another, 12-byte structure specific to this part. The format of the programmable ball data is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE density;&lt;br /&gt;
  UINT16LE elasticity;&lt;br /&gt;
  UINT16LE friction;&lt;br /&gt;
  INT16LE gravity_buoyancy;&lt;br /&gt;
  UINT16LE mass;&lt;br /&gt;
  UINT16LE appearance_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;density&#039;&#039;&#039;: The density of the ball, affects the buoyant force acting on the ball.&lt;br /&gt;
* &#039;&#039;&#039;elasticity&#039;&#039;&#039;: The elasticity of the ball.&lt;br /&gt;
* &#039;&#039;&#039;friction&#039;&#039;&#039;: The friction.&lt;br /&gt;
* &#039;&#039;&#039;gravity_buoyancy&#039;&#039;&#039;: A calculated parameter, using the density and the mass of the ball, as well as the gravity and the pressure set for the puzzle. If its value is negative, the ball will rise due to the buoyant force rather than fall.&lt;br /&gt;
* &#039;&#039;&#039;mass&#039;&#039;&#039;: The mass of the ball.&lt;br /&gt;
* &#039;&#039;&#039;appearance_2&#039;&#039;&#039;: Has the same value as the &#039;&#039;appearance&#039;&#039; field. The ball can have 7 different colors/patterns.&lt;br /&gt;
&lt;br /&gt;
The game has a dialog for setting the four physical properties (mass, elasticity, density, friction, in this order). However, the number stored in the data structure is not the same as the numbers shown on the program dialog. For example, if following settings are used for the ball: &amp;lt;code&amp;gt;mass = 8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 3&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;density = 7&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 3&amp;lt;/code&amp;gt;; and the default values are used for gravity/pressure, the puzzle file will contain the following values: &amp;lt;code&amp;gt;density = 3000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 128&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 16&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;gravity_buoyancy = 269&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mass = 201&amp;lt;/code&amp;gt;. (Note: There is an inconsistency in the game here, the programmable ball part uses &amp;lt;code&amp;gt;density = 2832&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mass = 200&amp;lt;/code&amp;gt; by default, which does not correspond exactly to any value that can be set in the dialog.)&lt;br /&gt;
&lt;br /&gt;
=== TIM demo version ===&lt;br /&gt;
&lt;br /&gt;
In the demo version of the (original) TIM (available at several DOS shareware game websites), the &#039;&#039;flags_3&#039;&#039;, &#039;&#039;outlet_plugged_1&#039;&#039; and &#039;&#039;outlet_plugged_2&#039;&#039; fields are missing.&lt;br /&gt;
Instead, the 42-byte part data (46 for belts, 48 for ropes, 50 for pulleys) is followed by an another, variable length data structure of unknown significance consisting of 16-bit little endian integers. It is always at least 2 bytes long, and the first two bytes contain the number of additional 16-bit words after this size word. The reverse engineering of this structure is complicated by the fact that it is only present in a demo version containing only 8 puzzles.&lt;br /&gt;
&lt;br /&gt;
== Puzzle solution information ==&lt;br /&gt;
&lt;br /&gt;
Puzzle solution information is only present in TIM 2 and TIM 3 puzzles. Its size is always 132 bytes and can contain 8 different conditions that must be satisfied so that the game will recognize the puzzle as solved. The first two bytes contains the number of such conditions actually set, in a 16-bit little endian format. This is followed by 8 entries, 16 bytes each, containing the required information for solution checking by the game. The format of each entry is:&lt;br /&gt;
&lt;br /&gt;
  INT16LE part_index;&lt;br /&gt;
  UINT16LE part_state_1;&lt;br /&gt;
  UINT16LE part_state_2;&lt;br /&gt;
  UINT16LE part_count;&lt;br /&gt;
  INT16LE position_rect_x;&lt;br /&gt;
  INT16LE position_rect_y;&lt;br /&gt;
  INT16LE position_rect_width;&lt;br /&gt;
  INT16LE position_rect_height;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_index&#039;&#039;&#039;: The index of the part in the puzzle file involved in the solution. -1 (0xFF 0xFF) for unused entries.&lt;br /&gt;
* &#039;&#039;&#039;part_state_1&#039;&#039;&#039;: An ID for a &amp;quot;physical state&amp;quot; of a part (for example a balloon was popped or a candle was lit). In many puzzles, one specific part must be in a specified &amp;quot;physical state&amp;quot; in order to complete the level. This is the same ID for a &amp;quot;part state&amp;quot; as the &#039;&#039;first_frame_id&#039;&#039; member found in the C section of the part&#039;s ANM file.&lt;br /&gt;
* &#039;&#039;&#039;part_state_2&#039;&#039;&#039;: Another ID for a &amp;quot;physical state&amp;quot;, the exact meaning is unclear.&lt;br /&gt;
* &#039;&#039;&#039;part_count&#039;&#039;&#039;: The value of the &amp;quot;Part count&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_x&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_y&#039;&#039;&#039;: The top left corner of the &amp;quot;position rectangle&amp;quot;. If such a solution specified puzzle part must be located within this rectangle in order to solve the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_width&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_height&#039;&#039;&#039;: Width and height of the &amp;quot;position rectangle&amp;quot;, see above.&lt;br /&gt;
&lt;br /&gt;
For the last four members (&amp;quot;position rectangle&amp;quot;), there are &amp;quot;fixed&amp;quot; combinations of values with special meaning:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-1, -1, -1, -1&amp;lt;/code&amp;gt;: &amp;quot;Off screen&amp;quot;, the part must leave the area visible on the game screen.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, -2000, 1640, 2000&amp;lt;/code&amp;gt;: &amp;quot;Off top&amp;quot;, the part must leave the visible area at the top.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, 400, 1640, 3000&amp;lt;/code&amp;gt;: &amp;quot;Off bottom&amp;quot;&lt;br /&gt;
* &amp;lt;code&amp;gt;0, 0, 0, 0&amp;lt;/code&amp;gt;: No such solution programmed, either this is &amp;quot;part state&amp;quot; solution or an unused entry (&amp;lt;code&amp;gt;part_index = -1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The last 2 bytes of the section contain the value of the &amp;quot;Delay&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game, in 16-bit little endian format.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note on puzzle solution information in TIM and TEMIM&#039;&#039;&#039;: TIM / TEMIM puzzles do not contain such data. This can also be demonstrated by extracting e.g. &amp;lt;tt&amp;gt;L1.LEV&amp;lt;/tt&amp;gt; from the archive file and rename the file to change the number. After starting the game, the level with the same number as the renamed file will be replaced with level 1. When playing the modified level, the game will not be able to check whether the puzzle is solved. Depending on its number, the level can become unwinnable or winnable by just clicking on the start machine button. Sometimes the game freezes.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
{{BeginFileFormatTools|Type=map}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [https://codeberg.org/knt47/timgres The Incredible Machine level/image resource viewer] ([https://www.vogons.org/viewtopic.php?p=1089143#p1089143 VOGONS]) &lt;br /&gt;
| Platform = Windows, Linux&lt;br /&gt;
| canView = Yes&lt;br /&gt;
&amp;lt;!-- | canExport = Yes --&amp;gt;&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes = &lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10613</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10613"/>
		<updated>2022-07-23T09:10:10Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Puzzle part data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar. Level files have the extension &amp;lt;tt&amp;gt;.LEV&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. Such files are saved by the game with extension &amp;lt;tt&amp;gt;.TIM&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 00 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;EF AC 12 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;). An empty string in .GKC files with magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
Hints are supported only in TIM 2 and 3 puzzles. The first two bytes of the hint data contain the number of the hints in 16-bit little endian format. This is followed by 8 hint entries, some of them may be unused. A size of an unused entry is 7 bytes. One entry consists of three 16-bit integers and a null-terminated string containing the hint text. The three integer members are (all have a 16-bit little endian format):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;position_x&#039;&#039;&#039;: The X position of the hand icon for the hint.&lt;br /&gt;
* &#039;&#039;&#039;position_y&#039;&#039;&#039;: The Y position.&lt;br /&gt;
* &#039;&#039;&#039;hint_icon_flip&#039;&#039;&#039;: The hand icon of a hint can be flipped and can have four different orientations. Possible values are 0-3.&lt;br /&gt;
&lt;br /&gt;
In TIM 2, there are 3 (?) puzzles with magic number &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;. Neither of these files contain hints. However, the size of the empty hints section is 42 bytes in them instead of the expected 58.&lt;br /&gt;
&lt;br /&gt;
== Puzzle information data structure ==&lt;br /&gt;
&lt;br /&gt;
=== In TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
In TIM and TEMIM, there are two different puzzle header information data structures, one is used by the puzzles, and the another is found in saved &amp;quot;freeform&amp;quot; machines and the GKC files.&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM / TEMIM puzzles:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] bonus_1;&lt;br /&gt;
  UINT16LE bonus_2;&lt;br /&gt;
  [[INT16LE]] pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  INT16LE unknown_8;&lt;br /&gt;
  INT16LE unknown_10;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
The information structure format in saved &amp;quot;freeform&amp;quot; machines and GKC files:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bonus_1&#039;&#039;&#039;: The value of &amp;quot;Bonus 1&amp;quot; immediately after the puzzle is loaded (its value is constantly decreasing while the player is solving the puzzle).&lt;br /&gt;
* &#039;&#039;&#039;bonus_2&#039;&#039;&#039;: The value of &amp;quot;Bonus 2&amp;quot; for the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;unknown_8&#039;&#039;&#039;, &#039;&#039;unknown_10&#039;&#039;: The value of these two members is always -8. Perhaps the top left corner of the screen in the coordinate system used for puzzle parts, which is also (-8, -8).&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1001-1016 for TIM and 1001-1021 for TEMIM.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move (e.g. walls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that move (e.g. balls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_in_partsbin&#039;&#039;&#039;: The number of parts that are placed into the parts bin. (The player needs to position them in order to solve the puzzle.)&lt;br /&gt;
&lt;br /&gt;
=== In TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM 2 and 3:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE unknown_4;&lt;br /&gt;
  UINT16LE unknown_6;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE unknown_14;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1000-1023.&lt;br /&gt;
* &#039;&#039;&#039;unknown_4&#039;&#039;&#039;, &#039;&#039;&#039;unknown_6&#039;&#039;&#039;: Meaning is unknown, always 0.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move, regardless of whether they are placed initially into the parts bin or not.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that can move.&lt;br /&gt;
* &#039;&#039;&#039;unknown_14&#039;&#039;&#039;: Value is always 0. Likely this member corresponds to num_parts_in_partsbin in TIM / TEMIM puzzle header. Unlike TIM / TEMIM, parts placed into the parts bin are not a separate section in TIM 2 / 3, therefore, its value is always zero.&lt;br /&gt;
&lt;br /&gt;
== Puzzle part data ==&lt;br /&gt;
&lt;br /&gt;
With the exception of TIM demo version (see below), the size of a part entry for the majority of puzzle parts is 48 bytes. However, there are exceptions, which are discussed in separate sub-sections. The format of the &amp;quot;default&amp;quot; part entry:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  [[BYTE]] belt_connect_pos_x;&lt;br /&gt;
  BYTE belt_connect_pos_y;&lt;br /&gt;
  UINT16LE belt_line_distance;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE rope_1_connect_pos_x;&lt;br /&gt;
  BYTE rope_1_connect_pos_y;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  BYTE rope_2_connect_pos_x;&lt;br /&gt;
  BYTE rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_type_num&#039;&#039;&#039;: A number associated with the type of the part (e.g. 0 - bowling ball). Required for identifying parts with an entry size different from the default. See [[The Incredible Machine Level Format/Part Numbers]]&lt;br /&gt;
* &#039;&#039;&#039;flags_1&#039;&#039;&#039;: A combination of flag bits.&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039; uses the following flag bits:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: Unknown meaning, used for a few &amp;quot;moving&amp;quot; parts (bucket, candle)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Set if the part is a wall.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x800&amp;lt;/code&amp;gt;: Part is placed initially into the parts bin (see num_parts_in_partsbin in part information data structure)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x4000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position (see &#039;&#039;num_parts_fixed&#039;&#039;)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: Set when 0x800 is not set ({{TODO|further testing needed}})&lt;br /&gt;
** In &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;, the bits have a known meaning:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Meaning unclear, used for &amp;quot;moving&amp;quot; parts only, but not always set, even for a single type of part.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, affected by gravity.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;, 0x4000: Used in combination for parts that do not move and are not affected by gravity.&lt;br /&gt;
* &#039;&#039;&#039;flags_2&#039;&#039;&#039;: Another word containing flag bits. The meaning of most flags is the same in all game versions.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: A belt can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: A belt is connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: A rope can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: A second rope can be connected to the part (teeter-totter)&lt;br /&gt;
** &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;: The part sprite is drawn horizontally flipped.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: The part sprite is drawn vertically flipped. Note on flip flags: Flipping a part in the game does not necessarily mean that one of the flip flags will be changed. For several parts, especially in TIM 2 / 3, flipping will affect the value of the &#039;&#039;appearance&#039;&#039; member.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Probably unused&lt;br /&gt;
** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Part can be stretched in at least one direction: inclines, conveyor belt, walls.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: Parts that can be stretched both horizontally and vertically, the walls.&lt;br /&gt;
* &#039;&#039;&#039;flags_3&#039;&#039;&#039;: Some flags are only present in TIM 2 / 3. This member of the part data structure is missing in the demo version of TIM.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: The part can be plugged into an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: The part is an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: The part can burn (e.g. candle) or has a fuse that can be lit (e.g. dynamite, cannon). Usually in combination with flag 0x8. &lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: Meaning of this flag is unclear. Used for several part types, but changing it has no apparent consequence (?) &lt;br /&gt;
** Flags present only in &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Part is &amp;quot;locked&amp;quot;, i.e not placed into the part bin.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Sizable scenery part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: {{TODO|unknown meaning}}&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: A &amp;quot;program&amp;quot; icon is shown for the part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: Scenery part&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Wall part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: A &amp;quot;Puzzle solution&amp;quot; icon is shown for the part (?)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: An identifier for the sprite that is shown for a part before the machine is started. (Once the machine is started, the state of the part can change and so can the sprite shown.) The meaning is different between TIM and TIM 2. In TIM, the sprite of some parts consists of only one image, in this case, this is often the number of the sub-image in the [[The Incredible Machine Image Format|image resource file]]. ({{TODO|For other parts, this is probably an internal identifier for the sprite (?)}}). In TIM 2 and 3, the meaning of the appearance is an index in the A section of the [[The Incredible Machine 2-3 ANM File Format|.ANM file]] for the part, or if this is absent, an index in the B section. &amp;quot;Programming&amp;quot; a part in TIM 2 and 3 often results in the change of this field.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;: The width and height of the selectable area of the part ({{TODO|more reverse engineering work needed}})&lt;br /&gt;
* &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: At least in TIM 2, witdh_2 is used for calculating the position of part sprite when the part is flipped because of the horizontal flip bit is set in flags_2.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the part, usually the top left corner of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: In TIM 2 and 3, a programmed behavior of the part. (However, for many parts, &amp;quot;programming&amp;quot; modifies the &#039;&#039;appearance&#039;&#039; member.) For example the number of shots of the phazer gun or character shown by the message computer.  Meaning is different for rope parts, see below. Unused in TIM and TEMIM (except for ropes).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Probably unused, usually 0. Note that belt parts have a value of 1 in this position.&lt;br /&gt;
* &#039;&#039;&#039;belt_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;belt_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Always positive or 0, because &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039; are the coordinates of the top left corner where the sprite starts. Note that the formulas required for calculating the exact position of the belt are slightly different between TIM and TIM 2. Parts for which connection of a belt is allowed have a distinct circular area in their sprite, corresponding to the location where the belt is connected. In TIM / TEMIM, &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; is approximately the top left corner of its bounding rectangle, while in TIM 2 /3 it is close to the center of the circle.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_line_distance&#039;&#039;&#039;: The belts in the game appear as two, usually not perfectly parallel black (TIM / TEMIM) or gray (TIM 2 / 3) lines. This parameter determines the distance between the two segments, More precisely, it is either approximately the diameter of the circular area mentioned at &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; (TIM / TEMIM) or its radius (TIM 2 / 3).&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Similarly to belt_connect_pos_x/y, always positive or 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_2_connect_pos_y&#039;&#039;&#039;: The same as &#039;&#039;rope_1_connect_pos_x&#039;&#039;, &#039;&#039;rope_1_connect_pos_y&#039;&#039;, bit for another connected rope part.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;: The index of one or two parts in the puzzle that are connected to this part with a rope. If the rope runs through pulleys, this is the part index of the first pulley. If no rope is connected or this is not possible for the part, the value of both structure members are -1. (Of course, if one rope is connected, the value of one structure member (usually connected_rope_1) is the index of the rope part and the other is -1) )In TIM 2 and 3, the &amp;quot;remote bomb&amp;quot; part actually corresponds to two entries in the puzzle file. The connected_rope_2 field contains the index of the another &amp;quot;element&amp;quot; of the bomb, in both entries.&lt;br /&gt;
* &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: These structure members are only meaningful for electric outlet parts. Electric outlets always have 2 &amp;quot;sockets&amp;quot; for parts requiring electricity. It contains the index/indices of the part/parts plugged into the electric outlet, or -1 if the &amp;quot;socket&amp;quot; is free. If the part does not support this, both values are -1.&lt;br /&gt;
&lt;br /&gt;
=== Belts ===&lt;br /&gt;
&lt;br /&gt;
Belt parts (part 8) (except in the demo version of TIM, see below) use a 52-byte entry, with the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 8 for belts */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  INT16LE belt_connected_part_1;&lt;br /&gt;
  INT16LE belt_connected_part_2;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  UINT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x40&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, belts have no true sprite (represented by two lines).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for belts, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039; In TIM / TEMIM, either 0 or -1. In TIM 2, -1 or -100 (0xff9c). Meaning of these numbers is unclear, and the usage of the two different values do not correlate with the flags.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Always 1, perhaps indicates that the part is a belt.&lt;br /&gt;
* &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;belt_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this belt. In TIM and TEMIM, both are -1 if the belt is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;, &#039;&#039;&#039;unknown_40&#039;&#039;&#039;, &#039;&#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Ropes ===&lt;br /&gt;
&lt;br /&gt;
Rope parts (part 10) (except in the demo version of TIM, see below) use a 54-byte entry. TIM 2 and 3 also have a &amp;quot;steel cable&amp;quot; part (part 76) which also behaves as a rope and the size of the part entry is also identical. The rope part entry has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 10 for rope, 76 for steel cable */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE rope_segment_length;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  INT16LE rope_connected_part_1;&lt;br /&gt;
  INT16LE rope_connected_part_2;&lt;br /&gt;
  BYTE part_1_connect_field_usage;&lt;br /&gt;
  BYTE part_2_connect_field_usage;&lt;br /&gt;
  UINT16LE unknown_44;&lt;br /&gt;
  UINT16LE unknown_46;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039;: Same flags used as in the belt part structure.&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, ropes have no true sprite (represented by one or more line segments).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for ropes, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: Similarly to belts, possible values are 0 and -1 in TIM / TEMIM; and -1 and -100 in TIM 2 / 3.&lt;br /&gt;
* &#039;&#039;&#039;rope_segment_length&#039;&#039;&#039;: The length of the rope (Euclidean distance between the two ends) if the rope does not run through pulleys. Otherwise, the length of the rope segment between the part at one end (rope_connected_part_1 (?)) and the first pulley ({{TODO|additional testing needed}}).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for pulleys.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;rope_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this rope (never the pulleys). In TIM and TEMIM, both are -1 if the rope is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;part_1_connect_field_usage&#039;&#039;&#039;, &#039;&#039;&#039;part_2_connect_field_usage&#039;&#039;&#039;: Whether &#039;&#039;connected_1&#039;&#039; or &#039;&#039;connected_2&#039;&#039; is used in the two connected parts for this rope. 0 if connected_1, 1 if connected_2. ({{TODO|additional testing needed}})&lt;br /&gt;
* &#039;&#039;&#039;unknown_44&#039;&#039;&#039;, &#039;&#039;&#039;unknown_46&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Pulleys ===&lt;br /&gt;
&lt;br /&gt;
The format of the 56-byte puzzle part entry for the pulley (part 7):&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 7 for pulley */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_y;&lt;br /&gt;
  INT16LE unknown_36;&lt;br /&gt;
  INT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE pulley_connected_1;&lt;br /&gt;
  INT16LE pulley_connected_2;&lt;br /&gt;
  INT16LE unknown_50;&lt;br /&gt;
  INT16LE unknown_52;&lt;br /&gt;
  INT16LE rope_index;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x8&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;0x0&amp;lt;/code&amp;gt; {{TODO|in some cases}})&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x48&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Pulleys can have four different sprites depending on the orientation. Possible values are 0-3.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: The size of the pulley sprite. In TIM 2 / 3, also depends on the orientation.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the pulley, top left coordinates of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;, &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for ropes.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where one rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Depends on the orientation of the pulley, like &#039;&#039;appearance&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;unknown_40&#039;&#039;, &#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_2_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where the other rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;pulley_connected_1&#039;&#039;&#039;, &#039;&#039;&#039;pulley_connected_2&#039;&#039;&#039;: Either the index of part at one of the two ends of the rope, or the index of next or previous pulley the rope is running through.&lt;br /&gt;
* &#039;&#039;&#039;unknown_50&#039;&#039;&#039;, &#039;&#039;&#039;unknown_52&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;rope_index&#039;&#039;&#039;: In TIM 2 / 3, the index of the rope part. Not used (-1) in TIM and TEMIM.&lt;br /&gt;
&lt;br /&gt;
=== Programmable ball (TIM 2 / 3) ===&lt;br /&gt;
&lt;br /&gt;
The programmable ball part is present in TIM 2 and 3, and its part type number is 87. The size of the entry is 60 bytes in total. The first 48 bytes is the same as the default part data structure, which is followed by another, 12-byte structure specific to this part. The format of the programmable ball data is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE density;&lt;br /&gt;
  UINT16LE elasticity;&lt;br /&gt;
  UINT16LE friction;&lt;br /&gt;
  INT16LE gravity_buoyancy;&lt;br /&gt;
  UINT16LE mass;&lt;br /&gt;
  UINT16LE appearance_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;density&#039;&#039;&#039;: The density of the ball, affects the buoyant force acting on the ball.&lt;br /&gt;
* &#039;&#039;&#039;elasticity&#039;&#039;&#039;: The elasticity of the ball.&lt;br /&gt;
* &#039;&#039;&#039;friction&#039;&#039;&#039;: The friction.&lt;br /&gt;
* &#039;&#039;&#039;gravity_buoyancy&#039;&#039;&#039;: A calculated parameter, using the density and the mass of the ball, as well as the gravity and the pressure set for the puzzle. If its value is negative, the ball will rise due to the buoyant force rather than fall.&lt;br /&gt;
* &#039;&#039;&#039;mass&#039;&#039;&#039;: The mass of the ball.&lt;br /&gt;
* &#039;&#039;&#039;appearance_2&#039;&#039;&#039;: Has the same value as the &#039;&#039;appearance&#039;&#039; field. The ball can have 7 different colors/patterns.&lt;br /&gt;
&lt;br /&gt;
The game has a dialog for setting the four physical properties (mass, elasticity, density, friction, in this order). However, the number stored in the data structure is not the same as the numbers shown on the program dialog. For example, if following settings are used for the ball: &amp;lt;code&amp;gt;mass = 8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 3&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;density = 7&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 3&amp;lt;/code&amp;gt;; and the default values are used for gravity/pressure, the puzzle file will contain the following values: &amp;lt;code&amp;gt;density = 3000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 128&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 16&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;gravity_buoyancy = 269&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mass = 201&amp;lt;/code&amp;gt;. (Note: There is an inconsistency in the game here, the programmable ball part uses &amp;lt;code&amp;gt;density = 2832&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mass = 200&amp;lt;/code&amp;gt; by default, which does not correspond exactly to any value that can be set in the dialog.)&lt;br /&gt;
&lt;br /&gt;
=== TIM demo version ===&lt;br /&gt;
&lt;br /&gt;
In the demo version of the (original) TIM (available at several DOS shareware game websites), the &#039;&#039;flags_3&#039;&#039;, &#039;&#039;outlet_plugged_1&#039;&#039; and &#039;&#039;outlet_plugged_2&#039;&#039; fields are missing.&lt;br /&gt;
Instead, the 42-byte part data (46 for belts, 48 for ropes, 50 for pulleys) is followed by an another, variable length data structure of unknown significance consisting of 16-bit little endian integers. It is always at least 2 bytes long, and the first two bytes contain the number of additional 16-bit words after this size word. The reverse engineering of this structure is complicated by the fact that it is only present in a demo version containing only 8 puzzles.&lt;br /&gt;
&lt;br /&gt;
== Puzzle solution information ==&lt;br /&gt;
&lt;br /&gt;
Puzzle solution information is only present in TIM 2 and TIM 3 puzzles. Its size is always 132 bytes and can contain 8 different conditions that must be satisfied so that the game will recognize the puzzle as solved. The first two bytes contains the number of such conditions actually set, in a 16-bit little endian format. This is followed by 8 entries, 16 bytes each, containing the required information for solution checking by the game. The format of each entry is:&lt;br /&gt;
&lt;br /&gt;
  INT16LE part_index;&lt;br /&gt;
  UINT16LE part_state_1;&lt;br /&gt;
  UINT16LE part_state_2;&lt;br /&gt;
  UINT16LE part_count;&lt;br /&gt;
  INT16LE position_rect_x;&lt;br /&gt;
  INT16LE position_rect_y;&lt;br /&gt;
  INT16LE position_rect_width;&lt;br /&gt;
  INT16LE position_rect_height;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_index&#039;&#039;&#039;: The index of the part in the puzzle file involved in the solution. -1 (0xFF 0xFF) for unused entries.&lt;br /&gt;
* &#039;&#039;&#039;part_state_1&#039;&#039;&#039;: An ID for a &amp;quot;physical state&amp;quot; of a part (for example a balloon was popped or a candle was lit). In many puzzles, one specific part must be in a specified &amp;quot;physical state&amp;quot; in order to complete the level. This is the same ID for a &amp;quot;part state&amp;quot; as the &#039;&#039;first_frame_id&#039;&#039; member found in the C section of the part&#039;s ANM file.&lt;br /&gt;
* &#039;&#039;&#039;part_state_2&#039;&#039;&#039;: Another ID for a &amp;quot;physical state&amp;quot;, the exact meaning is unclear.&lt;br /&gt;
* &#039;&#039;&#039;part_count&#039;&#039;&#039;: The value of the &amp;quot;Part count&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_x&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_y&#039;&#039;&#039;: The top left corner of the &amp;quot;position rectangle&amp;quot;. If such a solution specified puzzle part must be located within this rectangle in order to solve the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_width&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_height&#039;&#039;&#039;: Width and height of the &amp;quot;position rectangle&amp;quot;, see above.&lt;br /&gt;
&lt;br /&gt;
For the last four members (&amp;quot;position rectangle&amp;quot;), there are &amp;quot;fixed&amp;quot; combinations of values with special meaning:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-1, -1, -1, -1&amp;lt;/code&amp;gt;: &amp;quot;Off screen&amp;quot;, the part must leave the area visible on the game screen.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, -2000, 1640, 2000&amp;lt;/code&amp;gt;: &amp;quot;Off top&amp;quot;, the part must leave the visible area at the top.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, 400, 1640, 3000&amp;lt;/code&amp;gt;: &amp;quot;Off bottom&amp;quot;&lt;br /&gt;
* &amp;lt;code&amp;gt;0, 0, 0, 0&amp;lt;/code&amp;gt;: No such solution programmed, either this is &amp;quot;part state&amp;quot; solution or an unused entry (&amp;lt;code&amp;gt;part_index = -1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The last 2 bytes of the section contain the value of the &amp;quot;Delay&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game, in 16-bit little endian format.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note on puzzle solution information in TIM and TEMIM&#039;&#039;&#039;: TIM / TEMIM puzzles do not contain such data. This can also be demonstrated by extracting e.g. &amp;lt;tt&amp;gt;L1.LEV&amp;lt;/tt&amp;gt; from the archive file and rename the file to change the number. After starting the game, the level with the same number as the renamed file will be replaced with level 1. When playing the modified level, the game will not be able to check whether the puzzle is solved. Depending on its number, the level can become unwinnable or winnable by just clicking on the start machine button. Sometimes the game freezes.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
{{BeginFileFormatTools|Type=map}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [https://www.vogons.org/viewtopic.php?p=1089143#p1089143 The Incredible Machine level/image resource viewer] &lt;br /&gt;
| Platform = Windows, Linux&lt;br /&gt;
| canView = Yes&lt;br /&gt;
&amp;lt;!-- | canExport = Yes --&amp;gt;&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes = &lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10612</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10612"/>
		<updated>2022-07-23T07:37:36Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Puzzle part data */ image format link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar. Level files have the extension &amp;lt;tt&amp;gt;.LEV&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. Such files are saved by the game with extension &amp;lt;tt&amp;gt;.TIM&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 00 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;EF AC 12 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;). An empty string in .GKC files with magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
Hints are supported only in TIM 2 and 3 puzzles. The first two bytes of the hint data contain the number of the hints in 16-bit little endian format. This is followed by 8 hint entries, some of them may be unused. A size of an unused entry is 7 bytes. One entry consists of three 16-bit integers and a null-terminated string containing the hint text. The three integer members are (all have a 16-bit little endian format):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;position_x&#039;&#039;&#039;: The X position of the hand icon for the hint.&lt;br /&gt;
* &#039;&#039;&#039;position_y&#039;&#039;&#039;: The Y position.&lt;br /&gt;
* &#039;&#039;&#039;hint_icon_flip&#039;&#039;&#039;: The hand icon of a hint can be flipped and can have four different orientations. Possible values are 0-3.&lt;br /&gt;
&lt;br /&gt;
In TIM 2, there are 3 (?) puzzles with magic number &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;. Neither of these files contain hints. However, the size of the empty hints section is 42 bytes in them instead of the expected 58.&lt;br /&gt;
&lt;br /&gt;
== Puzzle information data structure ==&lt;br /&gt;
&lt;br /&gt;
=== In TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
In TIM and TEMIM, there are two different puzzle header information data structures, one is used by the puzzles, and the another is found in saved &amp;quot;freeform&amp;quot; machines and the GKC files.&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM / TEMIM puzzles:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] bonus_1;&lt;br /&gt;
  UINT16LE bonus_2;&lt;br /&gt;
  [[INT16LE]] pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  INT16LE unknown_8;&lt;br /&gt;
  INT16LE unknown_10;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
The information structure format in saved &amp;quot;freeform&amp;quot; machines and GKC files:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bonus_1&#039;&#039;&#039;: The value of &amp;quot;Bonus 1&amp;quot; immediately after the puzzle is loaded (its value is constantly decreasing while the player is solving the puzzle).&lt;br /&gt;
* &#039;&#039;&#039;bonus_2&#039;&#039;&#039;: The value of &amp;quot;Bonus 2&amp;quot; for the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;unknown_8&#039;&#039;&#039;, &#039;&#039;unknown_10&#039;&#039;: The value of these two members is always -8. Perhaps the top left corner of the screen in the coordinate system used for puzzle parts, which is also (-8, -8).&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1001-1016 for TIM and 1001-1021 for TEMIM.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move (e.g. walls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that move (e.g. balls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_in_partsbin&#039;&#039;&#039;: The number of parts that are placed into the parts bin. (The player needs to position them in order to solve the puzzle.)&lt;br /&gt;
&lt;br /&gt;
=== In TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM 2 and 3:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE unknown_4;&lt;br /&gt;
  UINT16LE unknown_6;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE unknown_14;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1000-1023.&lt;br /&gt;
* &#039;&#039;&#039;unknown_4&#039;&#039;&#039;, &#039;&#039;&#039;unknown_6&#039;&#039;&#039;: Meaning is unknown, always 0.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move, regardless of whether they are placed initially into the parts bin or not.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that can move.&lt;br /&gt;
* &#039;&#039;&#039;unknown_14&#039;&#039;&#039;: Value is always 0. Likely this member corresponds to num_parts_in_partsbin in TIM / TEMIM puzzle header. Unlike TIM / TEMIM, parts placed into the parts bin are not a separate section in TIM 2 / 3, therefore, its value is always zero.&lt;br /&gt;
&lt;br /&gt;
== Puzzle part data ==&lt;br /&gt;
&lt;br /&gt;
As already discussed in the With the exception of TIM demo version (see below), the size of a part entry for the majority of puzzle parts is 48 bytes. However, there are exceptions, which are discussed in separate sub-sections. The format of the &amp;quot;default&amp;quot; part entry:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  [[BYTE]] belt_connect_pos_x;&lt;br /&gt;
  BYTE belt_connect_pos_y;&lt;br /&gt;
  UINT16LE belt_line_distance;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE rope_1_connect_pos_x;&lt;br /&gt;
  BYTE rope_1_connect_pos_y;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  BYTE rope_2_connect_pos_x;&lt;br /&gt;
  BYTE rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_type_num&#039;&#039;&#039;: A number associated with the type of the part (e.g. 0 - bowling ball). Required for identifying parts with an entry size different from the default. See [[The Incredible Machine Level Format/Part Numbers]]&lt;br /&gt;
* &#039;&#039;&#039;flags_1&#039;&#039;&#039;: A combination of flag bits.&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039; uses the following flag bits:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: Unknown meaning, used for a few &amp;quot;moving&amp;quot; parts (bucket, candle)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Set if the part is a wall.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x800&amp;lt;/code&amp;gt;: Part is placed initially into the parts bin (see num_parts_in_partsbin in part information data structure)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x4000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position (see &#039;&#039;num_parts_fixed&#039;&#039;)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: Set when 0x800 is not set ({{TODO|further testing needed}})&lt;br /&gt;
** In &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;, the bits have a known meaning:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Meaning unclear, used for &amp;quot;moving&amp;quot; parts only, but not always set, even for a single type of part.***&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, affected by gravity.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;, 0x4000: Used in combination for parts that do not move and are not affected by gravity.&lt;br /&gt;
* &#039;&#039;&#039;flags_2&#039;&#039;&#039;: Another word containing flag bits. The meaning of most flags is the same in all game versions.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: A belt can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: A belt is connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: A rope can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: A second rope can be connected to the part (teeter-totter)&lt;br /&gt;
** &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;: The part sprite is drawn horizontally flipped.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: The part sprite is drawn vertically flipped. Note on flip flags: Flipping a part in the game does not necessarily mean that one of the flip flags will be changed. For several parts, especially in TIM 2 / 3, flipping will affect the value of the &#039;&#039;appearance&#039;&#039; member.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Probably unused&lt;br /&gt;
** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Part can be stretched in at least one direction: inclines, conveyor belt, walls.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: Parts that can be stretched both horizontally and vertically, the walls.&lt;br /&gt;
* &#039;&#039;&#039;flags_3&#039;&#039;&#039;: Some flags are only present in TIM 2 / 3. This member of the part data structure is missing in the demo version of TIM.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: The part can be plugged into an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: The part is an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: The part can burn (e.g. candle) or has a fuse that can be lit (e.g. dynamite, cannon). Usually in combination with flag 0x8. &lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: Meaning of this flag is unclear. Used for several part types, but changing it has no apparent consequence (?) &lt;br /&gt;
** Flags present only in &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Part is &amp;quot;locked&amp;quot;, i.e not placed into the part bin.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Sizable scenery part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: {{TODO|unknown meaning}}&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: A &amp;quot;program&amp;quot; icon is shown for the part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: Scenery part&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Wall part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: A &amp;quot;Puzzle solution&amp;quot; icon is shown for the part (?)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: An identifier for the sprite that is shown for a part before the machine is started. (Once the machine is started, the state of the part can change and so can the sprite shown.) The meaning is different between TIM and TIM 2. In TIM, the sprite of some parts consists of only one image, in this case, this is often the number of the sub-image in the [[The Incredible Machine Image Format|image resource file]]. ({{TODO|For other parts, this is probably an internal identifier for the sprite (?)}}). In TIM 2 and 3, the meaning of the appearance is an index in the A section of the [[The Incredible Machine 2-3 ANM File Format|.ANM file]] for the part, or if this is absent, an index in the B section. &amp;quot;Programming&amp;quot; a part in TIM 2 and 3 often results in the change of this field.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;: The width and height of the selectable area of the part ({{TODO|more reverse engineering work needed}})&lt;br /&gt;
* &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: At least in TIM 2, witdh_2 is used for calculating the position of part sprite when the part is flipped because of the horizontal flip bit is set in flags_2.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the part, usually the top left corner of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: In TIM 2 and 3, a programmed behavior of the part. (However, for many parts, &amp;quot;programming&amp;quot; modifies the &#039;&#039;appearance&#039;&#039; member.) For example the number of shots of the phazer gun or character shown by the message computer.  Meaning is different for rope parts, see below. Unused in TIM and TEMIM (except for ropes).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Probably unused, usually 0. Note that belt parts have a value of 1 in this position.&lt;br /&gt;
* &#039;&#039;&#039;belt_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;belt_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Always positive or 0, because &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039; are the coordinates of the top left corner where the sprite starts. Note that the formulas required for calculating the exact position of the belt are slightly different between TIM and TIM 2. Parts for which connection of a belt is allowed have a distinct circular area in their sprite, corresponding to the location where the belt is connected. In TIM / TEMIM, &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; is approximately the top left corner of its bounding rectangle, while in TIM 2 /3 it is close to the center of the circle.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_line_distance&#039;&#039;&#039;: The belts in the game appear as two, usually not perfectly parallel black (TIM / TEMIM) or gray (TIM 2 / 3) lines. This parameter determines the distance between the two segments, More precisely, it is either approximately the diameter of the circular area mentioned at &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; (TIM / TEMIM) or its radius (TIM 2 / 3).&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Similarly to belt_connect_pos_x/y, always positive or 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_2_connect_pos_y&#039;&#039;&#039;: The same as &#039;&#039;rope_1_connect_pos_x&#039;&#039;, &#039;&#039;rope_1_connect_pos_y&#039;&#039;, bit for another connected rope part.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;: The index of one or two parts in the puzzle that are connected to this part with a rope. If the rope runs through pulleys, this is the part index of the first pulley. If no rope is connected or this is not possible for the part, the value of both structure members are -1. (Of course, if one rope is connected, the value of one structure member (usually connected_rope_1) is the index of the rope part and the other is -1) )In TIM 2 and 3, the &amp;quot;remote bomb&amp;quot; part actually corresponds to two entries in the puzzle file. The connected_rope_2 field contains the index of the another &amp;quot;element&amp;quot; of the bomb, in both entries.&lt;br /&gt;
* &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: These structure members are only meaningful for electric outlet parts. Electric outlets always have 2 &amp;quot;sockets&amp;quot; for parts requiring electricity. It contains the index/indices of the part/parts plugged into the electric outlet, or -1 if the &amp;quot;socket&amp;quot; is free. If the part does not support this, both values are -1.&lt;br /&gt;
&lt;br /&gt;
=== Belts ===&lt;br /&gt;
&lt;br /&gt;
Belt parts (part 8) (except in the demo version of TIM, see below) use a 52-byte entry, with the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 8 for belts */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  INT16LE belt_connected_part_1;&lt;br /&gt;
  INT16LE belt_connected_part_2;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  UINT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x40&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, belts have no true sprite (represented by two lines).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for belts, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039; In TIM / TEMIM, either 0 or -1. In TIM 2, -1 or -100 (0xff9c). Meaning of these numbers is unclear, and the usage of the two different values do not correlate with the flags.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Always 1, perhaps indicates that the part is a belt.&lt;br /&gt;
* &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;belt_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this belt. In TIM and TEMIM, both are -1 if the belt is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;, &#039;&#039;&#039;unknown_40&#039;&#039;&#039;, &#039;&#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Ropes ===&lt;br /&gt;
&lt;br /&gt;
Rope parts (part 10) (except in the demo version of TIM, see below) use a 54-byte entry. TIM 2 and 3 also have a &amp;quot;steel cable&amp;quot; part (part 76) which also behaves as a rope and the size of the part entry is also identical. The rope part entry has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 10 for rope, 76 for steel cable */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE rope_segment_length;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  INT16LE rope_connected_part_1;&lt;br /&gt;
  INT16LE rope_connected_part_2;&lt;br /&gt;
  BYTE part_1_connect_field_usage;&lt;br /&gt;
  BYTE part_2_connect_field_usage;&lt;br /&gt;
  UINT16LE unknown_44;&lt;br /&gt;
  UINT16LE unknown_46;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039;: Same flags used as in the belt part structure.&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, ropes have no true sprite (represented by one or more line segments).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for ropes, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: Similarly to belts, possible values are 0 and -1 in TIM / TEMIM; and -1 and -100 in TIM 2 / 3.&lt;br /&gt;
* &#039;&#039;&#039;rope_segment_length&#039;&#039;&#039;: The length of the rope (Euclidean distance between the two ends) if the rope does not run through pulleys. Otherwise, the length of the rope segment between the part at one end (rope_connected_part_1 (?)) and the first pulley ({{TODO|additional testing needed}}).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for pulleys.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;rope_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this rope (never the pulleys). In TIM and TEMIM, both are -1 if the rope is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;part_1_connect_field_usage&#039;&#039;&#039;, &#039;&#039;&#039;part_2_connect_field_usage&#039;&#039;&#039;: Whether &#039;&#039;connected_1&#039;&#039; or &#039;&#039;connected_2&#039;&#039; is used in the two connected parts for this rope. 0 if connected_1, 1 if connected_2. ({{TODO|additional testing needed}})&lt;br /&gt;
* &#039;&#039;&#039;unknown_44&#039;&#039;&#039;, &#039;&#039;&#039;unknown_46&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Pulleys ===&lt;br /&gt;
&lt;br /&gt;
The format of the 56-byte puzzle part entry for the pulley (part 7):&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 7 for pulley */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_y;&lt;br /&gt;
  INT16LE unknown_36;&lt;br /&gt;
  INT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE pulley_connected_1;&lt;br /&gt;
  INT16LE pulley_connected_2;&lt;br /&gt;
  INT16LE unknown_50;&lt;br /&gt;
  INT16LE unknown_52;&lt;br /&gt;
  INT16LE rope_index;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x8&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;0x0&amp;lt;/code&amp;gt; {{TODO|in some cases}})&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x48&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Pulleys can have four different sprites depending on the orientation. Possible values are 0-3.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: The size of the pulley sprite. In TIM 2 / 3, also depends on the orientation.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the pulley, top left coordinates of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;, &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for ropes.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where one rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Depends on the orientation of the pulley, like &#039;&#039;appearance&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;unknown_40&#039;&#039;, &#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_2_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where the other rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;pulley_connected_1&#039;&#039;&#039;, &#039;&#039;&#039;pulley_connected_2&#039;&#039;&#039;: Either the index of part at one of the two ends of the rope, or the index of next or previous pulley the rope is running through.&lt;br /&gt;
* &#039;&#039;&#039;unknown_50&#039;&#039;&#039;, &#039;&#039;&#039;unknown_52&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;rope_index&#039;&#039;&#039;: In TIM 2 / 3, the index of the rope part. Not used (-1) in TIM and TEMIM.&lt;br /&gt;
&lt;br /&gt;
=== Programmable ball (TIM 2 / 3) ===&lt;br /&gt;
&lt;br /&gt;
The programmable ball part is present in TIM 2 and 3, and its part type number is 87. The size of the entry is 60 bytes in total. The first 48 bytes is the same as the default part data structure, which is followed by another, 12-byte structure specific to this part. The format of the programmable ball data is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE density;&lt;br /&gt;
  UINT16LE elasticity;&lt;br /&gt;
  UINT16LE friction;&lt;br /&gt;
  INT16LE gravity_buoyancy;&lt;br /&gt;
  UINT16LE mass;&lt;br /&gt;
  UINT16LE appearance_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;density&#039;&#039;&#039;: The density of the ball, affects the buoyant force acting on the ball.&lt;br /&gt;
* &#039;&#039;&#039;elasticity&#039;&#039;&#039;: The elasticity of the ball.&lt;br /&gt;
* &#039;&#039;&#039;friction&#039;&#039;&#039;: The friction.&lt;br /&gt;
* &#039;&#039;&#039;gravity_buoyancy&#039;&#039;&#039;: A calculated parameter, using the density and the mass of the ball, as well as the gravity and the pressure set for the puzzle. If its value is negative, the ball will rise due to the buoyant force rather than fall.&lt;br /&gt;
* &#039;&#039;&#039;mass&#039;&#039;&#039;: The mass of the ball.&lt;br /&gt;
* &#039;&#039;&#039;appearance_2&#039;&#039;&#039;: Has the same value as the &#039;&#039;appearance&#039;&#039; field. The ball can have 7 different colors/patterns.&lt;br /&gt;
&lt;br /&gt;
The game has a dialog for setting the four physical properties (mass, elasticity, density, friction, in this order). However, the number stored in the data structure is not the same as the numbers shown on the program dialog. For example, if following settings are used for the ball: &amp;lt;code&amp;gt;mass = 8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 3&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;density = 7&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 3&amp;lt;/code&amp;gt;; and the default values are used for gravity/pressure, the puzzle file will contain the following values: &amp;lt;code&amp;gt;density = 3000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 128&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 16&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;gravity_buoyancy = 269&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mass = 201&amp;lt;/code&amp;gt;. (Note: There is an inconsistency in the game here, the programmable ball part uses &amp;lt;code&amp;gt;density = 2832&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mass = 200&amp;lt;/code&amp;gt; by default, which does not correspond exactly to any value that can be set in the dialog.)&lt;br /&gt;
&lt;br /&gt;
=== TIM demo version ===&lt;br /&gt;
&lt;br /&gt;
In the demo version of the (original) TIM (available at several DOS shareware game websites), the &#039;&#039;flags_3&#039;&#039;, &#039;&#039;outlet_plugged_1&#039;&#039; and &#039;&#039;outlet_plugged_2&#039;&#039; fields are missing.&lt;br /&gt;
Instead, the 42-byte part data (46 for belts, 48 for ropes, 50 for pulleys) is followed by an another, variable length data structure of unknown significance consisting of 16-bit little endian integers. It is always at least 2 bytes long, and the first two bytes contain the number of additional 16-bit words after this size word. The reverse engineering of this structure is complicated by the fact that it is only present in a demo version containing only 8 puzzles.&lt;br /&gt;
&lt;br /&gt;
== Puzzle solution information ==&lt;br /&gt;
&lt;br /&gt;
Puzzle solution information is only present in TIM 2 and TIM 3 puzzles. Its size is always 132 bytes and can contain 8 different conditions that must be satisfied so that the game will recognize the puzzle as solved. The first two bytes contains the number of such conditions actually set, in a 16-bit little endian format. This is followed by 8 entries, 16 bytes each, containing the required information for solution checking by the game. The format of each entry is:&lt;br /&gt;
&lt;br /&gt;
  INT16LE part_index;&lt;br /&gt;
  UINT16LE part_state_1;&lt;br /&gt;
  UINT16LE part_state_2;&lt;br /&gt;
  UINT16LE part_count;&lt;br /&gt;
  INT16LE position_rect_x;&lt;br /&gt;
  INT16LE position_rect_y;&lt;br /&gt;
  INT16LE position_rect_width;&lt;br /&gt;
  INT16LE position_rect_height;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_index&#039;&#039;&#039;: The index of the part in the puzzle file involved in the solution. -1 (0xFF 0xFF) for unused entries.&lt;br /&gt;
* &#039;&#039;&#039;part_state_1&#039;&#039;&#039;: An ID for a &amp;quot;physical state&amp;quot; of a part (for example a balloon was popped or a candle was lit). In many puzzles, one specific part must be in a specified &amp;quot;physical state&amp;quot; in order to complete the level. This is the same ID for a &amp;quot;part state&amp;quot; as the &#039;&#039;first_frame_id&#039;&#039; member found in the C section of the part&#039;s ANM file.&lt;br /&gt;
* &#039;&#039;&#039;part_state_2&#039;&#039;&#039;: Another ID for a &amp;quot;physical state&amp;quot;, the exact meaning is unclear.&lt;br /&gt;
* &#039;&#039;&#039;part_count&#039;&#039;&#039;: The value of the &amp;quot;Part count&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_x&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_y&#039;&#039;&#039;: The top left corner of the &amp;quot;position rectangle&amp;quot;. If such a solution specified puzzle part must be located within this rectangle in order to solve the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_width&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_height&#039;&#039;&#039;: Width and height of the &amp;quot;position rectangle&amp;quot;, see above.&lt;br /&gt;
&lt;br /&gt;
For the last four members (&amp;quot;position rectangle&amp;quot;), there are &amp;quot;fixed&amp;quot; combinations of values with special meaning:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-1, -1, -1, -1&amp;lt;/code&amp;gt;: &amp;quot;Off screen&amp;quot;, the part must leave the area visible on the game screen.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, -2000, 1640, 2000&amp;lt;/code&amp;gt;: &amp;quot;Off top&amp;quot;, the part must leave the visible area at the top.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, 400, 1640, 3000&amp;lt;/code&amp;gt;: &amp;quot;Off bottom&amp;quot;&lt;br /&gt;
* &amp;lt;code&amp;gt;0, 0, 0, 0&amp;lt;/code&amp;gt;: No such solution programmed, either this is &amp;quot;part state&amp;quot; solution or an unused entry (&amp;lt;code&amp;gt;part_index = -1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The last 2 bytes of the section contain the value of the &amp;quot;Delay&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game, in 16-bit little endian format.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note on puzzle solution information in TIM and TEMIM&#039;&#039;&#039;: TIM / TEMIM puzzles do not contain such data. This can also be demonstrated by extracting e.g. &amp;lt;tt&amp;gt;L1.LEV&amp;lt;/tt&amp;gt; from the archive file and rename the file to change the number. After starting the game, the level with the same number as the renamed file will be replaced with level 1. When playing the modified level, the game will not be able to check whether the puzzle is solved. Depending on its number, the level can become unwinnable or winnable by just clicking on the start machine button. Sometimes the game freezes.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
{{BeginFileFormatTools|Type=map}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [https://www.vogons.org/viewtopic.php?p=1089143#p1089143 The Incredible Machine level/image resource viewer] &lt;br /&gt;
| Platform = Windows, Linux&lt;br /&gt;
| canView = Yes&lt;br /&gt;
&amp;lt;!-- | canExport = Yes --&amp;gt;&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes = &lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10611</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10611"/>
		<updated>2022-07-23T06:36:07Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Tools */ removed todo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar. Level files have the extension &amp;lt;tt&amp;gt;.LEV&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. Such files are saved by the game with extension &amp;lt;tt&amp;gt;.TIM&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 00 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;EF AC 12 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;). An empty string in .GKC files with magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
Hints are supported only in TIM 2 and 3 puzzles. The first two bytes of the hint data contain the number of the hints in 16-bit little endian format. This is followed by 8 hint entries, some of them may be unused. A size of an unused entry is 7 bytes. One entry consists of three 16-bit integers and a null-terminated string containing the hint text. The three integer members are (all have a 16-bit little endian format):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;position_x&#039;&#039;&#039;: The X position of the hand icon for the hint.&lt;br /&gt;
* &#039;&#039;&#039;position_y&#039;&#039;&#039;: The Y position.&lt;br /&gt;
* &#039;&#039;&#039;hint_icon_flip&#039;&#039;&#039;: The hand icon of a hint can be flipped and can have four different orientations. Possible values are 0-3.&lt;br /&gt;
&lt;br /&gt;
In TIM 2, there are 3 (?) puzzles with magic number &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;. Neither of these files contain hints. However, the size of the empty hints section is 42 bytes in them instead of the expected 58.&lt;br /&gt;
&lt;br /&gt;
== Puzzle information data structure ==&lt;br /&gt;
&lt;br /&gt;
=== In TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
In TIM and TEMIM, there are two different puzzle header information data structures, one is used by the puzzles, and the another is found in saved &amp;quot;freeform&amp;quot; machines and the GKC files.&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM / TEMIM puzzles:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] bonus_1;&lt;br /&gt;
  UINT16LE bonus_2;&lt;br /&gt;
  [[INT16LE]] pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  INT16LE unknown_8;&lt;br /&gt;
  INT16LE unknown_10;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
The information structure format in saved &amp;quot;freeform&amp;quot; machines and GKC files:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bonus_1&#039;&#039;&#039;: The value of &amp;quot;Bonus 1&amp;quot; immediately after the puzzle is loaded (its value is constantly decreasing while the player is solving the puzzle).&lt;br /&gt;
* &#039;&#039;&#039;bonus_2&#039;&#039;&#039;: The value of &amp;quot;Bonus 2&amp;quot; for the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;unknown_8&#039;&#039;&#039;, &#039;&#039;unknown_10&#039;&#039;: The value of these two members is always -8. Perhaps the top left corner of the screen in the coordinate system used for puzzle parts, which is also (-8, -8).&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1001-1016 for TIM and 1001-1021 for TEMIM.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move (e.g. walls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that move (e.g. balls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_in_partsbin&#039;&#039;&#039;: The number of parts that are placed into the parts bin. (The player needs to position them in order to solve the puzzle.)&lt;br /&gt;
&lt;br /&gt;
=== In TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM 2 and 3:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE unknown_4;&lt;br /&gt;
  UINT16LE unknown_6;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE unknown_14;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1000-1023.&lt;br /&gt;
* &#039;&#039;&#039;unknown_4&#039;&#039;&#039;, &#039;&#039;&#039;unknown_6&#039;&#039;&#039;: Meaning is unknown, always 0.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move, regardless of whether they are placed initially into the parts bin or not.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that can move.&lt;br /&gt;
* &#039;&#039;&#039;unknown_14&#039;&#039;&#039;: Value is always 0. Likely this member corresponds to num_parts_in_partsbin in TIM / TEMIM puzzle header. Unlike TIM / TEMIM, parts placed into the parts bin are not a separate section in TIM 2 / 3, therefore, its value is always zero.&lt;br /&gt;
&lt;br /&gt;
== Puzzle part data ==&lt;br /&gt;
&lt;br /&gt;
As already discussed in the With the exception of TIM demo version (see below), the size of a part entry for the majority of puzzle parts is 48 bytes. However, there are exceptions, which are discussed in separate sub-sections. The format of the &amp;quot;default&amp;quot; part entry:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  [[BYTE]] belt_connect_pos_x;&lt;br /&gt;
  BYTE belt_connect_pos_y;&lt;br /&gt;
  UINT16LE belt_line_distance;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE rope_1_connect_pos_x;&lt;br /&gt;
  BYTE rope_1_connect_pos_y;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  BYTE rope_2_connect_pos_x;&lt;br /&gt;
  BYTE rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_type_num&#039;&#039;&#039;: A number associated with the type of the part (e.g. 0 - bowling ball). Required for identifying parts with an entry size different from the default. See [[The Incredible Machine Level Format/Part Numbers]]&lt;br /&gt;
* &#039;&#039;&#039;flags_1&#039;&#039;&#039;: A combination of flag bits.&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039; uses the following flag bits:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: Unknown meaning, used for a few &amp;quot;moving&amp;quot; parts (bucket, candle)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Set if the part is a wall.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x800&amp;lt;/code&amp;gt;: Part is placed initially into the parts bin (see num_parts_in_partsbin in part information data structure)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x4000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position (see &#039;&#039;num_parts_fixed&#039;&#039;)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: Set when 0x800 is not set ({{TODO|further testing needed}})&lt;br /&gt;
** In &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;, the bits have a known meaning:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Meaning unclear, used for &amp;quot;moving&amp;quot; parts only, but not always set, even for a single type of part.***&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, affected by gravity.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;, 0x4000: Used in combination for parts that do not move and are not affected by gravity.&lt;br /&gt;
* &#039;&#039;&#039;flags_2&#039;&#039;&#039;: Another word containing flag bits. The meaning of most flags is the same in all game versions.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: A belt can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: A belt is connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: A rope can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: A second rope can be connected to the part (teeter-totter)&lt;br /&gt;
** &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;: The part sprite is drawn horizontally flipped.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: The part sprite is drawn vertically flipped. Note on flip flags: Flipping a part in the game does not necessarily mean that one of the flip flags will be changed. For several parts, especially in TIM 2 / 3, flipping will affect the value of the &#039;&#039;appearance&#039;&#039; member.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Probably unused&lt;br /&gt;
** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Part can be stretched in at least one direction: inclines, conveyor belt, walls.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: Parts that can be stretched both horizontally and vertically, the walls.&lt;br /&gt;
* &#039;&#039;&#039;flags_3&#039;&#039;&#039;: Some flags are only present in TIM 2 / 3. This member of the part data structure is missing in the demo version of TIM.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: The part can be plugged into an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: The part is an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: The part can burn (e.g. candle) or has a fuse that can be lit (e.g. dynamite, cannon). Usually in combination with flag 0x8. &lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: Meaning of this flag is unclear. Used for several part types, but changing it has no apparent consequence (?) &lt;br /&gt;
** Flags present only in &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Part is &amp;quot;locked&amp;quot;, i.e not placed into the part bin.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Sizable scenery part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: {{TODO|unknown meaning}}&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: A &amp;quot;program&amp;quot; icon is shown for the part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: Scenery part&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Wall part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: A &amp;quot;Puzzle solution&amp;quot; icon is shown for the part (?)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: An identifier for the sprite that is shown for a part before the machine is started. (Once the machine is started, the state of the part can change and so can the sprite shown.) The meaning is different between TIM and TIM 2. In TIM, the sprite of some parts consists of only one image, in this case, this is often the number of the sub-image in the image resource file. ({{TODO|For other parts, this is probably an internal identifier for the sprite (?)}}). In TIM 2 and 3, the meaning of the appearance is an index in the A section of the [[The Incredible Machine 2-3 ANM File Format|.ANM file]] for the part, or if this is absent, an index in the B section. &amp;quot;Programming&amp;quot; a part in TIM 2 and 3 often results in the change of this field.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;: The width and height of the selectable area of the part ({{TODO|more reverse engineering work needed}})&lt;br /&gt;
* &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: At least in TIM 2, witdh_2 is used for calculating the position of part sprite when the part is flipped because of the horizontal flip bit is set in flags_2.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the part, usually the top left corner of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: In TIM 2 and 3, a programmed behavior of the part. (However, for many parts, &amp;quot;programming&amp;quot; modifies the &#039;&#039;appearance&#039;&#039; member.) For example the number of shots of the phazer gun or character shown by the message computer.  Meaning is different for rope parts, see below. Unused in TIM and TEMIM (except for ropes).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Probably unused, usually 0. Note that belt parts have a value of 1 in this position.&lt;br /&gt;
* &#039;&#039;&#039;belt_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;belt_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Always positive or 0, because &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039; are the coordinates of the top left corner where the sprite starts. Note that the formulas required for calculating the exact position of the belt are slightly different between TIM and TIM 2. Parts for which connection of a belt is allowed have a distinct circular area in their sprite, corresponding to the location where the belt is connected. In TIM / TEMIM, &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; is approximately the top left corner of its bounding rectangle, while in TIM 2 /3 it is close to the center of the circle.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_line_distance&#039;&#039;&#039;: The belts in the game appear as two, usually not perfectly parallel black (TIM / TEMIM) or gray (TIM 2 / 3) lines. This parameter determines the distance between the two segments, More precisely, it is either approximately the diameter of the circular area mentioned at &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; (TIM / TEMIM) or its radius (TIM 2 / 3).&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Similarly to belt_connect_pos_x/y, always positive or 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_2_connect_pos_y&#039;&#039;&#039;: The same as &#039;&#039;rope_1_connect_pos_x&#039;&#039;, &#039;&#039;rope_1_connect_pos_y&#039;&#039;, bit for another connected rope part.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;: The index of one or two parts in the puzzle that are connected to this part with a rope. If the rope runs through pulleys, this is the part index of the first pulley. If no rope is connected or this is not possible for the part, the value of both structure members are -1. (Of course, if one rope is connected, the value of one structure member (usually connected_rope_1) is the index of the rope part and the other is -1) )In TIM 2 and 3, the &amp;quot;remote bomb&amp;quot; part actually corresponds to two entries in the puzzle file. The connected_rope_2 field contains the index of the another &amp;quot;element&amp;quot; of the bomb, in both entries.&lt;br /&gt;
* &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: These structure members are only meaningful for electric outlet parts. Electric outlets always have 2 &amp;quot;sockets&amp;quot; for parts requiring electricity. It contains the index/indices of the part/parts plugged into the electric outlet, or -1 if the &amp;quot;socket&amp;quot; is free. If the part does not support this, both values are -1.&lt;br /&gt;
&lt;br /&gt;
=== Belts ===&lt;br /&gt;
&lt;br /&gt;
Belt parts (part 8) (except in the demo version of TIM, see below) use a 52-byte entry, with the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 8 for belts */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  INT16LE belt_connected_part_1;&lt;br /&gt;
  INT16LE belt_connected_part_2;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  UINT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x40&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, belts have no true sprite (represented by two lines).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for belts, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039; In TIM / TEMIM, either 0 or -1. In TIM 2, -1 or -100 (0xff9c). Meaning of these numbers is unclear, and the usage of the two different values do not correlate with the flags.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Always 1, perhaps indicates that the part is a belt.&lt;br /&gt;
* &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;belt_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this belt. In TIM and TEMIM, both are -1 if the belt is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;, &#039;&#039;&#039;unknown_40&#039;&#039;&#039;, &#039;&#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Ropes ===&lt;br /&gt;
&lt;br /&gt;
Rope parts (part 10) (except in the demo version of TIM, see below) use a 54-byte entry. TIM 2 and 3 also have a &amp;quot;steel cable&amp;quot; part (part 76) which also behaves as a rope and the size of the part entry is also identical. The rope part entry has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 10 for rope, 76 for steel cable */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE rope_segment_length;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  INT16LE rope_connected_part_1;&lt;br /&gt;
  INT16LE rope_connected_part_2;&lt;br /&gt;
  BYTE part_1_connect_field_usage;&lt;br /&gt;
  BYTE part_2_connect_field_usage;&lt;br /&gt;
  UINT16LE unknown_44;&lt;br /&gt;
  UINT16LE unknown_46;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039;: Same flags used as in the belt part structure.&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, ropes have no true sprite (represented by one or more line segments).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for ropes, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: Similarly to belts, possible values are 0 and -1 in TIM / TEMIM; and -1 and -100 in TIM 2 / 3.&lt;br /&gt;
* &#039;&#039;&#039;rope_segment_length&#039;&#039;&#039;: The length of the rope (Euclidean distance between the two ends) if the rope does not run through pulleys. Otherwise, the length of the rope segment between the part at one end (rope_connected_part_1 (?)) and the first pulley ({{TODO|additional testing needed}}).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for pulleys.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;rope_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this rope (never the pulleys). In TIM and TEMIM, both are -1 if the rope is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;part_1_connect_field_usage&#039;&#039;&#039;, &#039;&#039;&#039;part_2_connect_field_usage&#039;&#039;&#039;: Whether &#039;&#039;connected_1&#039;&#039; or &#039;&#039;connected_2&#039;&#039; is used in the two connected parts for this rope. 0 if connected_1, 1 if connected_2. ({{TODO|additional testing needed}})&lt;br /&gt;
* &#039;&#039;&#039;unknown_44&#039;&#039;&#039;, &#039;&#039;&#039;unknown_46&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Pulleys ===&lt;br /&gt;
&lt;br /&gt;
The format of the 56-byte puzzle part entry for the pulley (part 7):&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 7 for pulley */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_y;&lt;br /&gt;
  INT16LE unknown_36;&lt;br /&gt;
  INT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE pulley_connected_1;&lt;br /&gt;
  INT16LE pulley_connected_2;&lt;br /&gt;
  INT16LE unknown_50;&lt;br /&gt;
  INT16LE unknown_52;&lt;br /&gt;
  INT16LE rope_index;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x8&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;0x0&amp;lt;/code&amp;gt; {{TODO|in some cases}})&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x48&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Pulleys can have four different sprites depending on the orientation. Possible values are 0-3.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: The size of the pulley sprite. In TIM 2 / 3, also depends on the orientation.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the pulley, top left coordinates of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;, &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for ropes.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where one rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Depends on the orientation of the pulley, like &#039;&#039;appearance&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;unknown_40&#039;&#039;, &#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_2_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where the other rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;pulley_connected_1&#039;&#039;&#039;, &#039;&#039;&#039;pulley_connected_2&#039;&#039;&#039;: Either the index of part at one of the two ends of the rope, or the index of next or previous pulley the rope is running through.&lt;br /&gt;
* &#039;&#039;&#039;unknown_50&#039;&#039;&#039;, &#039;&#039;&#039;unknown_52&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;rope_index&#039;&#039;&#039;: In TIM 2 / 3, the index of the rope part. Not used (-1) in TIM and TEMIM.&lt;br /&gt;
&lt;br /&gt;
=== Programmable ball (TIM 2 / 3) ===&lt;br /&gt;
&lt;br /&gt;
The programmable ball part is present in TIM 2 and 3, and its part type number is 87. The size of the entry is 60 bytes in total. The first 48 bytes is the same as the default part data structure, which is followed by another, 12-byte structure specific to this part. The format of the programmable ball data is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE density;&lt;br /&gt;
  UINT16LE elasticity;&lt;br /&gt;
  UINT16LE friction;&lt;br /&gt;
  INT16LE gravity_buoyancy;&lt;br /&gt;
  UINT16LE mass;&lt;br /&gt;
  UINT16LE appearance_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;density&#039;&#039;&#039;: The density of the ball, affects the buoyant force acting on the ball.&lt;br /&gt;
* &#039;&#039;&#039;elasticity&#039;&#039;&#039;: The elasticity of the ball.&lt;br /&gt;
* &#039;&#039;&#039;friction&#039;&#039;&#039;: The friction.&lt;br /&gt;
* &#039;&#039;&#039;gravity_buoyancy&#039;&#039;&#039;: A calculated parameter, using the density and the mass of the ball, as well as the gravity and the pressure set for the puzzle. If its value is negative, the ball will rise due to the buoyant force rather than fall.&lt;br /&gt;
* &#039;&#039;&#039;mass&#039;&#039;&#039;: The mass of the ball.&lt;br /&gt;
* &#039;&#039;&#039;appearance_2&#039;&#039;&#039;: Has the same value as the &#039;&#039;appearance&#039;&#039; field. The ball can have 7 different colors/patterns.&lt;br /&gt;
&lt;br /&gt;
The game has a dialog for setting the four physical properties (mass, elasticity, density, friction, in this order). However, the number stored in the data structure is not the same as the numbers shown on the program dialog. For example, if following settings are used for the ball: &amp;lt;code&amp;gt;mass = 8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 3&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;density = 7&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 3&amp;lt;/code&amp;gt;; and the default values are used for gravity/pressure, the puzzle file will contain the following values: &amp;lt;code&amp;gt;density = 3000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 128&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 16&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;gravity_buoyancy = 269&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mass = 201&amp;lt;/code&amp;gt;. (Note: There is an inconsistency in the game here, the programmable ball part uses &amp;lt;code&amp;gt;density = 2832&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mass = 200&amp;lt;/code&amp;gt; by default, which does not correspond exactly to any value that can be set in the dialog.)&lt;br /&gt;
&lt;br /&gt;
=== TIM demo version ===&lt;br /&gt;
&lt;br /&gt;
In the demo version of the (original) TIM (available at several DOS shareware game websites), the &#039;&#039;flags_3&#039;&#039;, &#039;&#039;outlet_plugged_1&#039;&#039; and &#039;&#039;outlet_plugged_2&#039;&#039; fields are missing.&lt;br /&gt;
Instead, the 42-byte part data (46 for belts, 48 for ropes, 50 for pulleys) is followed by an another, variable length data structure of unknown significance consisting of 16-bit little endian integers. It is always at least 2 bytes long, and the first two bytes contain the number of additional 16-bit words after this size word. The reverse engineering of this structure is complicated by the fact that it is only present in a demo version containing only 8 puzzles.&lt;br /&gt;
&lt;br /&gt;
== Puzzle solution information ==&lt;br /&gt;
&lt;br /&gt;
Puzzle solution information is only present in TIM 2 and TIM 3 puzzles. Its size is always 132 bytes and can contain 8 different conditions that must be satisfied so that the game will recognize the puzzle as solved. The first two bytes contains the number of such conditions actually set, in a 16-bit little endian format. This is followed by 8 entries, 16 bytes each, containing the required information for solution checking by the game. The format of each entry is:&lt;br /&gt;
&lt;br /&gt;
  INT16LE part_index;&lt;br /&gt;
  UINT16LE part_state_1;&lt;br /&gt;
  UINT16LE part_state_2;&lt;br /&gt;
  UINT16LE part_count;&lt;br /&gt;
  INT16LE position_rect_x;&lt;br /&gt;
  INT16LE position_rect_y;&lt;br /&gt;
  INT16LE position_rect_width;&lt;br /&gt;
  INT16LE position_rect_height;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_index&#039;&#039;&#039;: The index of the part in the puzzle file involved in the solution. -1 (0xFF 0xFF) for unused entries.&lt;br /&gt;
* &#039;&#039;&#039;part_state_1&#039;&#039;&#039;: An ID for a &amp;quot;physical state&amp;quot; of a part (for example a balloon was popped or a candle was lit). In many puzzles, one specific part must be in a specified &amp;quot;physical state&amp;quot; in order to complete the level. This is the same ID for a &amp;quot;part state&amp;quot; as the &#039;&#039;first_frame_id&#039;&#039; member found in the C section of the part&#039;s ANM file.&lt;br /&gt;
* &#039;&#039;&#039;part_state_2&#039;&#039;&#039;: Another ID for a &amp;quot;physical state&amp;quot;, the exact meaning is unclear.&lt;br /&gt;
* &#039;&#039;&#039;part_count&#039;&#039;&#039;: The value of the &amp;quot;Part count&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_x&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_y&#039;&#039;&#039;: The top left corner of the &amp;quot;position rectangle&amp;quot;. If such a solution specified puzzle part must be located within this rectangle in order to solve the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_width&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_height&#039;&#039;&#039;: Width and height of the &amp;quot;position rectangle&amp;quot;, see above.&lt;br /&gt;
&lt;br /&gt;
For the last four members (&amp;quot;position rectangle&amp;quot;), there are &amp;quot;fixed&amp;quot; combinations of values with special meaning:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-1, -1, -1, -1&amp;lt;/code&amp;gt;: &amp;quot;Off screen&amp;quot;, the part must leave the area visible on the game screen.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, -2000, 1640, 2000&amp;lt;/code&amp;gt;: &amp;quot;Off top&amp;quot;, the part must leave the visible area at the top.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, 400, 1640, 3000&amp;lt;/code&amp;gt;: &amp;quot;Off bottom&amp;quot;&lt;br /&gt;
* &amp;lt;code&amp;gt;0, 0, 0, 0&amp;lt;/code&amp;gt;: No such solution programmed, either this is &amp;quot;part state&amp;quot; solution or an unused entry (&amp;lt;code&amp;gt;part_index = -1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The last 2 bytes of the section contain the value of the &amp;quot;Delay&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game, in 16-bit little endian format.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note on puzzle solution information in TIM and TEMIM&#039;&#039;&#039;: TIM / TEMIM puzzles do not contain such data. This can also be demonstrated by extracting e.g. &amp;lt;tt&amp;gt;L1.LEV&amp;lt;/tt&amp;gt; from the archive file and rename the file to change the number. After starting the game, the level with the same number as the renamed file will be replaced with level 1. When playing the modified level, the game will not be able to check whether the puzzle is solved. Depending on its number, the level can become unwinnable or winnable by just clicking on the start machine button. Sometimes the game freezes.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
{{BeginFileFormatTools|Type=map}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [https://www.vogons.org/viewtopic.php?p=1089143#p1089143 The Incredible Machine level/image resource viewer] &lt;br /&gt;
| Platform = Windows, Linux&lt;br /&gt;
| canView = Yes&lt;br /&gt;
&amp;lt;!-- | canExport = Yes --&amp;gt;&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes = &lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10610</id>
		<title>The Incredible Machine 2-3 ANM File Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10610"/>
		<updated>2022-07-23T06:29:24Z</updated>

		<summary type="html">&lt;p&gt;Knt47: viewer tool, small updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The &#039;&#039;&#039;animation&#039;&#039;&#039; (&amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt;) sub-files are found in the [[TIM Resource Format|archive file]] of [[The Incredible Machine 2]] (TIM 2) and [[Thie Incredible Machine 3|3]] (TIM 3). They contain the information required for drawing puzzle part sprites, which are often comprised of multiple sub-images of [[The Incredible Machine Image Format|image files]] and for animations of the puzzle parts. They are also used for animated parts of the game&#039;s user interface (for example the animated icons of the main menu). It can also contain commands for playing sound effects.&lt;br /&gt;
&lt;br /&gt;
Most &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files (all in TIM 2) contain two chunks, starting with &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;  and &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, respectively. Both use the typical &amp;quot;Dynamix chunk&amp;quot; format, starting with the 4-byte chunk type (&amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;/&amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, followed by the chunk size in 32-bit, little endian format. Unlike other Dynamix file formats, the most significant bit in the 32-bit size of the first chunk is not set. A small number of files in TIM 3 contain a third chunk, &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot;, with an unclear meaning.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;ANM:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
Not counting the chunk type and size, an &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt; chunk has five parts, a 16 or 22 byte header, and four sections containing the actual sprite/animation frame/animation data, labeled here as A-D.&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk (not counting the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the chunk size) starts with a header, with a size of 16 or 22 bytes, depending on the magic number. It has the following Format:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] magic_number_1;&lt;br /&gt;
  UINT16LE magic_number_2;&lt;br /&gt;
  UINT16LE size_section_a;&lt;br /&gt;
  UINT16LE size_section_b;&lt;br /&gt;
  UINT16LE size_section_c;&lt;br /&gt;
  UINT16LE size_section_d;&lt;br /&gt;
  UINT16LE anm_width;&lt;br /&gt;
  UINT16LE anm_height;&lt;br /&gt;
  /* 3 members, found only in files with a magic number of 0x54 0x42 0xEA 0x03: */&lt;br /&gt;
  UINT16LE unknown_16;&lt;br /&gt;
  UINT16LE unknown_18;&lt;br /&gt;
  UINT16LE unknown_20;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;magic_number_1&#039;&#039;&#039;, &#039;&#039;&#039;magic_number_2&#039;&#039;&#039;:  The header starts with a 4-byte magic number. The first two bytes are always 0x54 0x42. The second two bytes are a 16-bit little endian file version number. In TIM 2, the possible values 1000 (0x3E8) or 1001 (0x3E9). There is no obvious difference in the format of the files using these two numbers, however, 0x3E9 is much more common and 0x3E8 is mostly used for relatively small and simple files. In TIM 3, a small number of files use a newer version of the &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; file format, with a magic_number_2 value of 1002 (0x3EA). Such files have a slightly different format compared to files with the other two numbers. The &amp;quot;newer&amp;quot; format is used in the user interface and the game menu, but never for puzzle part graphics.&lt;br /&gt;
* &#039;&#039;&#039;size_section_a&#039;&#039;&#039;: The number of entries in the A section of the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, one entry is 2 byte (i.e. the section is an array of 16-bit integers). Several files do not have an A section (size_section_a == 0)&lt;br /&gt;
* &#039;&#039;&#039;size_section_b&#039;&#039;&#039;: The number of entries in the B section. One entry is 12 bytes in the files in files with &amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;, 10 bytes in all other files.&lt;br /&gt;
* &#039;&#039;&#039;size_section_c&#039;&#039;&#039;: The number of entries in the C section, one entry is 4 bytes.&lt;br /&gt;
* &#039;&#039;&#039;size_section_d&#039;&#039;&#039;: The size of the D section in bytes.&lt;br /&gt;
* &#039;&#039;&#039;anm_width&#039;&#039;&#039;, &#039;&#039;&#039;anm_height&#039;&#039;&#039;: Width and height of the animation. In &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts, the two structure members usually have the same value as width_1 and height_1 for the part in puzzle/level files.   &lt;br /&gt;
&lt;br /&gt;
Structure members found only in files with the longer header (&amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;unknown_16&#039;&#039;&#039;: 0x14 in all files, perhaps the size of header minus magic_number_1. Files with the longer header do not contain additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, so it cannot be a size of such a section.&lt;br /&gt;
* &#039;&#039;&#039;unknown_18&#039;&#039;&#039;: 0 in all files&lt;br /&gt;
* &#039;&#039;&#039;unknown_20&#039;&#039;&#039;: 0x17 in one file, 0 in all others. Clearly not the size of an additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section A ===&lt;br /&gt;
&lt;br /&gt;
Section A is empty in a large number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files. If present, it is an array of 16-bit little endian integers. It contains all numbers from 0 to the number of items in B section minus 1, in increasing order, with some numbers repeated. For example &amp;lt;code&amp;gt;0 1 1 1 2&amp;lt;/code&amp;gt; means that the animation frame with index 1 in section B must be shown for the duration of 3 timer ticks instead of 1.&lt;br /&gt;
&lt;br /&gt;
=== Section B ===&lt;br /&gt;
&lt;br /&gt;
Section B is a list of structures containing 16 bit integer members, 6 if magic_number_2 is &amp;lt;tt&amp;gt;0x3EA&amp;lt;/tt&amp;gt;, 5 in the other versions of the file format. It contains essential information about each animation frame. One structure has the following members:&lt;br /&gt;
&lt;br /&gt;
  [[INT16LE]] relative_pos_x;&lt;br /&gt;
  INT16LE relative_pos_y;&lt;br /&gt;
  UINT16LE width;&lt;br /&gt;
  UINT16LE height;&lt;br /&gt;
  UINT16LE section_d_offset;&lt;br /&gt;
  /* Note that the last member is only present in files with */&lt;br /&gt;
  /*     magic number 0x54 0x42 0xEA 0x03 */&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;relative_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;relative_pos_y&#039;&#039;&#039;: The coordinates where the animation frame must be drawn, relative to other frames. For the first item in the B section, the value of both tare typically 0, however there are a few exceptions. The relative position may be negative.&lt;br /&gt;
* &#039;&#039;&#039;width&#039;&#039;&#039;, &#039;&#039;&#039;height&#039;&#039;&#039;: The width and the height of the graphics in the specific animation frame.&lt;br /&gt;
* &#039;&#039;&#039;section_d_offset&#039;&#039;&#039;: An offset in section D, points to the first command required for drawing the animation frame.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: The meaning is unclear. Often, but not always a number divisible by 3. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section C ===&lt;br /&gt;
&lt;br /&gt;
A section C item has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE first_frame_id;&lt;br /&gt;
  UINT16LE state_id;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;first_frame_id&#039;&#039;&#039;: The meaning of &#039;&#039;first_frame_id&#039;&#039; is slightly different between files containing or not containing an A section. If the A section is not present, this is the index in section B for the first animation frame for a particular animation. If there is an A section, &#039;&#039;first_frame_id&#039;&#039; is an index in the A section, and the 16-bit array item at this index is the required section B index. The section B indices determined this way essentially divide the B section into sub-sectons. One sub-section corresponds to the &amp;quot;animation&amp;quot; of a puzzle part or an user interface element in one specific state. If an &amp;quot;animation&amp;quot; has only one section B item, then the puzzle part or button/icon is not animated in this state.&lt;br /&gt;
* &#039;&#039;&#039;state_id&#039;&#039;&#039;: An internal identifier used by the game for a state of the puzzle part or an user interface element. In a specific &amp;quot;state&amp;quot;, the puzzle part (or user interface element) may or may not be animated, the animation frames belonging to such a state must be determined using the first_frame_id member.&lt;br /&gt;
&lt;br /&gt;
=== Section D ===&lt;br /&gt;
&lt;br /&gt;
The D section contains the instructions on how to draw each animation frame (or to play a sound). The section_d_offset field in the corresponding section B entry determines where the sequence of commands start for each animation frame. There are 6 different types of commands, numbered 0-5. Each command starts with its number in a 16-bit, little endian format. For commands 2-5, this is followed by a list of 16-bit integer parameters, the number of the parameters depends on command number.&lt;br /&gt;
 &lt;br /&gt;
==== Command 0: End of animation frame ====&lt;br /&gt;
&lt;br /&gt;
Command 0 indicates the end of an animation frame in the file. It terminates the list of commands associated with a section B item. Command 0 has no parameters and is always 2 bytes long (the 16-bit command number).&lt;br /&gt;
&lt;br /&gt;
==== Command 1: End of &amp;quot;ANM:&amp;quot; chunk ====&lt;br /&gt;
&lt;br /&gt;
The last two bytes of section D (and the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk) are always &amp;lt;code&amp;gt;01 00&amp;lt;/code&amp;gt; (1 in 16-bit little endian format). These two bytes can be interpreted as a 2-byte command that terminates section D and the entire &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. Command 1 is not found anywhere else in section D.&lt;br /&gt;
&lt;br /&gt;
==== Command 2: Draw BMP sub-image ====&lt;br /&gt;
&lt;br /&gt;
Command 2 is an instruction for the  game engine to draw a sub-image from a &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; image stored in the archive file of the game. It should be noted that a part sprite is often &amp;quot;cut into&amp;quot; multiple &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub images, and in a few cases, they are stored in more than one file. Command 2 has five 16-bit integer parameters (size is 12 bytes, including the command number).&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 2 */&lt;br /&gt;
  UINT16LE bmp_file_num;&lt;br /&gt;
  UINT16LE bmp_sub_image_num;&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE flip;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bmp_file_num&#039;&#039;&#039;: Index of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file in the TAG: chunk. The index of the first image is 1.&lt;br /&gt;
* &#039;&#039;&#039;bmp_sub_image_num&#039;&#039;&#039;: The &amp;quot;sub-image&amp;quot; number of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file to draw. [[The Incredible Machine Image Format|&amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; images in TIM 2]]  can have multiple sub images.&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: The position of the image (top left corner), relative to the x and y coordinates in the corresponding section B item.&lt;br /&gt;
* &#039;&#039;&#039;flip&#039;&#039;&#039;: The image can be drawn horizontally and/or vertically flipped relative to its original orientation. 1 = vertical flip, 2 = horizontal flip, 3 = both, 0 = no such transform is applied.&lt;br /&gt;
&lt;br /&gt;
==== Command 3: Draw rectangle ====&lt;br /&gt;
&lt;br /&gt;
Command 3 draws a rectangle with a border and fill color provided as arguments. It is mainly used in user interface elements and in the graphics shown in the part help screen, rarely in puzzle part graphics. It has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 3 */&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE rect_width;&lt;br /&gt;
  UINT16LE rect_height;&lt;br /&gt;
  UINT16LE border_color;&lt;br /&gt;
  UINT16LE fill;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: Coordinates of the top left corner of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;rect_width&#039;&#039;&#039;, &#039;&#039;&#039;rect_height&#039;&#039;&#039;: The width and height of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;border_color&#039;&#039;&#039;: The border color for the rectangle. In TIM 2, one color from the 16-color palette.&lt;br /&gt;
* &#039;&#039;&#039;fill&#039;&#039;&#039;: The value of the &#039;&#039;fill&#039;&#039; parameter is either 0 - no fill, border only - or a value between 0x8000 and 0x800f where the least significant nibble contains the fill color.&lt;br /&gt;
&lt;br /&gt;
==== Command 4: Draw line ====&lt;br /&gt;
&lt;br /&gt;
Command 4 draws a line between two end points with a specific color. Like the rectangle command, it is mainly used for game interface graphics, not the puzzle parts. The format of the command is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 4 */&lt;br /&gt;
  INT16LE x1;&lt;br /&gt;
  INT16LE y1;&lt;br /&gt;
  INT16LE x2;&lt;br /&gt;
  INT16LE y2;&lt;br /&gt;
  UINT16LE line_color;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;x1&#039;&#039;&#039;, &#039;&#039;&#039;y1&#039;&#039;&#039;: The coordinates of one end point.&lt;br /&gt;
* &#039;&#039;&#039;x2&#039;&#039;&#039;, &#039;&#039;&#039;y2&#039;&#039;&#039;: The coordinates of the other end point.&lt;br /&gt;
* &#039;&#039;&#039;line_color&#039;&#039;&#039;: The color of the line, one color from the 16-color palette in TIM 2.&lt;br /&gt;
&lt;br /&gt;
==== Command 5: Play sound ====&lt;br /&gt;
&lt;br /&gt;
If the command list for an animation frame includes command 5, a sound effect will be played when the particular frame is shown. It has one 16-bit parameter, the ID of the sound. TIM 2 contains sounds in two different formats. Sounds with a number &amp;gt;= 3000 are stored in the archive file of the game (&amp;lt;tt&amp;gt;SX_3???.RAW&amp;lt;/tt&amp;gt;). &amp;lt;tt&amp;gt;.RAW&amp;lt;/tt&amp;gt; files are uncompressed 8-bit PCM audio files without any header. The rest of the files (with numbers &amp;lt; 300) are found in &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;.&lt;br /&gt;
TIM 3 has &amp;lt;tt&amp;gt;.WAV&amp;lt;/tt&amp;gt; files instead in the archive file an there is no &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;. ({{TODO|TIM 3 sounds with numbers below 3000}}).&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;TAG:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk contains the names of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub-files (in the archive file of the game) required for displaying the animation. Not counting the &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the 32-bit chunk size, the first two bytes of the data contains the number of image file names in 16-bit little endian format. The remaining part of the data is the list of image file name entries. A single entry is a 16-bit image ID followed by a null-terminated string containing the name of the image. In TIM 2, the ID of the first image is always 1, however, there are exceptions to this rule in TIM 3 (but never in part graphics). There is no gap in the numbering of the images, this makes the image ID field somewhat redundant.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;LAB:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is present in a small number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files in TIM 3. &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts never contain such a chunk. The structure of the &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is similar to &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, it consists of the number of entries stored as 16-bit integer, followed by item ID-null terminated string pairs. The strings are apparently not user interface texts visible to the player. &lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TODO, Does not really belong to any file format category in FileFormatTool tempate --&amp;gt;&lt;br /&gt;
[https://www.vogons.org/viewtopic.php?p=1089143#p1089143 The Incredible Machine level/image resource viewer] supports viewing animations in TIM 2-3 &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files.&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TODO, this file format does not really belong to any file format category in this site --&amp;gt;&lt;br /&gt;
[[Category:All file formats]]&lt;br /&gt;
[[Category:The Incredible Machine 2]]&lt;br /&gt;
[[Category:The Incredible Machine 3]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10609</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10609"/>
		<updated>2022-07-22T22:16:35Z</updated>

		<summary type="html">&lt;p&gt;Knt47: Level viewer too, small updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar. Level files have the extension &amp;lt;tt&amp;gt;.LEV&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. Such files are saved by the game with extension &amp;lt;tt&amp;gt;.TIM&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 00 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;EF AC 12 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;). An empty string in .GKC files with magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
Hints are supported only in TIM 2 and 3 puzzles. The first two bytes of the hint data contain the number of the hints in 16-bit little endian format. This is followed by 8 hint entries, some of them may be unused. A size of an unused entry is 7 bytes. One entry consists of three 16-bit integers and a null-terminated string containing the hint text. The three integer members are (all have a 16-bit little endian format):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;position_x&#039;&#039;&#039;: The X position of the hand icon for the hint.&lt;br /&gt;
* &#039;&#039;&#039;position_y&#039;&#039;&#039;: The Y position.&lt;br /&gt;
* &#039;&#039;&#039;hint_icon_flip&#039;&#039;&#039;: The hand icon of a hint can be flipped and can have four different orientations. Possible values are 0-3.&lt;br /&gt;
&lt;br /&gt;
In TIM 2, there are 3 (?) puzzles with magic number &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;. Neither of these files contain hints. However, the size of the empty hints section is 42 bytes in them instead of the expected 58.&lt;br /&gt;
&lt;br /&gt;
== Puzzle information data structure ==&lt;br /&gt;
&lt;br /&gt;
=== In TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
In TIM and TEMIM, there are two different puzzle header information data structures, one is used by the puzzles, and the another is found in saved &amp;quot;freeform&amp;quot; machines and the GKC files.&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM / TEMIM puzzles:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] bonus_1;&lt;br /&gt;
  UINT16LE bonus_2;&lt;br /&gt;
  [[INT16LE]] pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  INT16LE unknown_8;&lt;br /&gt;
  INT16LE unknown_10;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
The information structure format in saved &amp;quot;freeform&amp;quot; machines and GKC files:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bonus_1&#039;&#039;&#039;: The value of &amp;quot;Bonus 1&amp;quot; immediately after the puzzle is loaded (its value is constantly decreasing while the player is solving the puzzle).&lt;br /&gt;
* &#039;&#039;&#039;bonus_2&#039;&#039;&#039;: The value of &amp;quot;Bonus 2&amp;quot; for the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;unknown_8&#039;&#039;&#039;, &#039;&#039;unknown_10&#039;&#039;: The value of these two members is always -8. Perhaps the top left corner of the screen in the coordinate system used for puzzle parts, which is also (-8, -8).&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1001-1016 for TIM and 1001-1021 for TEMIM.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move (e.g. walls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that move (e.g. balls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_in_partsbin&#039;&#039;&#039;: The number of parts that are placed into the parts bin. (The player needs to position them in order to solve the puzzle.)&lt;br /&gt;
&lt;br /&gt;
=== In TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM 2 and 3:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE unknown_4;&lt;br /&gt;
  UINT16LE unknown_6;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE unknown_14;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1000-1023.&lt;br /&gt;
* &#039;&#039;&#039;unknown_4&#039;&#039;&#039;, &#039;&#039;&#039;unknown_6&#039;&#039;&#039;: Meaning is unknown, always 0.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move, regardless of whether they are placed initially into the parts bin or not.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that can move.&lt;br /&gt;
* &#039;&#039;&#039;unknown_14&#039;&#039;&#039;: Value is always 0. Likely this member corresponds to num_parts_in_partsbin in TIM / TEMIM puzzle header. Unlike TIM / TEMIM, parts placed into the parts bin are not a separate section in TIM 2 / 3, therefore, its value is always zero.&lt;br /&gt;
&lt;br /&gt;
== Puzzle part data ==&lt;br /&gt;
&lt;br /&gt;
As already discussed in the With the exception of TIM demo version (see below), the size of a part entry for the majority of puzzle parts is 48 bytes. However, there are exceptions, which are discussed in separate sub-sections. The format of the &amp;quot;default&amp;quot; part entry:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  [[BYTE]] belt_connect_pos_x;&lt;br /&gt;
  BYTE belt_connect_pos_y;&lt;br /&gt;
  UINT16LE belt_line_distance;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE rope_1_connect_pos_x;&lt;br /&gt;
  BYTE rope_1_connect_pos_y;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  BYTE rope_2_connect_pos_x;&lt;br /&gt;
  BYTE rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_type_num&#039;&#039;&#039;: A number associated with the type of the part (e.g. 0 - bowling ball). Required for identifying parts with an entry size different from the default. See [[The Incredible Machine Level Format/Part Numbers]]&lt;br /&gt;
* &#039;&#039;&#039;flags_1&#039;&#039;&#039;: A combination of flag bits.&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039; uses the following flag bits:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: Unknown meaning, used for a few &amp;quot;moving&amp;quot; parts (bucket, candle)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Set if the part is a wall.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x800&amp;lt;/code&amp;gt;: Part is placed initially into the parts bin (see num_parts_in_partsbin in part information data structure)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x4000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position (see &#039;&#039;num_parts_fixed&#039;&#039;)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: Set when 0x800 is not set ({{TODO|further testing needed}})&lt;br /&gt;
** In &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;, the bits have a known meaning:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Meaning unclear, used for &amp;quot;moving&amp;quot; parts only, but not always set, even for a single type of part.***&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, affected by gravity.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;, 0x4000: Used in combination for parts that do not move and are not affected by gravity.&lt;br /&gt;
* &#039;&#039;&#039;flags_2&#039;&#039;&#039;: Another word containing flag bits. The meaning of most flags is the same in all game versions.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: A belt can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: A belt is connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: A rope can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: A second rope can be connected to the part (teeter-totter)&lt;br /&gt;
** &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;: The part sprite is drawn horizontally flipped.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: The part sprite is drawn vertically flipped. Note on flip flags: Flipping a part in the game does not necessarily mean that one of the flip flags will be changed. For several parts, especially in TIM 2 / 3, flipping will affect the value of the &#039;&#039;appearance&#039;&#039; member.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Probably unused&lt;br /&gt;
** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Part can be stretched in at least one direction: inclines, conveyor belt, walls.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: Parts that can be stretched both horizontally and vertically, the walls.&lt;br /&gt;
* &#039;&#039;&#039;flags_3&#039;&#039;&#039;: Some flags are only present in TIM 2 / 3. This member of the part data structure is missing in the demo version of TIM.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: The part can be plugged into an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: The part is an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: The part can burn (e.g. candle) or has a fuse that can be lit (e.g. dynamite, cannon). Usually in combination with flag 0x8. &lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: Meaning of this flag is unclear. Used for several part types, but changing it has no apparent consequence (?) &lt;br /&gt;
** Flags present only in &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Part is &amp;quot;locked&amp;quot;, i.e not placed into the part bin.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Sizable scenery part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: {{TODO|unknown meaning}}&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: A &amp;quot;program&amp;quot; icon is shown for the part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: Scenery part&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Wall part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: A &amp;quot;Puzzle solution&amp;quot; icon is shown for the part (?)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: An identifier for the sprite that is shown for a part before the machine is started. (Once the machine is started, the state of the part can change and so can the sprite shown.) The meaning is different between TIM and TIM 2. In TIM, the sprite of some parts consists of only one image, in this case, this is often the number of the sub-image in the image resource file. ({{TODO|For other parts, this is probably an internal identifier for the sprite (?)}}). In TIM 2 and 3, the meaning of the appearance is an index in the A section of the [[The Incredible Machine 2-3 ANM File Format|.ANM file]] for the part, or if this is absent, an index in the B section. &amp;quot;Programming&amp;quot; a part in TIM 2 and 3 often results in the change of this field.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;: The width and height of the selectable area of the part ({{TODO|more reverse engineering work needed}})&lt;br /&gt;
* &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: At least in TIM 2, witdh_2 is used for calculating the position of part sprite when the part is flipped because of the horizontal flip bit is set in flags_2.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the part, usually the top left corner of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: In TIM 2 and 3, a programmed behavior of the part. (However, for many parts, &amp;quot;programming&amp;quot; modifies the &#039;&#039;appearance&#039;&#039; member.) For example the number of shots of the phazer gun or character shown by the message computer.  Meaning is different for rope parts, see below. Unused in TIM and TEMIM (except for ropes).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Probably unused, usually 0. Note that belt parts have a value of 1 in this position.&lt;br /&gt;
* &#039;&#039;&#039;belt_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;belt_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Always positive or 0, because &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039; are the coordinates of the top left corner where the sprite starts. Note that the formulas required for calculating the exact position of the belt are slightly different between TIM and TIM 2. Parts for which connection of a belt is allowed have a distinct circular area in their sprite, corresponding to the location where the belt is connected. In TIM / TEMIM, &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; is approximately the top left corner of its bounding rectangle, while in TIM 2 /3 it is close to the center of the circle.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_line_distance&#039;&#039;&#039;: The belts in the game appear as two, usually not perfectly parallel black (TIM / TEMIM) or gray (TIM 2 / 3) lines. This parameter determines the distance between the two segments, More precisely, it is either approximately the diameter of the circular area mentioned at &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; (TIM / TEMIM) or its radius (TIM 2 / 3).&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Similarly to belt_connect_pos_x/y, always positive or 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_2_connect_pos_y&#039;&#039;&#039;: The same as &#039;&#039;rope_1_connect_pos_x&#039;&#039;, &#039;&#039;rope_1_connect_pos_y&#039;&#039;, bit for another connected rope part.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;: The index of one or two parts in the puzzle that are connected to this part with a rope. If the rope runs through pulleys, this is the part index of the first pulley. If no rope is connected or this is not possible for the part, the value of both structure members are -1. (Of course, if one rope is connected, the value of one structure member (usually connected_rope_1) is the index of the rope part and the other is -1) )In TIM 2 and 3, the &amp;quot;remote bomb&amp;quot; part actually corresponds to two entries in the puzzle file. The connected_rope_2 field contains the index of the another &amp;quot;element&amp;quot; of the bomb, in both entries.&lt;br /&gt;
* &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: These structure members are only meaningful for electric outlet parts. Electric outlets always have 2 &amp;quot;sockets&amp;quot; for parts requiring electricity. It contains the index/indices of the part/parts plugged into the electric outlet, or -1 if the &amp;quot;socket&amp;quot; is free. If the part does not support this, both values are -1.&lt;br /&gt;
&lt;br /&gt;
=== Belts ===&lt;br /&gt;
&lt;br /&gt;
Belt parts (part 8) (except in the demo version of TIM, see below) use a 52-byte entry, with the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 8 for belts */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  INT16LE belt_connected_part_1;&lt;br /&gt;
  INT16LE belt_connected_part_2;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  UINT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x40&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, belts have no true sprite (represented by two lines).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for belts, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039; In TIM / TEMIM, either 0 or -1. In TIM 2, -1 or -100 (0xff9c). Meaning of these numbers is unclear, and the usage of the two different values do not correlate with the flags.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Always 1, perhaps indicates that the part is a belt.&lt;br /&gt;
* &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;belt_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this belt. In TIM and TEMIM, both are -1 if the belt is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;, &#039;&#039;&#039;unknown_40&#039;&#039;&#039;, &#039;&#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Ropes ===&lt;br /&gt;
&lt;br /&gt;
Rope parts (part 10) (except in the demo version of TIM, see below) use a 54-byte entry. TIM 2 and 3 also have a &amp;quot;steel cable&amp;quot; part (part 76) which also behaves as a rope and the size of the part entry is also identical. The rope part entry has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 10 for rope, 76 for steel cable */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE rope_segment_length;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  INT16LE rope_connected_part_1;&lt;br /&gt;
  INT16LE rope_connected_part_2;&lt;br /&gt;
  BYTE part_1_connect_field_usage;&lt;br /&gt;
  BYTE part_2_connect_field_usage;&lt;br /&gt;
  UINT16LE unknown_44;&lt;br /&gt;
  UINT16LE unknown_46;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039;: Same flags used as in the belt part structure.&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, ropes have no true sprite (represented by one or more line segments).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for ropes, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: Similarly to belts, possible values are 0 and -1 in TIM / TEMIM; and -1 and -100 in TIM 2 / 3.&lt;br /&gt;
* &#039;&#039;&#039;rope_segment_length&#039;&#039;&#039;: The length of the rope (Euclidean distance between the two ends) if the rope does not run through pulleys. Otherwise, the length of the rope segment between the part at one end (rope_connected_part_1 (?)) and the first pulley ({{TODO|additional testing needed}}).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for pulleys.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;rope_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this rope (never the pulleys). In TIM and TEMIM, both are -1 if the rope is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;part_1_connect_field_usage&#039;&#039;&#039;, &#039;&#039;&#039;part_2_connect_field_usage&#039;&#039;&#039;: Whether &#039;&#039;connected_1&#039;&#039; or &#039;&#039;connected_2&#039;&#039; is used in the two connected parts for this rope. 0 if connected_1, 1 if connected_2. ({{TODO|additional testing needed}})&lt;br /&gt;
* &#039;&#039;&#039;unknown_44&#039;&#039;&#039;, &#039;&#039;&#039;unknown_46&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Pulleys ===&lt;br /&gt;
&lt;br /&gt;
The format of the 56-byte puzzle part entry for the pulley (part 7):&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 7 for pulley */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_y;&lt;br /&gt;
  INT16LE unknown_36;&lt;br /&gt;
  INT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE pulley_connected_1;&lt;br /&gt;
  INT16LE pulley_connected_2;&lt;br /&gt;
  INT16LE unknown_50;&lt;br /&gt;
  INT16LE unknown_52;&lt;br /&gt;
  INT16LE rope_index;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x8&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;0x0&amp;lt;/code&amp;gt; {{TODO|in some cases}})&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x48&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Pulleys can have four different sprites depending on the orientation. Possible values are 0-3.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: The size of the pulley sprite. In TIM 2 / 3, also depends on the orientation.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the pulley, top left coordinates of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;, &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for ropes.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where one rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Depends on the orientation of the pulley, like &#039;&#039;appearance&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;unknown_40&#039;&#039;, &#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_2_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where the other rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;pulley_connected_1&#039;&#039;&#039;, &#039;&#039;&#039;pulley_connected_2&#039;&#039;&#039;: Either the index of part at one of the two ends of the rope, or the index of next or previous pulley the rope is running through.&lt;br /&gt;
* &#039;&#039;&#039;unknown_50&#039;&#039;&#039;, &#039;&#039;&#039;unknown_52&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;rope_index&#039;&#039;&#039;: In TIM 2 / 3, the index of the rope part. Not used (-1) in TIM and TEMIM.&lt;br /&gt;
&lt;br /&gt;
=== Programmable ball (TIM 2 / 3) ===&lt;br /&gt;
&lt;br /&gt;
The programmable ball part is present in TIM 2 and 3, and its part type number is 87. The size of the entry is 60 bytes in total. The first 48 bytes is the same as the default part data structure, which is followed by another, 12-byte structure specific to this part. The format of the programmable ball data is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE density;&lt;br /&gt;
  UINT16LE elasticity;&lt;br /&gt;
  UINT16LE friction;&lt;br /&gt;
  INT16LE gravity_buoyancy;&lt;br /&gt;
  UINT16LE mass;&lt;br /&gt;
  UINT16LE appearance_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;density&#039;&#039;&#039;: The density of the ball, affects the buoyant force acting on the ball.&lt;br /&gt;
* &#039;&#039;&#039;elasticity&#039;&#039;&#039;: The elasticity of the ball.&lt;br /&gt;
* &#039;&#039;&#039;friction&#039;&#039;&#039;: The friction.&lt;br /&gt;
* &#039;&#039;&#039;gravity_buoyancy&#039;&#039;&#039;: A calculated parameter, using the density and the mass of the ball, as well as the gravity and the pressure set for the puzzle. If its value is negative, the ball will rise due to the buoyant force rather than fall.&lt;br /&gt;
* &#039;&#039;&#039;mass&#039;&#039;&#039;: The mass of the ball.&lt;br /&gt;
* &#039;&#039;&#039;appearance_2&#039;&#039;&#039;: Has the same value as the &#039;&#039;appearance&#039;&#039; field. The ball can have 7 different colors/patterns.&lt;br /&gt;
&lt;br /&gt;
The game has a dialog for setting the four physical properties (mass, elasticity, density, friction, in this order). However, the number stored in the data structure is not the same as the numbers shown on the program dialog. For example, if following settings are used for the ball: &amp;lt;code&amp;gt;mass = 8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 3&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;density = 7&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 3&amp;lt;/code&amp;gt;; and the default values are used for gravity/pressure, the puzzle file will contain the following values: &amp;lt;code&amp;gt;density = 3000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 128&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 16&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;gravity_buoyancy = 269&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mass = 201&amp;lt;/code&amp;gt;. (Note: There is an inconsistency in the game here, the programmable ball part uses &amp;lt;code&amp;gt;density = 2832&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mass = 200&amp;lt;/code&amp;gt; by default, which does not correspond exactly to any value that can be set in the dialog.)&lt;br /&gt;
&lt;br /&gt;
=== TIM demo version ===&lt;br /&gt;
&lt;br /&gt;
In the demo version of the (original) TIM (available at several DOS shareware game websites), the &#039;&#039;flags_3&#039;&#039;, &#039;&#039;outlet_plugged_1&#039;&#039; and &#039;&#039;outlet_plugged_2&#039;&#039; fields are missing.&lt;br /&gt;
Instead, the 42-byte part data (46 for belts, 48 for ropes, 50 for pulleys) is followed by an another, variable length data structure of unknown significance consisting of 16-bit little endian integers. It is always at least 2 bytes long, and the first two bytes contain the number of additional 16-bit words after this size word. The reverse engineering of this structure is complicated by the fact that it is only present in a demo version containing only 8 puzzles.&lt;br /&gt;
&lt;br /&gt;
== Puzzle solution information ==&lt;br /&gt;
&lt;br /&gt;
Puzzle solution information is only present in TIM 2 and TIM 3 puzzles. Its size is always 132 bytes and can contain 8 different conditions that must be satisfied so that the game will recognize the puzzle as solved. The first two bytes contains the number of such conditions actually set, in a 16-bit little endian format. This is followed by 8 entries, 16 bytes each, containing the required information for solution checking by the game. The format of each entry is:&lt;br /&gt;
&lt;br /&gt;
  INT16LE part_index;&lt;br /&gt;
  UINT16LE part_state_1;&lt;br /&gt;
  UINT16LE part_state_2;&lt;br /&gt;
  UINT16LE part_count;&lt;br /&gt;
  INT16LE position_rect_x;&lt;br /&gt;
  INT16LE position_rect_y;&lt;br /&gt;
  INT16LE position_rect_width;&lt;br /&gt;
  INT16LE position_rect_height;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_index&#039;&#039;&#039;: The index of the part in the puzzle file involved in the solution. -1 (0xFF 0xFF) for unused entries.&lt;br /&gt;
* &#039;&#039;&#039;part_state_1&#039;&#039;&#039;: An ID for a &amp;quot;physical state&amp;quot; of a part (for example a balloon was popped or a candle was lit). In many puzzles, one specific part must be in a specified &amp;quot;physical state&amp;quot; in order to complete the level. This is the same ID for a &amp;quot;part state&amp;quot; as the &#039;&#039;first_frame_id&#039;&#039; member found in the C section of the part&#039;s ANM file.&lt;br /&gt;
* &#039;&#039;&#039;part_state_2&#039;&#039;&#039;: Another ID for a &amp;quot;physical state&amp;quot;, the exact meaning is unclear.&lt;br /&gt;
* &#039;&#039;&#039;part_count&#039;&#039;&#039;: The value of the &amp;quot;Part count&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_x&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_y&#039;&#039;&#039;: The top left corner of the &amp;quot;position rectangle&amp;quot;. If such a solution specified puzzle part must be located within this rectangle in order to solve the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_width&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_height&#039;&#039;&#039;: Width and height of the &amp;quot;position rectangle&amp;quot;, see above.&lt;br /&gt;
&lt;br /&gt;
For the last four members (&amp;quot;position rectangle&amp;quot;), there are &amp;quot;fixed&amp;quot; combinations of values with special meaning:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-1, -1, -1, -1&amp;lt;/code&amp;gt;: &amp;quot;Off screen&amp;quot;, the part must leave the area visible on the game screen.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, -2000, 1640, 2000&amp;lt;/code&amp;gt;: &amp;quot;Off top&amp;quot;, the part must leave the visible area at the top.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, 400, 1640, 3000&amp;lt;/code&amp;gt;: &amp;quot;Off bottom&amp;quot;&lt;br /&gt;
* &amp;lt;code&amp;gt;0, 0, 0, 0&amp;lt;/code&amp;gt;: No such solution programmed, either this is &amp;quot;part state&amp;quot; solution or an unused entry (&amp;lt;code&amp;gt;part_index = -1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The last 2 bytes of the section contain the value of the &amp;quot;Delay&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game, in 16-bit little endian format.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note on puzzle solution information in TIM and TEMIM&#039;&#039;&#039;: TIM / TEMIM puzzles do not contain such data. This can also be demonstrated by extracting e.g. &amp;lt;tt&amp;gt;L1.LEV&amp;lt;/tt&amp;gt; from the archive file and rename the file to change the number. After starting the game, the level with the same number as the renamed file will be replaced with level 1. When playing the modified level, the game will not be able to check whether the puzzle is solved. Depending on its number, the level can become unwinnable or winnable by just clicking on the start machine button. Sometimes the game freezes.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
{{BeginFileFormatTools|Type=map}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [https://www.vogons.org/viewtopic.php?p=1089143#p1089143 The Incredible Machine level/image resource viewer] &lt;br /&gt;
| Platform = Windows, Linux&lt;br /&gt;
| canView = Yes&lt;br /&gt;
&amp;lt;!-- | canExport = Yes --&amp;gt;&lt;br /&gt;
| canCreate = No&lt;br /&gt;
| canModify = No&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes = &lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
{{TODO|Level viewer will be published soon}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Image_Format&amp;diff=10608</id>
		<title>The Incredible Machine Image Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Image_Format&amp;diff=10608"/>
		<updated>2022-07-22T21:39:54Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Tools */ New version of program&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Tileset Infobox&lt;br /&gt;
 | Hardware1 = EGA &lt;br /&gt;
 | Hardware2 = VGA&lt;br /&gt;
 | MaxTiles = 65535&lt;br /&gt;
 | Palette = Shared&lt;br /&gt;
 | Names = N&lt;br /&gt;
 | TileMinSize = 1x1&lt;br /&gt;
 | TileMaxSize = 65535&amp;amp;times;65535&lt;br /&gt;
 | NumPlanes = 1&lt;br /&gt;
 | PlaneArrangement = Linear&lt;br /&gt;
 | HasTransparency = Y&lt;br /&gt;
 | Metadata = None&lt;br /&gt;
 | Subtilesets = N&lt;br /&gt;
 | Compressed = Y&lt;br /&gt;
 | Hidden = Y&lt;br /&gt;
 | Games =&lt;br /&gt;
            {{Game|The Incredible Machine}}&lt;br /&gt;
            {{Game|The Even More Incredible Machine}}&lt;br /&gt;
            {{Game|The Incredible Machine 2}}&lt;br /&gt;
            {{Game|Heart of China}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The Incredible Machine&#039;&#039;&#039; (TIM) &#039;&#039;&#039;bitmap images&#039;&#039;&#039; are stored in the &amp;lt;tt&amp;gt;RESOURCE.00?&amp;lt;/tt&amp;gt; [[TIM Resource Format|resource files]] as sub-files. They have the extension &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(For full-screen images (&amp;lt;tt&amp;gt;*.SCR&amp;lt;/tt&amp;gt;), see [[RES Format (Stellar 7)#SCR: Fullscreen image|Stellar 7 RES Format]].)&lt;br /&gt;
&lt;br /&gt;
== Chunk format ==&lt;br /&gt;
&lt;br /&gt;
The files are built up out of chunks, in the typical Dynamix chunk format: a 3-character ID, followed by a &#039;:&#039;, followed by the chunk size in [[UINT32LE]] format. The highest bit of the chunk size value is not actually part of the chunk size: it is set to 1 if the chunk is a container-type chunk that contains more chunks inside itself. This chunk format is documented on the [[RES Format (Stellar 7)#BMP: images|Stellar 7 RES Format]] page.&lt;br /&gt;
&lt;br /&gt;
The BMP file is contained inside one &amp;lt;tt&amp;gt;BMP&amp;lt;/tt&amp;gt; chunk. This is a container chunk. None of chunks types embedded inside it are container chunks.&lt;br /&gt;
&lt;br /&gt;
The first chunk inside the &amp;lt;tt&amp;gt;BMP&amp;lt;/tt&amp;gt; data is the &amp;lt;tt&amp;gt;INF&amp;lt;/tt&amp;gt; chunk. Its data starts with a [[UINT16LE]] indicating the number of sub-images inside the file, followed by two UINT16LE arrays containing respectively the widths and heights of all images.&lt;br /&gt;
&lt;br /&gt;
Based on the chunk type that contains the image data, there are two types of images:&lt;br /&gt;
&lt;br /&gt;
== SCN/OFF format ==&lt;br /&gt;
&lt;br /&gt;
The majority of the image files in &#039;&#039;The Incredible Machine&#039;&#039;, including the graphics for puzzle parts, contain an &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; and an &amp;lt;tt&amp;gt;OFF&amp;lt;/tt&amp;gt; chunk. The image data is stored in the &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk, while the &amp;lt;tt&amp;gt;OFF&amp;lt;/tt&amp;gt; chunk contains an index for each sub-image&#039;s data inside the &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk. The &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk has its own compression format, described in the next section.&lt;br /&gt;
&lt;br /&gt;
=== The SCN chunk ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk contains the pixel data for each sub-image. Basically, it has an extended [[RLE Compression#Code|code-based run-length encoding]] format with 2-bit commands. This gives four commands; the classic &amp;quot;repeat&amp;quot; and &amp;quot;copy&amp;quot; ones, and two extra commands to skip ahead. These &amp;quot;skips&amp;quot; should always treat the skipped space as transparent. If the output buffer is not cleared in advance, and the decompression is not meant to directly paint the new graphics onto an existing image in the buffer, these commands might need to specifically write 0-values to fill the skipped pixels.&lt;br /&gt;
&lt;br /&gt;
The data for each sub-image starts with an &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt; byte that has a special meaning: its value is added to all non-transparent pixel values. It normally corresponds to the lowest pixel value found in the resulting image. The value of this byte is set to 0xFF in some &amp;quot;empty&amp;quot; images that contain only a few transparent pixels. &lt;br /&gt;
In 8-bit games, like [[Heart of China]], the result may be an 8-bit image, meaning &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt;, and the resulting pixel values, can be larger than 0x0F. The compression itself is based on storage of 4-bit pixels, though, so even on 8-bit images, the final data can only contain values from &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt; up to &amp;lt;code&amp;gt;addValue + 0x0F&amp;lt;/code&amp;gt;, plus the background colour. This special handling of transparency makes sure that the full range of the 4 bits can be used for colours, without the need to sacrifice one for transparency. This does make it difficult to convert to classic image formats without upgrading the image to at least 8-bit.&lt;br /&gt;
&lt;br /&gt;
The actual RLE codes start after this byte. The &amp;lt;code&amp;gt;command&amp;lt;/code&amp;gt; is made from the upper two bits, with the lower six bits serving as the &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that this &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; always denotes a number of &#039;&#039;pixels&#039;&#039;, not bytes, which may be tricky to program for 4-bit images. An alternative approach could be to decompress the image to an 8-bit buffer, and post-process the result to compact it to 4-bit (unless the &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt; makes the values too large for that, and it is intended to be 8-bit).&lt;br /&gt;
&lt;br /&gt;
The four different commands are:&lt;br /&gt;
&lt;br /&gt;
==== Command 0: Line skip ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;command&amp;lt;/code&amp;gt; made from high bits &amp;lt;tt&amp;gt;00&amp;lt;/tt&amp;gt; is meant to skip to the next line in the image. This command &#039;&#039;must&#039;&#039; be used to terminate a line in the image; the format does not seem to support automatic wraparound for progressing to a new line. This also means none of the other commands will ever write data that goes beyond the end of a line.&lt;br /&gt;
&lt;br /&gt;
The line skip command will move the output pointer down one line on the image (ending up on the same X-coordinate on the next line), and then move back by the amount of pixels specified in &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;. With wraparound included, this means the operation simply jumps (or background-fills) to the position &amp;lt;code&amp;gt;width - value&amp;lt;/code&amp;gt; pixels ahead of your current output write position.&lt;br /&gt;
&lt;br /&gt;
There are some special cases in this, though. Since this should be able to move from the end of one line to the start of the next one, it needs to be able to address the entire width of the image, which, on large images, can&#039;t be done in one 6-bit value. Because of this, the data may contain two consecutive bytes with a &#039;line skip&#039; command, and the values of both of these need to be taken together, with the second command providing the more significant seventh to twelfth bits to be added to the first read value, as &amp;lt;code&amp;gt;value = value1 | (value2 &amp;lt;&amp;lt; 6)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
However, if an image has several empty lines in it, it can be unclear whether or not such commands should be taken together. Because of this, if the second command has a &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; of 0, the rule is to always treat it as separate command. To avoid all ambiguity in these cases, and because a &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; 00 code &#039;&#039;can&#039;&#039; be extended by one with a higher &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;, if the non-empty pixels on that later line start at an X-coordinate earlier than the first empty pixel on that earlier line, the first line skip command will &#039;&#039;&#039;always&#039;&#039;&#039; align the X-coordinate with the point at which the data restarts after the gap, so that all commands following it can be non-ambiguous byte 00 full line skips. Note that if the pixel appears at an identical or higher X-coordinate, all line skips can be done with 00 bytes, and any remaining distance can simply be filled up with &#039;short skip&#039; commands (see below), which can perfectly be placed after the 00 bytes.&lt;br /&gt;
&lt;br /&gt;
==== Command 1: Short skip ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;command&amp;lt;/code&amp;gt; you get when the high bits are &amp;lt;tt&amp;gt;01&amp;lt;/tt&amp;gt; will skip (or background-fill) the amount of pixels specified in &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;. Numbers greater than 0x3F will simply be encoded in multiple &#039;short skip&#039; commands. A &#039;short skip&#039; command with a &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; of 0, resulting in a Code byte 0x40, is used to indicate the end of the decompression of the current sub-image.&lt;br /&gt;
&lt;br /&gt;
==== Command 2: Repeat ====&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;command&amp;lt;/code&amp;gt; made up of bits &amp;lt;tt&amp;gt;10&amp;lt;/tt&amp;gt; will create a sequence of pixels of the same color. The repeat count is specified by &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;. A single byte follows the Code byte, containing the pixel value. Since this is a 4-bit format, the most significant 4 bits of this byte are always zero. Note that the &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt; from the start of the data needs to be added to this to get the real pixel value to repeat.&lt;br /&gt;
&lt;br /&gt;
==== Command 3: Copy ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;command&amp;lt;/code&amp;gt; from high bits &amp;lt;tt&amp;gt;11&amp;lt;/tt&amp;gt; is the Copy command. This simply copies a sequence of pixel values to the output. The amount of pixels is specified in &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Since the amount is in pixels, the number of bytes after the Code byte does not match the &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt;. It can be calculated as &amp;lt;code&amp;gt;(value + 1) &amp;gt;&amp;gt; 1&amp;lt;/code&amp;gt;. Each byte contains two pixels, with the color of the leftmost pixel stored in the most significant nibble. If the number of pixels is odd, the most significant 4 bits of the last byte contains the color of the last pixel, and the less significant nibble is zero. Note that since the  &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt; from the start of the data needs to be added to every pixel in this range, and the starting position to write pixels to may be an odd number at the start of the command, this operation requires treating all data as nibbles to process them correctly.&lt;br /&gt;
&lt;br /&gt;
==== Terminator ====&lt;br /&gt;
&lt;br /&gt;
Nearly all sub-images are &amp;quot;terminated&amp;quot; by the byte sequence 0x00 0x40; a full line skip, followed by an empty short skip command. However, there are a few exceptions, where it ends on 0x40 alone. Do note that while a 0x40 can always be considered a terminator command, since it has no real meaning on its own, a 0x00 is a perfectly valid full-line skip, and should never be treated as a signal to end the decompression.&lt;br /&gt;
&lt;br /&gt;
=== The OFF chunk ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;OFF&amp;lt;/tt&amp;gt; chunk contains the offsets for each sub-image in the &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk, as [[UINT32LE]] values. The first one should always be zero.&lt;br /&gt;
&lt;br /&gt;
The end of the current sub-image&#039;s compressed data in the &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk can be determined from the start of the next offset in the list, or the length of the &amp;lt;tt&amp;gt;SCN&amp;lt;/tt&amp;gt; chunk, if it&#039;s the final image. In practice, though, the data itself will always indicate the end with the 0x40 terminator value.&lt;br /&gt;
&lt;br /&gt;
=== Format quirks ===&lt;br /&gt;
&lt;br /&gt;
Since the &#039;line skip&#039; command is the only valid way to progress to a new line, and this can only address up to 12 bits, images in this format are technically restricted to a width of up to 4095 pixels.&lt;br /&gt;
&lt;br /&gt;
== BIN format ==&lt;br /&gt;
&lt;br /&gt;
The remaining files in &#039;&#039;The Incredible Machine&#039;&#039; use a &amp;lt;tt&amp;gt;BIN&amp;lt;/tt&amp;gt; chunk (e.g. &amp;lt;tt&amp;gt;MOUSE.BMP&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;PARTBIN.BMP&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;BIN&amp;lt;/tt&amp;gt; chunk has a small header of one byte to indicate the compression algorithm, followed by a [[UINT32LE]] giving the uncompressed size. It supports the same compression algorithms as [[Dynamix Font Format v4-v5#Compression|Dynamix fonts]]. The header is immediately followed by the compressed 4bpp pixel data.&lt;br /&gt;
&lt;br /&gt;
This format is the 4 bit per pixel version of [[RES Format (Stellar 7)#BMP: Image|the BIN/VGA-containing BMP format]] found in several 8-bit Dynamix games.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=image}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [https://www.vogons.org/viewtopic.php?p=1089143#p1089143 The Incredible Machine level/image resource viewer] &lt;br /&gt;
| Platform = Windows, Linux&lt;br /&gt;
| canView = Yes&lt;br /&gt;
| canExport = Yes&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes = &lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [https://www.vogons.org/viewtopic.php?f=5&amp;amp;t=76910 The Incredible Machine image resource reader] &amp;lt;small&amp;gt;Note: outdated version&amp;lt;/small&amp;gt;&lt;br /&gt;
| Platform = Windows, Linux&lt;br /&gt;
| canView = Yes&lt;br /&gt;
| canExport = Yes&lt;br /&gt;
| canImport = No&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes = &lt;br /&gt;
}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Engie File Converter]]&lt;br /&gt;
| Platform = Windows&lt;br /&gt;
| canView = Yes&lt;br /&gt;
| canExport = Yes&lt;br /&gt;
| canImport = Yes&lt;br /&gt;
| editHidden = No&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
| notes = Supports &amp;lt;tt&amp;gt;SCN/OFF&amp;lt;/tt&amp;gt; files with a high &amp;lt;code&amp;gt;addValue&amp;lt;/code&amp;gt; byte, treating them as 8-bit.&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
The SCN compression was reverse engineered by [[User:Knt47|Knt47]], with further detail research conducted by [[User:Nyerguds|Nyerguds]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;br /&gt;
&lt;br /&gt;
[[Category:Sierra/Dynamix File Formats]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10593</id>
		<title>The Incredible Machine 2-3 ANM File Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10593"/>
		<updated>2022-07-21T16:14:19Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Credits */ category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The &#039;&#039;&#039;animation&#039;&#039;&#039; (&amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt;) sub-files are found in the [[TIM Resource Format|archive file]] of [[The Incredible Machine 2]] (TIM 2) and [[Thie Incredible Machine 3|3]] (TIM 3). They contain the information required for drawing puzzle part sprites, which are often comprised of multiple sub-images of [[The Incredible Machine Image Format|image files]] and for animations of the puzzle parts. They are also used for animated parts of the game&#039;s user interface (for example the animated icons of the main menu). It can also contain commands for playing sound effects.&lt;br /&gt;
&lt;br /&gt;
Most &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files (all in TIM 2) contain two chunks, starting with &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;  and &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, respectively. Both use the typical &amp;quot;Dynamix chunk&amp;quot; format, starting with the 4-byte chunk type (&amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;/&amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, followed by the chunk size in 32-bit, little endian format. Unlike other Dynamix file formats, the most significant bit in the 32-bit size of the first chunk is not set. A small number of files in TIM 3 contain a third chunk, &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot;, with an unclear meaning.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;ANM:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
Not counting the chunk type and size, an &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt; chunk has five parts, a 16 or 22 byte header, and four sections containing the actual sprite/animation frame/animation data, labeled here as A-D.&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk (not counting the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the chunk size) starts with a header, with a size of 16 or 22 bytes, depending on the magic number. It has the following Format:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] magic_number_1;&lt;br /&gt;
  UINT16LE magic_number_2;&lt;br /&gt;
  UINT16LE size_section_a;&lt;br /&gt;
  UINT16LE size_section_b;&lt;br /&gt;
  UINT16LE size_section_c;&lt;br /&gt;
  UINT16LE size_section_d;&lt;br /&gt;
  UINT16LE anm_width;&lt;br /&gt;
  UINT16LE anm_height;&lt;br /&gt;
  /* 3 members, found only in files with a magic number of 0x54 0x42 0xEA 0x03: */&lt;br /&gt;
  UINT16LE unknown_16;&lt;br /&gt;
  UINT16LE unknown_18;&lt;br /&gt;
  UINT16LE unknown_20;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;magic_number_1&#039;&#039;&#039;, &#039;&#039;&#039;magic_number_2&#039;&#039;&#039;:  The header starts with a 4-byte magic number. The first two bytes are always 0x54 0x42. The second two bytes are a 16-bit little endian file version number. In TIM 2, the possible values 1000 (0x3E8) or 1001 (0x3E9). There is no obvious difference in the format of the files using these two numbers, however, 0x3E9 is much more common and 0x3E8 is mostly used for relatively small and simple files. In TIM 3, a small number of files use a newer version of the &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; file format, with a magic_number_2 value of 1002 (0x3EA). Such files have a slightly different format compared to files with the other two numbers. The &amp;quot;newer&amp;quot; format is used in the user interface and the game menu, but never for puzzle part graphics.&lt;br /&gt;
* &#039;&#039;&#039;size_section_a&#039;&#039;&#039;: The number of entries in the A section of the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, one entry is 2 byte (i.e. the section is an array of 16-bit integers). Several files do not have an A section (size_section_a == 0)&lt;br /&gt;
* &#039;&#039;&#039;size_section_b&#039;&#039;&#039;: The number of entries in the B section. One entry is 12 bytes in the files in files with &amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;, 10 bytes in all other files.&lt;br /&gt;
* &#039;&#039;&#039;size_section_c&#039;&#039;&#039;: The number of entries in the C section, one entry is 4 bytes.&lt;br /&gt;
* &#039;&#039;&#039;size_section_d&#039;&#039;&#039;: The size of the D section in bytes.&lt;br /&gt;
* &#039;&#039;&#039;anm_width&#039;&#039;&#039;, &#039;&#039;&#039;anm_height&#039;&#039;&#039;: Width and height of the animation. In &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts, the two structure members usually have the same value as width_1 and height_1 for the part in puzzle/level files.   &lt;br /&gt;
&lt;br /&gt;
Structure members found only in files with the longer header (&amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;unknown_16&#039;&#039;&#039;: 0x14 in all files, perhaps the size of header minus magic_number_1. Files with the longer header do not contain additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, so it cannot be a size of such a section.&lt;br /&gt;
* &#039;&#039;&#039;unknown_18&#039;&#039;&#039;: 0 in all files&lt;br /&gt;
* &#039;&#039;&#039;unknown_20&#039;&#039;&#039;: 0x17 in one file, 0 in all others. Clearly not the size of an additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section A ===&lt;br /&gt;
&lt;br /&gt;
Section A is empty in a large number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files. If present, it is an array of 16-bit little endian integers. It contains all numbers from 0 to the number of items in B section minus 1, in increasing order, with some numbers repeated. For example &amp;lt;code&amp;gt;0 1 1 1 2&amp;lt;/code&amp;gt; means that the animation frame with index 1 in section B must be shown for the duration of 3 timer ticks instead of 1.&lt;br /&gt;
&lt;br /&gt;
=== Section B ===&lt;br /&gt;
&lt;br /&gt;
Section B is a list of structures containing 16 bit integer members, 6 if magic_number_2 is &amp;lt;tt&amp;gt;0x3EA&amp;lt;/tt&amp;gt;, 5 in the other versions of the file format. It contains essential information about each animation frame. One structure has the following members:&lt;br /&gt;
&lt;br /&gt;
  [[INT16LE]] relative_pos_x;&lt;br /&gt;
  INT16LE relative_pos_y;&lt;br /&gt;
  UINT16LE width;&lt;br /&gt;
  UINT16LE height;&lt;br /&gt;
  UINT16LE section_d_offset;&lt;br /&gt;
  /* Note that the last member is only present in files with */&lt;br /&gt;
  /*     magic number 0x54 0x42 0xEA 0x03 */&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;relative_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;relative_pos_y&#039;&#039;&#039;: The coordinates where the animation frame must be drawn, relative to other frames. For the first item in the B section, the value of both tare typically 0, however there are a few exceptions. The relative position may be negative.&lt;br /&gt;
* &#039;&#039;&#039;width&#039;&#039;&#039;, &#039;&#039;&#039;height&#039;&#039;&#039;: The width and the height of the graphics in the specific animation frame.&lt;br /&gt;
* &#039;&#039;&#039;section_d_offset&#039;&#039;&#039;: An offset in section D, points to the first command required for drawing the animation frame.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: The meaning is unclear. Often, but not always a number divisible by 3. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section C ===&lt;br /&gt;
&lt;br /&gt;
A section C item has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE first_frame_id;&lt;br /&gt;
  UINT16LE state_id;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;first_frame_id&#039;&#039;&#039;: The meaning of &#039;&#039;first_frame_id&#039;&#039; is slightly different between files containing or not containing an A section. If the A section is not present, this is the index in section B for the first animation frame for a particular animation. If there is an A section, &#039;&#039;first_frame_id&#039;&#039; is an index in the A section, and the 16-bit array item at this index is the required section B index. The section B indices determined this way essentially divide the B section into sub-sectons. One sub-section corresponds to the &amp;quot;animation&amp;quot; of a puzzle part or an user interface element in one specific state. If an &amp;quot;animation&amp;quot; has only one section B item, then the puzzle part or button/icon is not animated in this state.&lt;br /&gt;
* &#039;&#039;&#039;state_id&#039;&#039;&#039;: An internal identifier used by the game for a state of the puzzle part or an user interface element. In a specific &amp;quot;state&amp;quot;, the puzzle part (or user interface element) may or may not be animated, the animation frames belonging to such a state must be determined using the first_frame_id member.&lt;br /&gt;
&lt;br /&gt;
=== Section D ===&lt;br /&gt;
&lt;br /&gt;
The D section contains the instructions on how to draw each animation frame (or to play a sound). The section_d_offset field in the corresponding section B entry determines where the sequence of commands start for each animation frame. There are 6 different types of commands, numbered 0-5. Each command starts with its number in a 16-bit, little endian format. For commands 2-5, this is followed by a list of 16-bit integer parameters, the number of the parameters depends on command number.&lt;br /&gt;
 &lt;br /&gt;
==== Command 0: End of animation frame ====&lt;br /&gt;
&lt;br /&gt;
Command 0 indicates the end of an animation frame in the file. It terminates the list of commands associated with a section B item. Command 0 has no parameters and is always 2 bytes long (the 16-bit command number).&lt;br /&gt;
&lt;br /&gt;
==== Command 1: End of &amp;quot;ANM:&amp;quot; chunk ====&lt;br /&gt;
&lt;br /&gt;
The last two bytes of section D (and the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk) are always &amp;lt;code&amp;gt;01 00&amp;lt;/code&amp;gt; (1 in 16-bit little endian format). These two bytes can be interpreted as a 2-byte command that terminates section D and the entire &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. Command 1 is not found anywhere else in section D.&lt;br /&gt;
&lt;br /&gt;
==== Command 2: Draw BMP sub-image ====&lt;br /&gt;
&lt;br /&gt;
Command 2 is an instruction for the  game engine to draw a sub-image from a &amp;lt;/tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; image stored in the archive file of the game. It should be noted that a part sprite is often &amp;quot;cut into&amp;quot; multiple &amp;lt;/tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub images, and in a few cases, they are stored in more than one file. Command 2 has five 16-bit integer parameters (size is 12 bytes, including the command number).&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 2 */&lt;br /&gt;
  UINT16LE bmp_file_num;&lt;br /&gt;
  UINT16LE bmp_sub_image_num;&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE flip;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bmp_file_num&#039;&#039;&#039;: Index of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file in the TAG: chunk. The index of the first image is 1.&lt;br /&gt;
* &#039;&#039;&#039;bmp_sub_image_num&#039;&#039;&#039;: The &amp;quot;sub-image&amp;quot; number of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file to draw. [[The Incredible Machine Image Format|&amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; images in TIM 2]]  can have multiple sub images.&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: The position of the image (top left corner), relative to the x and y&lt;br /&gt;
coordinates in the corresponding section B item.&lt;br /&gt;
* &#039;&#039;&#039;flip&#039;&#039;&#039;: The image can be drawn horizontally and/or vertically flipped relative to its original orientation. 1 = vertical flip, 2 = horizontal flip, 3 = both, 0 = no such transform is applied.&lt;br /&gt;
&lt;br /&gt;
==== Command 3: Draw rectangle ====&lt;br /&gt;
&lt;br /&gt;
Command 3 draws a rectangle with a border and fill color provided as arguments. It is mainly used in user interface elements and in the graphics shown in the part help screen, rarely in puzzle part graphics. It has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 3 */&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE rect_width;&lt;br /&gt;
  UINT16LE rect_height;&lt;br /&gt;
  UINT16LE border_color;&lt;br /&gt;
  UINT16LE fill;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: Coordinates of the top left corner of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;rect_width&#039;&#039;&#039;, &#039;&#039;&#039;rect_height&#039;&#039;&#039;: The width and height of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;border_color&#039;&#039;&#039;: The border color for the rectangle. In TIM 2, one color from the 16-color palette.&lt;br /&gt;
* &#039;&#039;&#039;fill&#039;&#039;&#039;: The value of the &#039;&#039;fill&#039;&#039; parameter is either 0 - no fill, border only - or a value between 0x8000 and 0x800f where the least significant nibble contains the fill color.&lt;br /&gt;
&lt;br /&gt;
==== Command 4: Draw line ====&lt;br /&gt;
&lt;br /&gt;
Command 4 draws a line between two end points with a specific color. Like the rectangle command, it is mainly used for game interface graphics, not the puzzle parts. The format of the command is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 4 */&lt;br /&gt;
  INT16LE x1;&lt;br /&gt;
  INT16LE y1;&lt;br /&gt;
  INT16LE x2;&lt;br /&gt;
  INT16LE y2;&lt;br /&gt;
  UINT16LE line_color;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;x1&#039;&#039;&#039;, &#039;&#039;&#039;y1&#039;&#039;&#039;: The coordinates of one end point.&lt;br /&gt;
* &#039;&#039;&#039;x2&#039;&#039;&#039;, &#039;&#039;&#039;y2&#039;&#039;&#039;: The coordinates of the other end point.&lt;br /&gt;
* &#039;&#039;&#039;line_color&#039;&#039;&#039;: The color of the line, one color from the 16-color palette in TIM 2.&lt;br /&gt;
&lt;br /&gt;
==== Command 5: Play sound ====&lt;br /&gt;
&lt;br /&gt;
If the command list for an animation frame includes command 5, a sound effect will be played when the particular frame is shown. It has one 16-bit parameter, the ID of the sound. TIM 2 contains sounds in two different formats. Sounds with a number &amp;gt;= 3000 are stored in the archive file of the game (&amp;lt;tt&amp;gt;SX_3???.RAW&amp;lt;/tt&amp;gt;). .RAW files are uncompressed 8-bit PCM audio files without any header. The rest of the files (with numbers &amp;lt; 300) are found in &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;.&lt;br /&gt;
TIM 3 has &amp;lt;tt&amp;gt;.WAV&amp;lt;/tt&amp;gt; files instead in the archive file an there is no &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;. ({{TODO|TIM 3 sounds with numbers below 3000}}).&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;TAG:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk contains the names of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub-files (in the archive file of the game) required for displaying the animation. Not counting the &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the 32-bit chunk size, the first two bytes of the data contains the number of image file names in 16-bit little endian format. The remaining part of the data is the list of image file name entries. A single entry is a 16-bit image ID followed by a null-terminated string containing the name of the image. In TIM 2, the ID of the first image is always 1, however, there are exceptions to this rule in TIM 3 (but never in part graphics). There is no gap in the numbering of the images, this makes the image ID field somewhat redundant.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;LAB:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is present in a small number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files in TIM 3. &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts never contain such a chunk. The structure of the &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is similar to &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, it consists of the number of entries stored as 16-bit integer, followed by item ID-null terminated string pairs. The strings are apparently not user interface texts visible to the player. &lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TODO, this file format does not really belong to any file format category in this site --&amp;gt;&lt;br /&gt;
[[Category:All file formats]]&lt;br /&gt;
[[Category:The Incredible Machine 2]]&lt;br /&gt;
[[Category:The Incredible Machine 3]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10592</id>
		<title>The Incredible Machine 2-3 ANM File Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10592"/>
		<updated>2022-07-21T16:12:53Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Credits */ category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The &#039;&#039;&#039;animation&#039;&#039;&#039; (&amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt;) sub-files are found in the [[TIM Resource Format|archive file]] of [[The Incredible Machine 2]] (TIM 2) and [[Thie Incredible Machine 3|3]] (TIM 3). They contain the information required for drawing puzzle part sprites, which are often comprised of multiple sub-images of [[The Incredible Machine Image Format|image files]] and for animations of the puzzle parts. They are also used for animated parts of the game&#039;s user interface (for example the animated icons of the main menu). It can also contain commands for playing sound effects.&lt;br /&gt;
&lt;br /&gt;
Most &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files (all in TIM 2) contain two chunks, starting with &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;  and &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, respectively. Both use the typical &amp;quot;Dynamix chunk&amp;quot; format, starting with the 4-byte chunk type (&amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;/&amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, followed by the chunk size in 32-bit, little endian format. Unlike other Dynamix file formats, the most significant bit in the 32-bit size of the first chunk is not set. A small number of files in TIM 3 contain a third chunk, &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot;, with an unclear meaning.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;ANM:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
Not counting the chunk type and size, an &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt; chunk has five parts, a 16 or 22 byte header, and four sections containing the actual sprite/animation frame/animation data, labeled here as A-D.&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk (not counting the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the chunk size) starts with a header, with a size of 16 or 22 bytes, depending on the magic number. It has the following Format:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] magic_number_1;&lt;br /&gt;
  UINT16LE magic_number_2;&lt;br /&gt;
  UINT16LE size_section_a;&lt;br /&gt;
  UINT16LE size_section_b;&lt;br /&gt;
  UINT16LE size_section_c;&lt;br /&gt;
  UINT16LE size_section_d;&lt;br /&gt;
  UINT16LE anm_width;&lt;br /&gt;
  UINT16LE anm_height;&lt;br /&gt;
  /* 3 members, found only in files with a magic number of 0x54 0x42 0xEA 0x03: */&lt;br /&gt;
  UINT16LE unknown_16;&lt;br /&gt;
  UINT16LE unknown_18;&lt;br /&gt;
  UINT16LE unknown_20;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;magic_number_1&#039;&#039;&#039;, &#039;&#039;&#039;magic_number_2&#039;&#039;&#039;:  The header starts with a 4-byte magic number. The first two bytes are always 0x54 0x42. The second two bytes are a 16-bit little endian file version number. In TIM 2, the possible values 1000 (0x3E8) or 1001 (0x3E9). There is no obvious difference in the format of the files using these two numbers, however, 0x3E9 is much more common and 0x3E8 is mostly used for relatively small and simple files. In TIM 3, a small number of files use a newer version of the &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; file format, with a magic_number_2 value of 1002 (0x3EA). Such files have a slightly different format compared to files with the other two numbers. The &amp;quot;newer&amp;quot; format is used in the user interface and the game menu, but never for puzzle part graphics.&lt;br /&gt;
* &#039;&#039;&#039;size_section_a&#039;&#039;&#039;: The number of entries in the A section of the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, one entry is 2 byte (i.e. the section is an array of 16-bit integers). Several files do not have an A section (size_section_a == 0)&lt;br /&gt;
* &#039;&#039;&#039;size_section_b&#039;&#039;&#039;: The number of entries in the B section. One entry is 12 bytes in the files in files with &amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;, 10 bytes in all other files.&lt;br /&gt;
* &#039;&#039;&#039;size_section_c&#039;&#039;&#039;: The number of entries in the C section, one entry is 4 bytes.&lt;br /&gt;
* &#039;&#039;&#039;size_section_d&#039;&#039;&#039;: The size of the D section in bytes.&lt;br /&gt;
* &#039;&#039;&#039;anm_width&#039;&#039;&#039;, &#039;&#039;&#039;anm_height&#039;&#039;&#039;: Width and height of the animation. In &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts, the two structure members usually have the same value as width_1 and height_1 for the part in puzzle/level files.   &lt;br /&gt;
&lt;br /&gt;
Structure members found only in files with the longer header (&amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;unknown_16&#039;&#039;&#039;: 0x14 in all files, perhaps the size of header minus magic_number_1. Files with the longer header do not contain additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, so it cannot be a size of such a section.&lt;br /&gt;
* &#039;&#039;&#039;unknown_18&#039;&#039;&#039;: 0 in all files&lt;br /&gt;
* &#039;&#039;&#039;unknown_20&#039;&#039;&#039;: 0x17 in one file, 0 in all others. Clearly not the size of an additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section A ===&lt;br /&gt;
&lt;br /&gt;
Section A is empty in a large number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files. If present, it is an array of 16-bit little endian integers. It contains all numbers from 0 to the number of items in B section minus 1, in increasing order, with some numbers repeated. For example &amp;lt;code&amp;gt;0 1 1 1 2&amp;lt;/code&amp;gt; means that the animation frame with index 1 in section B must be shown for the duration of 3 timer ticks instead of 1.&lt;br /&gt;
&lt;br /&gt;
=== Section B ===&lt;br /&gt;
&lt;br /&gt;
Section B is a list of structures containing 16 bit integer members, 6 if magic_number_2 is &amp;lt;tt&amp;gt;0x3EA&amp;lt;/tt&amp;gt;, 5 in the other versions of the file format. It contains essential information about each animation frame. One structure has the following members:&lt;br /&gt;
&lt;br /&gt;
  [[INT16LE]] relative_pos_x;&lt;br /&gt;
  INT16LE relative_pos_y;&lt;br /&gt;
  UINT16LE width;&lt;br /&gt;
  UINT16LE height;&lt;br /&gt;
  UINT16LE section_d_offset;&lt;br /&gt;
  /* Note that the last member is only present in files with */&lt;br /&gt;
  /*     magic number 0x54 0x42 0xEA 0x03 */&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;relative_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;relative_pos_y&#039;&#039;&#039;: The coordinates where the animation frame must be drawn, relative to other frames. For the first item in the B section, the value of both tare typically 0, however there are a few exceptions. The relative position may be negative.&lt;br /&gt;
* &#039;&#039;&#039;width&#039;&#039;&#039;, &#039;&#039;&#039;height&#039;&#039;&#039;: The width and the height of the graphics in the specific animation frame.&lt;br /&gt;
* &#039;&#039;&#039;section_d_offset&#039;&#039;&#039;: An offset in section D, points to the first command required for drawing the animation frame.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: The meaning is unclear. Often, but not always a number divisible by 3. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section C ===&lt;br /&gt;
&lt;br /&gt;
A section C item has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE first_frame_id;&lt;br /&gt;
  UINT16LE state_id;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;first_frame_id&#039;&#039;&#039;: The meaning of &#039;&#039;first_frame_id&#039;&#039; is slightly different between files containing or not containing an A section. If the A section is not present, this is the index in section B for the first animation frame for a particular animation. If there is an A section, &#039;&#039;first_frame_id&#039;&#039; is an index in the A section, and the 16-bit array item at this index is the required section B index. The section B indices determined this way essentially divide the B section into sub-sectons. One sub-section corresponds to the &amp;quot;animation&amp;quot; of a puzzle part or an user interface element in one specific state. If an &amp;quot;animation&amp;quot; has only one section B item, then the puzzle part or button/icon is not animated in this state.&lt;br /&gt;
* &#039;&#039;&#039;state_id&#039;&#039;&#039;: An internal identifier used by the game for a state of the puzzle part or an user interface element. In a specific &amp;quot;state&amp;quot;, the puzzle part (or user interface element) may or may not be animated, the animation frames belonging to such a state must be determined using the first_frame_id member.&lt;br /&gt;
&lt;br /&gt;
=== Section D ===&lt;br /&gt;
&lt;br /&gt;
The D section contains the instructions on how to draw each animation frame (or to play a sound). The section_d_offset field in the corresponding section B entry determines where the sequence of commands start for each animation frame. There are 6 different types of commands, numbered 0-5. Each command starts with its number in a 16-bit, little endian format. For commands 2-5, this is followed by a list of 16-bit integer parameters, the number of the parameters depends on command number.&lt;br /&gt;
 &lt;br /&gt;
==== Command 0: End of animation frame ====&lt;br /&gt;
&lt;br /&gt;
Command 0 indicates the end of an animation frame in the file. It terminates the list of commands associated with a section B item. Command 0 has no parameters and is always 2 bytes long (the 16-bit command number).&lt;br /&gt;
&lt;br /&gt;
==== Command 1: End of &amp;quot;ANM:&amp;quot; chunk ====&lt;br /&gt;
&lt;br /&gt;
The last two bytes of section D (and the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk) are always &amp;lt;code&amp;gt;01 00&amp;lt;/code&amp;gt; (1 in 16-bit little endian format). These two bytes can be interpreted as a 2-byte command that terminates section D and the entire &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. Command 1 is not found anywhere else in section D.&lt;br /&gt;
&lt;br /&gt;
==== Command 2: Draw BMP sub-image ====&lt;br /&gt;
&lt;br /&gt;
Command 2 is an instruction for the  game engine to draw a sub-image from a &amp;lt;/tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; image stored in the archive file of the game. It should be noted that a part sprite is often &amp;quot;cut into&amp;quot; multiple &amp;lt;/tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub images, and in a few cases, they are stored in more than one file. Command 2 has five 16-bit integer parameters (size is 12 bytes, including the command number).&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 2 */&lt;br /&gt;
  UINT16LE bmp_file_num;&lt;br /&gt;
  UINT16LE bmp_sub_image_num;&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE flip;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bmp_file_num&#039;&#039;&#039;: Index of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file in the TAG: chunk. The index of the first image is 1.&lt;br /&gt;
* &#039;&#039;&#039;bmp_sub_image_num&#039;&#039;&#039;: The &amp;quot;sub-image&amp;quot; number of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file to draw. [[The Incredible Machine Image Format|&amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; images in TIM 2]]  can have multiple sub images.&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: The position of the image (top left corner), relative to the x and y&lt;br /&gt;
coordinates in the corresponding section B item.&lt;br /&gt;
* &#039;&#039;&#039;flip&#039;&#039;&#039;: The image can be drawn horizontally and/or vertically flipped relative to its original orientation. 1 = vertical flip, 2 = horizontal flip, 3 = both, 0 = no such transform is applied.&lt;br /&gt;
&lt;br /&gt;
==== Command 3: Draw rectangle ====&lt;br /&gt;
&lt;br /&gt;
Command 3 draws a rectangle with a border and fill color provided as arguments. It is mainly used in user interface elements and in the graphics shown in the part help screen, rarely in puzzle part graphics. It has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 3 */&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE rect_width;&lt;br /&gt;
  UINT16LE rect_height;&lt;br /&gt;
  UINT16LE border_color;&lt;br /&gt;
  UINT16LE fill;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: Coordinates of the top left corner of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;rect_width&#039;&#039;&#039;, &#039;&#039;&#039;rect_height&#039;&#039;&#039;: The width and height of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;border_color&#039;&#039;&#039;: The border color for the rectangle. In TIM 2, one color from the 16-color palette.&lt;br /&gt;
* &#039;&#039;&#039;fill&#039;&#039;&#039;: The value of the &#039;&#039;fill&#039;&#039; parameter is either 0 - no fill, border only - or a value between 0x8000 and 0x800f where the least significant nibble contains the fill color.&lt;br /&gt;
&lt;br /&gt;
==== Command 4: Draw line ====&lt;br /&gt;
&lt;br /&gt;
Command 4 draws a line between two end points with a specific color. Like the rectangle command, it is mainly used for game interface graphics, not the puzzle parts. The format of the command is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 4 */&lt;br /&gt;
  INT16LE x1;&lt;br /&gt;
  INT16LE y1;&lt;br /&gt;
  INT16LE x2;&lt;br /&gt;
  INT16LE y2;&lt;br /&gt;
  UINT16LE line_color;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;x1&#039;&#039;&#039;, &#039;&#039;&#039;y1&#039;&#039;&#039;: The coordinates of one end point.&lt;br /&gt;
* &#039;&#039;&#039;x2&#039;&#039;&#039;, &#039;&#039;&#039;y2&#039;&#039;&#039;: The coordinates of the other end point.&lt;br /&gt;
* &#039;&#039;&#039;line_color&#039;&#039;&#039;: The color of the line, one color from the 16-color palette in TIM 2.&lt;br /&gt;
&lt;br /&gt;
==== Command 5: Play sound ====&lt;br /&gt;
&lt;br /&gt;
If the command list for an animation frame includes command 5, a sound effect will be played when the particular frame is shown. It has one 16-bit parameter, the ID of the sound. TIM 2 contains sounds in two different formats. Sounds with a number &amp;gt;= 3000 are stored in the archive file of the game (&amp;lt;tt&amp;gt;SX_3???.RAW&amp;lt;/tt&amp;gt;). .RAW files are uncompressed 8-bit PCM audio files without any header. The rest of the files (with numbers &amp;lt; 300) are found in &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;.&lt;br /&gt;
TIM 3 has &amp;lt;tt&amp;gt;.WAV&amp;lt;/tt&amp;gt; files instead in the archive file an there is no &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;. ({{TODO|TIM 3 sounds with numbers below 3000}}).&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;TAG:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk contains the names of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub-files (in the archive file of the game) required for displaying the animation. Not counting the &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the 32-bit chunk size, the first two bytes of the data contains the number of image file names in 16-bit little endian format. The remaining part of the data is the list of image file name entries. A single entry is a 16-bit image ID followed by a null-terminated string containing the name of the image. In TIM 2, the ID of the first image is always 1, however, there are exceptions to this rule in TIM 3 (but never in part graphics). There is no gap in the numbering of the images, this makes the image ID field somewhat redundant.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;LAB:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is present in a small number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files in TIM 3. &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts never contain such a chunk. The structure of the &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is similar to &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, it consists of the number of entries stored as 16-bit integer, followed by item ID-null terminated string pairs. The strings are apparently not user interface texts visible to the player. &lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TODO, this file format does not really belong to any category present in this site --&amp;gt;&lt;br /&gt;
[[Category:All file formats]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10591</id>
		<title>The Incredible Machine 2-3 ANM File Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10591"/>
		<updated>2022-07-21T16:10:30Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Section B */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The &#039;&#039;&#039;animation&#039;&#039;&#039; (&amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt;) sub-files are found in the [[TIM Resource Format|archive file]] of [[The Incredible Machine 2]] (TIM 2) and [[Thie Incredible Machine 3|3]] (TIM 3). They contain the information required for drawing puzzle part sprites, which are often comprised of multiple sub-images of [[The Incredible Machine Image Format|image files]] and for animations of the puzzle parts. They are also used for animated parts of the game&#039;s user interface (for example the animated icons of the main menu). It can also contain commands for playing sound effects.&lt;br /&gt;
&lt;br /&gt;
Most &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files (all in TIM 2) contain two chunks, starting with &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;  and &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, respectively. Both use the typical &amp;quot;Dynamix chunk&amp;quot; format, starting with the 4-byte chunk type (&amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;/&amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, followed by the chunk size in 32-bit, little endian format. Unlike other Dynamix file formats, the most significant bit in the 32-bit size of the first chunk is not set. A small number of files in TIM 3 contain a third chunk, &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot;, with an unclear meaning.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;ANM:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
Not counting the chunk type and size, an &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt; chunk has five parts, a 16 or 22 byte header, and four sections containing the actual sprite/animation frame/animation data, labeled here as A-D.&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk (not counting the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the chunk size) starts with a header, with a size of 16 or 22 bytes, depending on the magic number. It has the following Format:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] magic_number_1;&lt;br /&gt;
  UINT16LE magic_number_2;&lt;br /&gt;
  UINT16LE size_section_a;&lt;br /&gt;
  UINT16LE size_section_b;&lt;br /&gt;
  UINT16LE size_section_c;&lt;br /&gt;
  UINT16LE size_section_d;&lt;br /&gt;
  UINT16LE anm_width;&lt;br /&gt;
  UINT16LE anm_height;&lt;br /&gt;
  /* 3 members, found only in files with a magic number of 0x54 0x42 0xEA 0x03: */&lt;br /&gt;
  UINT16LE unknown_16;&lt;br /&gt;
  UINT16LE unknown_18;&lt;br /&gt;
  UINT16LE unknown_20;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;magic_number_1&#039;&#039;&#039;, &#039;&#039;&#039;magic_number_2&#039;&#039;&#039;:  The header starts with a 4-byte magic number. The first two bytes are always 0x54 0x42. The second two bytes are a 16-bit little endian file version number. In TIM 2, the possible values 1000 (0x3E8) or 1001 (0x3E9). There is no obvious difference in the format of the files using these two numbers, however, 0x3E9 is much more common and 0x3E8 is mostly used for relatively small and simple files. In TIM 3, a small number of files use a newer version of the &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; file format, with a magic_number_2 value of 1002 (0x3EA). Such files have a slightly different format compared to files with the other two numbers. The &amp;quot;newer&amp;quot; format is used in the user interface and the game menu, but never for puzzle part graphics.&lt;br /&gt;
* &#039;&#039;&#039;size_section_a&#039;&#039;&#039;: The number of entries in the A section of the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, one entry is 2 byte (i.e. the section is an array of 16-bit integers). Several files do not have an A section (size_section_a == 0)&lt;br /&gt;
* &#039;&#039;&#039;size_section_b&#039;&#039;&#039;: The number of entries in the B section. One entry is 12 bytes in the files in files with &amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;, 10 bytes in all other files.&lt;br /&gt;
* &#039;&#039;&#039;size_section_c&#039;&#039;&#039;: The number of entries in the C section, one entry is 4 bytes.&lt;br /&gt;
* &#039;&#039;&#039;size_section_d&#039;&#039;&#039;: The size of the D section in bytes.&lt;br /&gt;
* &#039;&#039;&#039;anm_width&#039;&#039;&#039;, &#039;&#039;&#039;anm_height&#039;&#039;&#039;: Width and height of the animation. In &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts, the two structure members usually have the same value as width_1 and height_1 for the part in puzzle/level files.   &lt;br /&gt;
&lt;br /&gt;
Structure members found only in files with the longer header (&amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;unknown_16&#039;&#039;&#039;: 0x14 in all files, perhaps the size of header minus magic_number_1. Files with the longer header do not contain additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, so it cannot be a size of such a section.&lt;br /&gt;
* &#039;&#039;&#039;unknown_18&#039;&#039;&#039;: 0 in all files&lt;br /&gt;
* &#039;&#039;&#039;unknown_20&#039;&#039;&#039;: 0x17 in one file, 0 in all others. Clearly not the size of an additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section A ===&lt;br /&gt;
&lt;br /&gt;
Section A is empty in a large number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files. If present, it is an array of 16-bit little endian integers. It contains all numbers from 0 to the number of items in B section minus 1, in increasing order, with some numbers repeated. For example &amp;lt;code&amp;gt;0 1 1 1 2&amp;lt;/code&amp;gt; means that the animation frame with index 1 in section B must be shown for the duration of 3 timer ticks instead of 1.&lt;br /&gt;
&lt;br /&gt;
=== Section B ===&lt;br /&gt;
&lt;br /&gt;
Section B is a list of structures containing 16 bit integer members, 6 if magic_number_2 is &amp;lt;tt&amp;gt;0x3EA&amp;lt;/tt&amp;gt;, 5 in the other versions of the file format. It contains essential information about each animation frame. One structure has the following members:&lt;br /&gt;
&lt;br /&gt;
  [[INT16LE]] relative_pos_x;&lt;br /&gt;
  INT16LE relative_pos_y;&lt;br /&gt;
  UINT16LE width;&lt;br /&gt;
  UINT16LE height;&lt;br /&gt;
  UINT16LE section_d_offset;&lt;br /&gt;
  /* Note that the last member is only present in files with */&lt;br /&gt;
  /*     magic number 0x54 0x42 0xEA 0x03 */&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;relative_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;relative_pos_y&#039;&#039;&#039;: The coordinates where the animation frame must be drawn, relative to other frames. For the first item in the B section, the value of both tare typically 0, however there are a few exceptions. The relative position may be negative.&lt;br /&gt;
* &#039;&#039;&#039;width&#039;&#039;&#039;, &#039;&#039;&#039;height&#039;&#039;&#039;: The width and the height of the graphics in the specific animation frame.&lt;br /&gt;
* &#039;&#039;&#039;section_d_offset&#039;&#039;&#039;: An offset in section D, points to the first command required for drawing the animation frame.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: The meaning is unclear. Often, but not always a number divisible by 3. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section C ===&lt;br /&gt;
&lt;br /&gt;
A section C item has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE first_frame_id;&lt;br /&gt;
  UINT16LE state_id;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;first_frame_id&#039;&#039;&#039;: The meaning of &#039;&#039;first_frame_id&#039;&#039; is slightly different between files containing or not containing an A section. If the A section is not present, this is the index in section B for the first animation frame for a particular animation. If there is an A section, &#039;&#039;first_frame_id&#039;&#039; is an index in the A section, and the 16-bit array item at this index is the required section B index. The section B indices determined this way essentially divide the B section into sub-sectons. One sub-section corresponds to the &amp;quot;animation&amp;quot; of a puzzle part or an user interface element in one specific state. If an &amp;quot;animation&amp;quot; has only one section B item, then the puzzle part or button/icon is not animated in this state.&lt;br /&gt;
* &#039;&#039;&#039;state_id&#039;&#039;&#039;: An internal identifier used by the game for a state of the puzzle part or an user interface element. In a specific &amp;quot;state&amp;quot;, the puzzle part (or user interface element) may or may not be animated, the animation frames belonging to such a state must be determined using the first_frame_id member.&lt;br /&gt;
&lt;br /&gt;
=== Section D ===&lt;br /&gt;
&lt;br /&gt;
The D section contains the instructions on how to draw each animation frame (or to play a sound). The section_d_offset field in the corresponding section B entry determines where the sequence of commands start for each animation frame. There are 6 different types of commands, numbered 0-5. Each command starts with its number in a 16-bit, little endian format. For commands 2-5, this is followed by a list of 16-bit integer parameters, the number of the parameters depends on command number.&lt;br /&gt;
 &lt;br /&gt;
==== Command 0: End of animation frame ====&lt;br /&gt;
&lt;br /&gt;
Command 0 indicates the end of an animation frame in the file. It terminates the list of commands associated with a section B item. Command 0 has no parameters and is always 2 bytes long (the 16-bit command number).&lt;br /&gt;
&lt;br /&gt;
==== Command 1: End of &amp;quot;ANM:&amp;quot; chunk ====&lt;br /&gt;
&lt;br /&gt;
The last two bytes of section D (and the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk) are always &amp;lt;code&amp;gt;01 00&amp;lt;/code&amp;gt; (1 in 16-bit little endian format). These two bytes can be interpreted as a 2-byte command that terminates section D and the entire &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. Command 1 is not found anywhere else in section D.&lt;br /&gt;
&lt;br /&gt;
==== Command 2: Draw BMP sub-image ====&lt;br /&gt;
&lt;br /&gt;
Command 2 is an instruction for the  game engine to draw a sub-image from a &amp;lt;/tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; image stored in the archive file of the game. It should be noted that a part sprite is often &amp;quot;cut into&amp;quot; multiple &amp;lt;/tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub images, and in a few cases, they are stored in more than one file. Command 2 has five 16-bit integer parameters (size is 12 bytes, including the command number).&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 2 */&lt;br /&gt;
  UINT16LE bmp_file_num;&lt;br /&gt;
  UINT16LE bmp_sub_image_num;&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE flip;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bmp_file_num&#039;&#039;&#039;: Index of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file in the TAG: chunk. The index of the first image is 1.&lt;br /&gt;
* &#039;&#039;&#039;bmp_sub_image_num&#039;&#039;&#039;: The &amp;quot;sub-image&amp;quot; number of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file to draw. [[The Incredible Machine Image Format|&amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; images in TIM 2]]  can have multiple sub images.&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: The position of the image (top left corner), relative to the x and y&lt;br /&gt;
coordinates in the corresponding section B item.&lt;br /&gt;
* &#039;&#039;&#039;flip&#039;&#039;&#039;: The image can be drawn horizontally and/or vertically flipped relative to its original orientation. 1 = vertical flip, 2 = horizontal flip, 3 = both, 0 = no such transform is applied.&lt;br /&gt;
&lt;br /&gt;
==== Command 3: Draw rectangle ====&lt;br /&gt;
&lt;br /&gt;
Command 3 draws a rectangle with a border and fill color provided as arguments. It is mainly used in user interface elements and in the graphics shown in the part help screen, rarely in puzzle part graphics. It has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 3 */&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE rect_width;&lt;br /&gt;
  UINT16LE rect_height;&lt;br /&gt;
  UINT16LE border_color;&lt;br /&gt;
  UINT16LE fill;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: Coordinates of the top left corner of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;rect_width&#039;&#039;&#039;, &#039;&#039;&#039;rect_height&#039;&#039;&#039;: The width and height of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;border_color&#039;&#039;&#039;: The border color for the rectangle. In TIM 2, one color from the 16-color palette.&lt;br /&gt;
* &#039;&#039;&#039;fill&#039;&#039;&#039;: The value of the &#039;&#039;fill&#039;&#039; parameter is either 0 - no fill, border only - or a value between 0x8000 and 0x800f where the least significant nibble contains the fill color.&lt;br /&gt;
&lt;br /&gt;
==== Command 4: Draw line ====&lt;br /&gt;
&lt;br /&gt;
Command 4 draws a line between two end points with a specific color. Like the rectangle command, it is mainly used for game interface graphics, not the puzzle parts. The format of the command is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 4 */&lt;br /&gt;
  INT16LE x1;&lt;br /&gt;
  INT16LE y1;&lt;br /&gt;
  INT16LE x2;&lt;br /&gt;
  INT16LE y2;&lt;br /&gt;
  UINT16LE line_color;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;x1&#039;&#039;&#039;, &#039;&#039;&#039;y1&#039;&#039;&#039;: The coordinates of one end point.&lt;br /&gt;
* &#039;&#039;&#039;x2&#039;&#039;&#039;, &#039;&#039;&#039;y2&#039;&#039;&#039;: The coordinates of the other end point.&lt;br /&gt;
* &#039;&#039;&#039;line_color&#039;&#039;&#039;: The color of the line, one color from the 16-color palette in TIM 2.&lt;br /&gt;
&lt;br /&gt;
==== Command 5: Play sound ====&lt;br /&gt;
&lt;br /&gt;
If the command list for an animation frame includes command 5, a sound effect will be played when the particular frame is shown. It has one 16-bit parameter, the ID of the sound. TIM 2 contains sounds in two different formats. Sounds with a number &amp;gt;= 3000 are stored in the archive file of the game (&amp;lt;tt&amp;gt;SX_3???.RAW&amp;lt;/tt&amp;gt;). .RAW files are uncompressed 8-bit PCM audio files without any header. The rest of the files (with numbers &amp;lt; 300) are found in &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;.&lt;br /&gt;
TIM 3 has &amp;lt;tt&amp;gt;.WAV&amp;lt;/tt&amp;gt; files instead in the archive file an there is no &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;. ({{TODO|TIM 3 sounds with numbers below 3000}}).&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;TAG:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk contains the names of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub-files (in the archive file of the game) required for displaying the animation. Not counting the &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the 32-bit chunk size, the first two bytes of the data contains the number of image file names in 16-bit little endian format. The remaining part of the data is the list of image file name entries. A single entry is a 16-bit image ID followed by a null-terminated string containing the name of the image. In TIM 2, the ID of the first image is always 1, however, there are exceptions to this rule in TIM 3 (but never in part graphics). There is no gap in the numbering of the images, this makes the image ID field somewhat redundant.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;LAB:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is present in a small number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files in TIM 3. &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts never contain such a chunk. The structure of the &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is similar to &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, it consists of the number of entries stored as 16-bit integer, followed by item ID-null terminated string pairs. The strings are apparently not user interface texts visible to the player. &lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TODO, this file format does not really belong to any category present in this site --&amp;gt;&lt;br /&gt;
[[Category:File Formats]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10590</id>
		<title>The Incredible Machine 2-3 ANM File Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10590"/>
		<updated>2022-07-21T16:10:08Z</updated>

		<summary type="html">&lt;p&gt;Knt47: credits&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The &#039;&#039;&#039;animation&#039;&#039;&#039; (&amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt;) sub-files are found in the [[TIM Resource Format|archive file]] of [[The Incredible Machine 2]] (TIM 2) and [[Thie Incredible Machine 3|3]] (TIM 3). They contain the information required for drawing puzzle part sprites, which are often comprised of multiple sub-images of [[The Incredible Machine Image Format|image files]] and for animations of the puzzle parts. They are also used for animated parts of the game&#039;s user interface (for example the animated icons of the main menu). It can also contain commands for playing sound effects.&lt;br /&gt;
&lt;br /&gt;
Most &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files (all in TIM 2) contain two chunks, starting with &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;  and &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, respectively. Both use the typical &amp;quot;Dynamix chunk&amp;quot; format, starting with the 4-byte chunk type (&amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;/&amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, followed by the chunk size in 32-bit, little endian format. Unlike other Dynamix file formats, the most significant bit in the 32-bit size of the first chunk is not set. A small number of files in TIM 3 contain a third chunk, &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot;, with an unclear meaning.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;ANM:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
Not counting the chunk type and size, an &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt; chunk has five parts, a 16 or 22 byte header, and four sections containing the actual sprite/animation frame/animation data, labeled here as A-D.&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk (not counting the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the chunk size) starts with a header, with a size of 16 or 22 bytes, depending on the magic number. It has the following Format:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] magic_number_1;&lt;br /&gt;
  UINT16LE magic_number_2;&lt;br /&gt;
  UINT16LE size_section_a;&lt;br /&gt;
  UINT16LE size_section_b;&lt;br /&gt;
  UINT16LE size_section_c;&lt;br /&gt;
  UINT16LE size_section_d;&lt;br /&gt;
  UINT16LE anm_width;&lt;br /&gt;
  UINT16LE anm_height;&lt;br /&gt;
  /* 3 members, found only in files with a magic number of 0x54 0x42 0xEA 0x03: */&lt;br /&gt;
  UINT16LE unknown_16;&lt;br /&gt;
  UINT16LE unknown_18;&lt;br /&gt;
  UINT16LE unknown_20;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;magic_number_1&#039;&#039;&#039;, &#039;&#039;&#039;magic_number_2&#039;&#039;&#039;:  The header starts with a 4-byte magic number. The first two bytes are always 0x54 0x42. The second two bytes are a 16-bit little endian file version number. In TIM 2, the possible values 1000 (0x3E8) or 1001 (0x3E9). There is no obvious difference in the format of the files using these two numbers, however, 0x3E9 is much more common and 0x3E8 is mostly used for relatively small and simple files. In TIM 3, a small number of files use a newer version of the &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; file format, with a magic_number_2 value of 1002 (0x3EA). Such files have a slightly different format compared to files with the other two numbers. The &amp;quot;newer&amp;quot; format is used in the user interface and the game menu, but never for puzzle part graphics.&lt;br /&gt;
* &#039;&#039;&#039;size_section_a&#039;&#039;&#039;: The number of entries in the A section of the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, one entry is 2 byte (i.e. the section is an array of 16-bit integers). Several files do not have an A section (size_section_a == 0)&lt;br /&gt;
* &#039;&#039;&#039;size_section_b&#039;&#039;&#039;: The number of entries in the B section. One entry is 12 bytes in the files in files with &amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;, 10 bytes in all other files.&lt;br /&gt;
* &#039;&#039;&#039;size_section_c&#039;&#039;&#039;: The number of entries in the C section, one entry is 4 bytes.&lt;br /&gt;
* &#039;&#039;&#039;size_section_d&#039;&#039;&#039;: The size of the D section in bytes.&lt;br /&gt;
* &#039;&#039;&#039;anm_width&#039;&#039;&#039;, &#039;&#039;&#039;anm_height&#039;&#039;&#039;: Width and height of the animation. In &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts, the two structure members usually have the same value as width_1 and height_1 for the part in puzzle/level files.   &lt;br /&gt;
&lt;br /&gt;
Structure members found only in files with the longer header (&amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;unknown_16&#039;&#039;&#039;: 0x14 in all files, perhaps the size of header minus magic_number_1. Files with the longer header do not contain additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, so it cannot be a size of such a section.&lt;br /&gt;
* &#039;&#039;&#039;unknown_18&#039;&#039;&#039;: 0 in all files&lt;br /&gt;
* &#039;&#039;&#039;unknown_20&#039;&#039;&#039;: 0x17 in one file, 0 in all others. Clearly not the size of an additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section A ===&lt;br /&gt;
&lt;br /&gt;
Section A is empty in a large number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files. If present, it is an array of 16-bit little endian integers. It contains all numbers from 0 to the number of items in B section minus 1, in increasing order, with some numbers repeated. For example &amp;lt;code&amp;gt;0 1 1 1 2&amp;lt;/code&amp;gt; means that the animation frame with index 1 in section B must be shown for the duration of 3 timer ticks instead of 1.&lt;br /&gt;
&lt;br /&gt;
=== Section B ===&lt;br /&gt;
&lt;br /&gt;
Section B is a list of structures containing 16 bit integer members, 6 if magic_number_2 is &amp;lt;tt&amp;gt;0x3EA&amp;lt;/tt&amp;gt;, 5 in the other versions of the file format. It contains essential information about each animation frame. One structure has the following members:&lt;br /&gt;
&lt;br /&gt;
  INT16LE relative_pos_x;&lt;br /&gt;
  INT16LE relative_pos_y;&lt;br /&gt;
  UINT16LE width;&lt;br /&gt;
  UINT16LE height;&lt;br /&gt;
  UINT16LE section_d_offset;&lt;br /&gt;
  /* Note that the last member is only present in files with */&lt;br /&gt;
  /*     magic number 0x54 0x42 0xEA 0x03 */&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;relative_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;relative_pos_y&#039;&#039;&#039;: The coordinates where the animation frame must be drawn, relative to other frames. For the first item in the B section, the value of both tare typically 0, however there are a few exceptions. The relative position may be negative.&lt;br /&gt;
* &#039;&#039;&#039;width&#039;&#039;&#039;, &#039;&#039;&#039;height&#039;&#039;&#039;: The width and the height of the graphics in the specific animation frame.&lt;br /&gt;
* &#039;&#039;&#039;section_d_offset&#039;&#039;&#039;: An offset in section D, points to the first command required for drawing the animation frame.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: The meaning is unclear. Often, but not always a number divisible by 3. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section C ===&lt;br /&gt;
&lt;br /&gt;
A section C item has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE first_frame_id;&lt;br /&gt;
  UINT16LE state_id;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;first_frame_id&#039;&#039;&#039;: The meaning of &#039;&#039;first_frame_id&#039;&#039; is slightly different between files containing or not containing an A section. If the A section is not present, this is the index in section B for the first animation frame for a particular animation. If there is an A section, &#039;&#039;first_frame_id&#039;&#039; is an index in the A section, and the 16-bit array item at this index is the required section B index. The section B indices determined this way essentially divide the B section into sub-sectons. One sub-section corresponds to the &amp;quot;animation&amp;quot; of a puzzle part or an user interface element in one specific state. If an &amp;quot;animation&amp;quot; has only one section B item, then the puzzle part or button/icon is not animated in this state.&lt;br /&gt;
* &#039;&#039;&#039;state_id&#039;&#039;&#039;: An internal identifier used by the game for a state of the puzzle part or an user interface element. In a specific &amp;quot;state&amp;quot;, the puzzle part (or user interface element) may or may not be animated, the animation frames belonging to such a state must be determined using the first_frame_id member.&lt;br /&gt;
&lt;br /&gt;
=== Section D ===&lt;br /&gt;
&lt;br /&gt;
The D section contains the instructions on how to draw each animation frame (or to play a sound). The section_d_offset field in the corresponding section B entry determines where the sequence of commands start for each animation frame. There are 6 different types of commands, numbered 0-5. Each command starts with its number in a 16-bit, little endian format. For commands 2-5, this is followed by a list of 16-bit integer parameters, the number of the parameters depends on command number.&lt;br /&gt;
 &lt;br /&gt;
==== Command 0: End of animation frame ====&lt;br /&gt;
&lt;br /&gt;
Command 0 indicates the end of an animation frame in the file. It terminates the list of commands associated with a section B item. Command 0 has no parameters and is always 2 bytes long (the 16-bit command number).&lt;br /&gt;
&lt;br /&gt;
==== Command 1: End of &amp;quot;ANM:&amp;quot; chunk ====&lt;br /&gt;
&lt;br /&gt;
The last two bytes of section D (and the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk) are always &amp;lt;code&amp;gt;01 00&amp;lt;/code&amp;gt; (1 in 16-bit little endian format). These two bytes can be interpreted as a 2-byte command that terminates section D and the entire &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. Command 1 is not found anywhere else in section D.&lt;br /&gt;
&lt;br /&gt;
==== Command 2: Draw BMP sub-image ====&lt;br /&gt;
&lt;br /&gt;
Command 2 is an instruction for the  game engine to draw a sub-image from a &amp;lt;/tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; image stored in the archive file of the game. It should be noted that a part sprite is often &amp;quot;cut into&amp;quot; multiple &amp;lt;/tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub images, and in a few cases, they are stored in more than one file. Command 2 has five 16-bit integer parameters (size is 12 bytes, including the command number).&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 2 */&lt;br /&gt;
  UINT16LE bmp_file_num;&lt;br /&gt;
  UINT16LE bmp_sub_image_num;&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE flip;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bmp_file_num&#039;&#039;&#039;: Index of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file in the TAG: chunk. The index of the first image is 1.&lt;br /&gt;
* &#039;&#039;&#039;bmp_sub_image_num&#039;&#039;&#039;: The &amp;quot;sub-image&amp;quot; number of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file to draw. [[The Incredible Machine Image Format|&amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; images in TIM 2]]  can have multiple sub images.&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: The position of the image (top left corner), relative to the x and y&lt;br /&gt;
coordinates in the corresponding section B item.&lt;br /&gt;
* &#039;&#039;&#039;flip&#039;&#039;&#039;: The image can be drawn horizontally and/or vertically flipped relative to its original orientation. 1 = vertical flip, 2 = horizontal flip, 3 = both, 0 = no such transform is applied.&lt;br /&gt;
&lt;br /&gt;
==== Command 3: Draw rectangle ====&lt;br /&gt;
&lt;br /&gt;
Command 3 draws a rectangle with a border and fill color provided as arguments. It is mainly used in user interface elements and in the graphics shown in the part help screen, rarely in puzzle part graphics. It has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 3 */&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE rect_width;&lt;br /&gt;
  UINT16LE rect_height;&lt;br /&gt;
  UINT16LE border_color;&lt;br /&gt;
  UINT16LE fill;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: Coordinates of the top left corner of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;rect_width&#039;&#039;&#039;, &#039;&#039;&#039;rect_height&#039;&#039;&#039;: The width and height of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;border_color&#039;&#039;&#039;: The border color for the rectangle. In TIM 2, one color from the 16-color palette.&lt;br /&gt;
* &#039;&#039;&#039;fill&#039;&#039;&#039;: The value of the &#039;&#039;fill&#039;&#039; parameter is either 0 - no fill, border only - or a value between 0x8000 and 0x800f where the least significant nibble contains the fill color.&lt;br /&gt;
&lt;br /&gt;
==== Command 4: Draw line ====&lt;br /&gt;
&lt;br /&gt;
Command 4 draws a line between two end points with a specific color. Like the rectangle command, it is mainly used for game interface graphics, not the puzzle parts. The format of the command is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 4 */&lt;br /&gt;
  INT16LE x1;&lt;br /&gt;
  INT16LE y1;&lt;br /&gt;
  INT16LE x2;&lt;br /&gt;
  INT16LE y2;&lt;br /&gt;
  UINT16LE line_color;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;x1&#039;&#039;&#039;, &#039;&#039;&#039;y1&#039;&#039;&#039;: The coordinates of one end point.&lt;br /&gt;
* &#039;&#039;&#039;x2&#039;&#039;&#039;, &#039;&#039;&#039;y2&#039;&#039;&#039;: The coordinates of the other end point.&lt;br /&gt;
* &#039;&#039;&#039;line_color&#039;&#039;&#039;: The color of the line, one color from the 16-color palette in TIM 2.&lt;br /&gt;
&lt;br /&gt;
==== Command 5: Play sound ====&lt;br /&gt;
&lt;br /&gt;
If the command list for an animation frame includes command 5, a sound effect will be played when the particular frame is shown. It has one 16-bit parameter, the ID of the sound. TIM 2 contains sounds in two different formats. Sounds with a number &amp;gt;= 3000 are stored in the archive file of the game (&amp;lt;tt&amp;gt;SX_3???.RAW&amp;lt;/tt&amp;gt;). .RAW files are uncompressed 8-bit PCM audio files without any header. The rest of the files (with numbers &amp;lt; 300) are found in &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;.&lt;br /&gt;
TIM 3 has &amp;lt;tt&amp;gt;.WAV&amp;lt;/tt&amp;gt; files instead in the archive file an there is no &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;. ({{TODO|TIM 3 sounds with numbers below 3000}}).&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;TAG:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk contains the names of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub-files (in the archive file of the game) required for displaying the animation. Not counting the &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the 32-bit chunk size, the first two bytes of the data contains the number of image file names in 16-bit little endian format. The remaining part of the data is the list of image file name entries. A single entry is a 16-bit image ID followed by a null-terminated string containing the name of the image. In TIM 2, the ID of the first image is always 1, however, there are exceptions to this rule in TIM 3 (but never in part graphics). There is no gap in the numbering of the images, this makes the image ID field somewhat redundant.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;LAB:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is present in a small number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files in TIM 3. &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts never contain such a chunk. The structure of the &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is similar to &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, it consists of the number of entries stored as 16-bit integer, followed by item ID-null terminated string pairs. The strings are apparently not user interface texts visible to the player. &lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TODO, this file format does not really belong to any category present in this site --&amp;gt;&lt;br /&gt;
[[Category:File Formats]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10589</id>
		<title>The Incredible Machine 2-3 ANM File Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10589"/>
		<updated>2022-07-21T16:01:15Z</updated>

		<summary type="html">&lt;p&gt;Knt47: additional information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The &#039;&#039;&#039;animation&#039;&#039;&#039; (&amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt;) sub-files are found in the [[TIM Resource Format|archive file]] of [[The Incredible Machine 2]] (TIM 2) and [[Thie Incredible Machine 3|3]] (TIM 3). They contain the information required for drawing puzzle part sprites, which are often comprised of multiple sub-images of [[The Incredible Machine Image Format|image files]] and for animations of the puzzle parts. They are also used for animated parts of the game&#039;s user interface (for example the animated icons of the main menu). It can also contain commands for playing sound effects.&lt;br /&gt;
&lt;br /&gt;
Most &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files (all in TIM 2) contain two chunks, starting with &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;  and &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, respectively. Both use the typical &amp;quot;Dynamix chunk&amp;quot; format, starting with the 4-byte chunk type (&amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;/&amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, followed by the chunk size in 32-bit, little endian format. Unlike other Dynamix file formats, the most significant bit in the 32-bit size of the first chunk is not set. A small number of files in TIM 3 contain a third chunk, &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot;, with an unclear meaning.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;ANM:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
Not counting the chunk type and size, an &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt; chunk has five parts, a 16 or 22 byte header, and four sections containing the actual sprite/animation frame/animation data, labeled here as A-D.&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk (not counting the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the chunk size) starts with a header, with a size of 16 or 22 bytes, depending on the magic number. It has the following Format:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] magic_number_1;&lt;br /&gt;
  UINT16LE magic_number_2;&lt;br /&gt;
  UINT16LE size_section_a;&lt;br /&gt;
  UINT16LE size_section_b;&lt;br /&gt;
  UINT16LE size_section_c;&lt;br /&gt;
  UINT16LE size_section_d;&lt;br /&gt;
  UINT16LE anm_width;&lt;br /&gt;
  UINT16LE anm_height;&lt;br /&gt;
  /* 3 members, found only in files with a magic number of 0x54 0x42 0xEA 0x03: */&lt;br /&gt;
  UINT16LE unknown_16;&lt;br /&gt;
  UINT16LE unknown_18;&lt;br /&gt;
  UINT16LE unknown_20;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;magic_number_1&#039;&#039;&#039;, &#039;&#039;&#039;magic_number_2&#039;&#039;&#039;:  The header starts with a 4-byte magic number. The first two bytes are always 0x54 0x42. The second two bytes are a 16-bit little endian file version number. In TIM 2, the possible values 1000 (0x3E8) or 1001 (0x3E9). There is no obvious difference in the format of the files using these two numbers, however, 0x3E9 is much more common and 0x3E8 is mostly used for relatively small and simple files. In TIM 3, a small number of files use a newer version of the &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; file format, with a magic_number_2 value of 1002 (0x3EA). Such files have a slightly different format compared to files with the other two numbers. The &amp;quot;newer&amp;quot; format is used in the user interface and the game menu, but never for puzzle part graphics.&lt;br /&gt;
* &#039;&#039;&#039;size_section_a&#039;&#039;&#039;: The number of entries in the A section of the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, one entry is 2 byte (i.e. the section is an array of 16-bit integers). Several files do not have an A section (size_section_a == 0)&lt;br /&gt;
* &#039;&#039;&#039;size_section_b&#039;&#039;&#039;: The number of entries in the B section. One entry is 12 bytes in the files in files with &amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;, 10 bytes in all other files.&lt;br /&gt;
* &#039;&#039;&#039;size_section_c&#039;&#039;&#039;: The number of entries in the C section, one entry is 4 bytes.&lt;br /&gt;
* &#039;&#039;&#039;size_section_d&#039;&#039;&#039;: The size of the D section in bytes.&lt;br /&gt;
* &#039;&#039;&#039;anm_width&#039;&#039;&#039;, &#039;&#039;&#039;anm_height&#039;&#039;&#039;: Width and height of the animation. In &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts, the two structure members usually have the same value as width_1 and height_1 for the part in puzzle/level files.   &lt;br /&gt;
&lt;br /&gt;
Structure members found only in files with the longer header (&amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;unknown_16&#039;&#039;&#039;: 0x14 in all files, perhaps the size of header minus magic_number_1. Files with the longer header do not contain additional section in &amp;quot;ANM:&amp;quot; chunk, so it cannot be a size of such a section.&lt;br /&gt;
* &#039;&#039;&#039;unknown_18&#039;&#039;&#039;: 0 in all files&lt;br /&gt;
* &#039;&#039;&#039;unknown_20&#039;&#039;&#039;: 0x17 in one file, 0 in all others. Clearly not the size of an additional section in &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section A ===&lt;br /&gt;
&lt;br /&gt;
Section A is empty in a large number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files. If present, it is an array of 16-bit little endian integers. It contains all numbers from 0 to the number of items in B section minus 1, in increasing order, with some numbers repeated. For example &amp;lt;code&amp;gt;0 1 1 1 2&amp;lt;/code&amp;gt; means that the animation frame with index 1 in section B must be shown for the duration of 3 timer ticks instead of 1.&lt;br /&gt;
&lt;br /&gt;
=== Section B ===&lt;br /&gt;
&lt;br /&gt;
Section B is a list of structures containing 16 bit integer members, 6 if magic_number_2 is &amp;lt;tt&amp;gt;0x3EA&amp;lt;/tt&amp;gt;, 5 in the other versions of the file format. It contains essential information about each animation frame. One structure has the following members:&lt;br /&gt;
&lt;br /&gt;
  INT16LE relative_pos_x;&lt;br /&gt;
  INT16LE relative_pos_y;&lt;br /&gt;
  UINT16LE width;&lt;br /&gt;
  UINT16LE height;&lt;br /&gt;
  UINT16LE section_d_offset;&lt;br /&gt;
  /* Note that the last member is only present in files with */&lt;br /&gt;
  /*     magic number 0x54 0x42 0xEA 0x03 */&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;relative_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;relative_pos_y&#039;&#039;&#039;: The coordinates where the animation frame must be drawn, relative to other frames. For the first item in the B section, the value of both tare typically 0, however there are a few exceptions. The relative position may be negative.&lt;br /&gt;
* &#039;&#039;&#039;width&#039;&#039;&#039;, &#039;&#039;&#039;height&#039;&#039;&#039;: The width and the height of the graphics in the specific animation frame.&lt;br /&gt;
* &#039;&#039;&#039;section_d_offset&#039;&#039;&#039;: An offset in section D, points to the first command required for drawing the animation frame.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: The meaning is unclear. Often, but not always a number divisible by 3. {{TODO|Additional research needed}}&lt;br /&gt;
&lt;br /&gt;
=== Section C ===&lt;br /&gt;
&lt;br /&gt;
A section C item has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE first_frame_id;&lt;br /&gt;
  UINT16LE state_id;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;first_frame_id&#039;&#039;&#039;: The meaning of &#039;&#039;first_frame_id&#039;&#039; is slightly different between files containing or not containing an A section. If the A section is not present, this is the index in section B for the first animation frame for a particular animation. If there is an A section, &#039;&#039;first_frame_id&#039;&#039; is an index in the A section, and the 16-bit array item at this index is the required section B index. The section B indices determined this way essentially divide the B section into sub-sectons. One sub-section corresponds to the &amp;quot;animation&amp;quot; of a puzzle part or an user interface element in one specific state. If an &amp;quot;animation&amp;quot; has only one section B item, then the puzzle part or button/icon is not animated in this state.&lt;br /&gt;
* &#039;&#039;&#039;state_id&#039;&#039;&#039;: An internal identifier used by the game for a state of the puzzle part or an user interface element. In a specific &amp;quot;state&amp;quot;, the puzzle part (or user interface element) may or may not be animated, the animation frames belonging to such a state must be determined using the first_frame_id member.&lt;br /&gt;
&lt;br /&gt;
=== Section D ===&lt;br /&gt;
&lt;br /&gt;
The D section contains the instructions on how to draw each animation frame (or to play a sound). The section_d_offset field in the corresponding section B entry determines where the sequence of commands start for each animation frame. There are 6 different types of commands, numbered 0-5. Each command starts with its number in a 16-bit, little endian format. For commands 2-5, this is followed by a list of 16-bit integer parameters, the number of the parameters depends on command number.&lt;br /&gt;
 &lt;br /&gt;
==== Command 0: End of animation frame ====&lt;br /&gt;
&lt;br /&gt;
Command 0 indicates the end of an animation frame in the file. It terminates the list of commands associated with a section B item. Command 0 has no parameters and is always 2 bytes long (the 16-bit command number).&lt;br /&gt;
&lt;br /&gt;
==== Command 1: End of &amp;quot;ANM:&amp;quot; chunk ====&lt;br /&gt;
&lt;br /&gt;
The last two bytes of section D (and the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk) are always 01 00 (1 in 16-bit little endian format). These two bytes can be interpreted as a 2-byte command that terminates section D and the entire &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk. Command 1 is not found anywhere else in section D.&lt;br /&gt;
&lt;br /&gt;
==== Command 2: Draw BMP sub-image ====&lt;br /&gt;
&lt;br /&gt;
Command 2 is an instruction for the  game engine to draw a sub-image from a &amp;lt;/tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; image stored in the archive file of the game. It should be noted that a part sprite is often &amp;quot;cut into&amp;quot; multiple &amp;lt;/tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub images, and in a few cases, they are stored in more than one file. Command 2 has five 16-bit integer parameters (size is 12 bytes, including the command number).&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 2 */&lt;br /&gt;
  UINT16LE bmp_file_num;&lt;br /&gt;
  UINT16LE bmp_sub_image_num;&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE flip;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bmp_file_num&#039;&#039;&#039;: Index of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file in the TAG: chunk. The index of the first image is 1.&lt;br /&gt;
* &#039;&#039;&#039;bmp_sub_image_num&#039;&#039;&#039;: The &amp;quot;sub-image&amp;quot; number of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; file to draw. [[The Incredible Machine Image Format|&amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; images in TIM 2]]  can have multiple sub images.&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: The position of the image (top left corner), relative to the x and y&lt;br /&gt;
coordinates in the corresponding section B item.&lt;br /&gt;
* &#039;&#039;&#039;flip&#039;&#039;&#039;: The image can be drawn horizontally and/or vertically flipped relative to its original orientation. 1 = vertical flip, 2 = horizontal flip, 3 = both, 0 = no such transform is applied.&lt;br /&gt;
&lt;br /&gt;
==== Command 3: Draw rectangle ====&lt;br /&gt;
&lt;br /&gt;
Command 3 draws a rectangle with a border and fill color provided as arguments. It is mainly used in user interface elements and in the graphics shown in the part help screen, rarely in puzzle part graphics. It has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 3 */&lt;br /&gt;
  INT16LE draw_pos_x;&lt;br /&gt;
  INT16LE draw_pos_y;&lt;br /&gt;
  UINT16LE rect_width;&lt;br /&gt;
  UINT16LE rect_height;&lt;br /&gt;
  UINT16LE border_color;&lt;br /&gt;
  UINT16LE fill;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;draw_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;draw_pos_y&#039;&#039;&#039;: Coordinates of the top left corner of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;rect_width&#039;&#039;&#039;, &#039;&#039;&#039;rect_height&#039;&#039;&#039;: The width and height of the rectangle.&lt;br /&gt;
* &#039;&#039;&#039;border_color&#039;&#039;&#039;: The border color for the rectangle. In TIM 2, one color from the 16-color palette.&lt;br /&gt;
* &#039;&#039;&#039;fill&#039;&#039;&#039;: The value of the &#039;&#039;fill&#039;&#039; parameter is either 0 - no fill, border only - or a value between 0x8000 and 0x800f where the least significant nibble contains the fill color.&lt;br /&gt;
&lt;br /&gt;
==== Command 4: Draw line ====&lt;br /&gt;
&lt;br /&gt;
Command 4 draws a line between two end points with a specific color. Like the rectangle command, it is mainly used for game interface graphics, not the puzzle parts. The format of the command is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE command_num;  /* 4 */&lt;br /&gt;
  INT16LE x1;&lt;br /&gt;
  INT16LE y1;&lt;br /&gt;
  INT16LE x2;&lt;br /&gt;
  INT16LE y2;&lt;br /&gt;
  UINT16LE line_color;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;x1&#039;&#039;&#039;, &#039;&#039;&#039;y1&#039;&#039;&#039;: The coordinates of one end point.&lt;br /&gt;
* &#039;&#039;&#039;x2&#039;&#039;&#039;, &#039;&#039;&#039;y2&#039;&#039;&#039;: The coordinates of the other end point.&lt;br /&gt;
* &#039;&#039;&#039;line_color&#039;&#039;&#039;: The color of the line, one color from the 16-color palette in TIM 2.&lt;br /&gt;
&lt;br /&gt;
==== Command 5: Play sound ====&lt;br /&gt;
&lt;br /&gt;
If the command list for an animation frame includes command 5, a sound effect will be played when the particular frame is shown. It has one 16-bit parameter, the ID of the sound. TIM 2 contains sounds in two different formats. Sounds with a number &amp;gt;= 3000 are stored in the archive file of the game (&amp;lt;tt&amp;gt;SX_3???.RAW&amp;lt;/tt&amp;gt;). RAW files are uncompressed 8-bit PCM audio files without any header. The rest of the files (with numbers &amp;lt; 300) are found in &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;.&lt;br /&gt;
TIM 3 has &amp;lt;tt&amp;gt;.WAV&amp;lt;/tt&amp;gt; files instead in the archive file an there is no &amp;lt;tt&amp;gt;TIM2.SX&amp;lt;/tt&amp;gt;. ({{TODO|TIM 3 sounds with numbers below 3000}}).&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;TAG:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk contains the names of the &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt; sub-files (in the archive file of the game) required for displaying the animation. Not counting the &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the 32-bit chunk size, the first two bytes of the data contains the number of image file names in 16-bit little endian format. The remaining part of the data is the list of image file name entries. A single entry is a 16-bit image ID followed by a null-terminated string containing the name of the image. In TIM 2, the ID of the first image is always 1, however, there are exceptions to this rule in TIM 3 (but never in part graphics). There is no gap in the numbering of the images, this makes the image ID field somewhat redundant.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;LAB:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is present in a small number of &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files in TIM 3. &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts never contain such a chunk. The structure of the &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot; chunk is similar to &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, it consists of the number of entries stored as 16-bit integer, followed by item ID-null terminated string pairs. The strings are apparently not user interface texts visible to the player. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{TODO|This is a work in progress}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TODO, this file format does not really belong to any category present in this site --&amp;gt;&lt;br /&gt;
[[Category:File Formats]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10588</id>
		<title>The Incredible Machine 2-3 ANM File Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_2-3_ANM_File_Format&amp;diff=10588"/>
		<updated>2022-07-21T15:45:34Z</updated>

		<summary type="html">&lt;p&gt;Knt47: Created page with &amp;quot; The &amp;#039;&amp;#039;&amp;#039;animation&amp;#039;&amp;#039;&amp;#039; (&amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt;) sub-files are found in the archive file of The Incredible Machine 2 (TIM 2) and [[Thie Incredible Machine 3|3]...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The &#039;&#039;&#039;animation&#039;&#039;&#039; (&amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt;) sub-files are found in the [[TIM Resource Format|archive file]] of [[The Incredible Machine 2]] (TIM 2) and [[Thie Incredible Machine 3|3]] (TIM 3). They contain the information required for drawing puzzle part sprites, which are often comprised of multiple sub-images of [[The Incredible Machine Image Format|image files]] and for animations of the puzzle parts. They are also used for animated parts of the game&#039;s user interface (for example the animated icons of the main menu). It can also contain commands for playing sound effects.&lt;br /&gt;
&lt;br /&gt;
Most &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files (all in TIM 2) contain two chunks, starting with &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;  and &amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, respectively. Both use the typical &amp;quot;Dynamix chunk&amp;quot; format, starting with the 4-byte chunk type (&amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot;/&amp;quot;&amp;lt;tt&amp;gt;TAG:&amp;lt;/tt&amp;gt;&amp;quot;, followed by the chunk size in 32-bit, little endian format. Unlike other Dynamix file formats, the most significant bit in the 32-bit size of the first chunk is not set. A small number of files in TIM 3 contain a third chunk, &amp;quot;&amp;lt;tt&amp;gt;LAB:&amp;lt;/tt&amp;gt;&amp;quot;, with an unclear meaning.&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;ANM:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
Not counting the chunk type and size, an &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt; chunk has five parts, a 16 or 22 byte header, and four sections containing the actual sprite/animation frame/animation data, labeled here as A-D.&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk (not counting the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk type identifier and the chunk size) starts with a header, with a size of 16 or 22 bytes, depending on the magic number. It has the following Format:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] magic_number_1;&lt;br /&gt;
  UINT16LE magic_number_2;&lt;br /&gt;
  UINT16LE size_section_a;&lt;br /&gt;
  UINT16LE size_section_b;&lt;br /&gt;
  UINT16LE size_section_c;&lt;br /&gt;
  UINT16LE size_section_d;&lt;br /&gt;
  UINT16LE anm_width;&lt;br /&gt;
  UINT16LE anm_height;&lt;br /&gt;
  /* 3 members, found only in files with a magic number of 0x54 0x42 0xEA 0x03: */&lt;br /&gt;
  UINT16LE unknown_16;&lt;br /&gt;
  UINT16LE unknown_18;&lt;br /&gt;
  UINT16LE unknown_20;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;magic_number_1&#039;&#039;&#039;, &#039;&#039;&#039;magic_number_2&#039;&#039;&#039;:  The header starts with a 4-byte magic number. The first two bytes are always 0x54 0x42. The second two bytes are a 16-bit little endian file version number. In TIM 2, the possible values 1000 (0x3E8) or 1001 (0x3E9). There is no obvious difference in the format of the files using these two numbers, however, 0x3E9 is much more common and 0x3E8 is mostly used for relatively small and simple files. In TIM 3, a small number of files use a newer version of the &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; file format, with a magic_number_2 value of 1002 (0x3EA). Such files have a slightly different format compared to files with the other two numbers. The &amp;quot;newer&amp;quot; format is used in the user interface and the game menu, but never for puzzle part graphics.&lt;br /&gt;
* &#039;&#039;&#039;size_section_a&#039;&#039;&#039;: The number of entries in the A section of the &amp;quot;&amp;lt;tt&amp;gt;ANM:&amp;lt;/tt&amp;gt;&amp;quot; chunk, one entry is 2 byte (i.e. the section is an array of 16-bit integers). Several files do not have an A section (size_section_a == 0)&lt;br /&gt;
* &#039;&#039;&#039;size_section_b&#039;&#039;&#039;: The number of entries in the B section. One entry is 12 bytes in the files in files with &amp;lt;code&amp;gt;magic_number_2 = 0x3EA&amp;lt;/code&amp;gt;, 10 bytes in all other files.&lt;br /&gt;
* &#039;&#039;&#039;size_section_c&#039;&#039;&#039;: The number of entries in the C section, one entry is 4 bytes.&lt;br /&gt;
* &#039;&#039;&#039;size_section_d&#039;&#039;&#039;: The size of the D section in bytes.&lt;br /&gt;
* &#039;&#039;&#039;anm_width&#039;&#039;&#039;, &#039;&#039;&#039;anm_height&#039;&#039;&#039;: Width and height of the animation. In &amp;lt;tt&amp;gt;.ANM&amp;lt;/tt&amp;gt; files for puzzle parts, the two structure members usually have the same value as width_1 and height_1 for the part in puzzle/level files.   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{TODO|This is a work in progress}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- TODO, this file format does not really belong to any category present in this site --&amp;gt;&lt;br /&gt;
[[Category:File formats]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10587</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10587"/>
		<updated>2022-07-21T15:28:59Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Puzzle part data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 00 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;EF AC 12 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;). An empty string in .GKC files with magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
Hints are supported only in TIM 2 and 3 puzzles. The first two bytes of the hint data contain the number of the hints in 16-bit little endian format. This is followed by 8 hint entries, some of them may be unused. A size of an unused entry is 7 bytes. One entry consists of three 16-bit integers and a null-terminated string containing the hint text. The three integer members are (all have a 16-bit little endian format):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;position_x&#039;&#039;&#039;: The X position of the hand icon for the hint.&lt;br /&gt;
* &#039;&#039;&#039;position_y&#039;&#039;&#039;: The Y position.&lt;br /&gt;
* &#039;&#039;&#039;hint_icon_flip&#039;&#039;&#039;: The hand icon of a hint can be flipped and can have four different orientations. Possible values are 0-3.&lt;br /&gt;
&lt;br /&gt;
In TIM 2, there are 3 (?) puzzles with magic number &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;. Neither of these files contain hints. However, the size of the empty hints section is 42 bytes in them instead of the expected 58.&lt;br /&gt;
&lt;br /&gt;
== Puzzle information data structure ==&lt;br /&gt;
&lt;br /&gt;
=== In TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
In TIM and TEMIM, there are two different puzzle header information data structures, one is used by the puzzles, and the another is found in saved &amp;quot;freeform&amp;quot; machines and the GKC files.&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM / TEMIM puzzles:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] bonus_1;&lt;br /&gt;
  UINT16LE bonus_2;&lt;br /&gt;
  [[INT16LE]] pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  INT16LE unknown_8;&lt;br /&gt;
  INT16LE unknown_10;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
The information structure format in saved &amp;quot;freeform&amp;quot; machines and GKC files:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bonus_1&#039;&#039;&#039;: The value of &amp;quot;Bonus 1&amp;quot; immediately after the puzzle is loaded (its value is constantly decreasing while the player is solving the puzzle).&lt;br /&gt;
* &#039;&#039;&#039;bonus_2&#039;&#039;&#039;: The value of &amp;quot;Bonus 2&amp;quot; for the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;unknown_8&#039;&#039;&#039;, &#039;&#039;unknown_10&#039;&#039;: The value of these two members is always -8. Perhaps the top left corner of the screen in the coordinate system used for puzzle parts, which is also (-8, -8).&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1001-1016 for TIM and 1001-1021 for TEMIM.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move (e.g. walls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that move (e.g. balls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_in_partsbin&#039;&#039;&#039;: The number of parts that are placed into the parts bin. (The player needs to position them in order to solve the puzzle.)&lt;br /&gt;
&lt;br /&gt;
=== In TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM 2 and 3:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE unknown_4;&lt;br /&gt;
  UINT16LE unknown_6;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE unknown_14;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1000-1023.&lt;br /&gt;
* &#039;&#039;&#039;unknown_4&#039;&#039;&#039;, &#039;&#039;&#039;unknown_6&#039;&#039;&#039;: Meaning is unknown, always 0.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move, regardless of whether they are placed initially into the parts bin or not.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that can move.&lt;br /&gt;
* &#039;&#039;&#039;unknown_14&#039;&#039;&#039;: Value is always 0. Likely this member corresponds to num_parts_in_partsbin in TIM/TEMIM puzzle header. However, parts found in the parts bin are not a separate section in TIM 2 / 3, &lt;br /&gt;
&lt;br /&gt;
== Puzzle part data ==&lt;br /&gt;
&lt;br /&gt;
As already discussed in the With the exception of TIM demo version (see below), the size of a part entry for the majority of puzzle parts is 48 bytes. However, there are exceptions, which are discussed in separate sub-sections. The format of the &amp;quot;default&amp;quot; part entry:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  [[BYTE]] belt_connect_pos_x;&lt;br /&gt;
  BYTE belt_connect_pos_y;&lt;br /&gt;
  UINT16LE belt_line_distance;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE rope_1_connect_pos_x;&lt;br /&gt;
  BYTE rope_1_connect_pos_y;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  BYTE rope_2_connect_pos_x;&lt;br /&gt;
  BYTE rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_type_num&#039;&#039;&#039;: A number associated with the type of the part (e.g. 0 - bowling ball). Required for identifying parts with an entry size different from the default. See [[The Incredible Machine Level Format/Part Numbers]]&lt;br /&gt;
* &#039;&#039;&#039;flags_1&#039;&#039;&#039;: A combination of flag bits.&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039; uses the following flag bits:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: Unknown meaning, used for a few &amp;quot;moving&amp;quot; parts (bucket, candle)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Set if the part is a wall.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x800&amp;lt;/code&amp;gt;: Part is placed initially into the parts bin (see num_parts_in_partsbin in part information data structure)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x4000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position (see &#039;&#039;num_parts_fixed&#039;&#039;)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: Set when 0x800 is not set ({{TODO|further testing needed}})&lt;br /&gt;
** In &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;, the bits have a known meaning:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Meaning unclear, used for &amp;quot;moving&amp;quot; parts only, but not always set, even for a single type of part.***&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, affected by gravity.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;, 0x4000: Used in combination for parts that do not move and are not affected by gravity.&lt;br /&gt;
* &#039;&#039;&#039;flags_2&#039;&#039;&#039;: Another word containing flag bits. The meaning of most flags is the same in all game versions.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: A belt can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: A belt is connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: A rope can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: A second rope can be connected to the part (teeter-totter)&lt;br /&gt;
** &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;: The part sprite is drawn horizontally flipped.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: The part sprite is drawn vertically flipped. Note on flip flags: Flipping a part in the game does not necessarily mean that one of the flip flags will be changed. For several parts, especially in TIM 2 / 3, flipping will affect the value of the &#039;&#039;appearance&#039;&#039; member.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Probably unused&lt;br /&gt;
** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Part can be stretched in at least one direction: inclines, conveyor belt, walls.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: Parts that can be stretched both horizontally and vertically, the walls.&lt;br /&gt;
* &#039;&#039;&#039;flags_3&#039;&#039;&#039;: Some flags are only present in TIM 2 / 3. This member of the part data structure is missing in the demo version of TIM.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: The part can be plugged into an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: The part is an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: The part can burn (e.g. candle) or has a fuse that can be lit (e.g. dynamite, cannon). Usually in combination with flag 0x8. &lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: Meaning of this flag is unclear. Used for several part types, but changing it has no apparent consequence (?) &lt;br /&gt;
** Flags present only in &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Part is &amp;quot;locked&amp;quot;, i.e not placed into the part bin.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Sizable scenery part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: {{TODO|unknown meaning}}&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: A &amp;quot;program&amp;quot; icon is shown for the part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: Scenery part&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Wall part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: A &amp;quot;Puzzle solution&amp;quot; icon is shown for the part (?)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: An identifier for the sprite that is shown for a part before the machine is started. (Once the machine is started, the state of the part can change and so can the sprite shown.) The meaning is different between TIM and TIM 2. In TIM, the sprite of some parts consists of only one image, in this case, this is often the number of the sub-image in the image resource file. ({{TODO|For other parts, this is probably an internal identifier for the sprite (?)}}). In TIM 2 and 3, the meaning of the appearance is an index in the A section of the [[The Incredible Machine 2-3 ANM File Format|.ANM file]] for the part, or if this is absent, an index in the B section. &amp;quot;Programming&amp;quot; a part in TIM 2 and 3 often results in the change of this field.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;: The width and height of the selectable area of the part ({{TODO|more reverse engineering work needed}})&lt;br /&gt;
* &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: At least in TIM 2, witdh_2 is used for calculating the position of part sprite when the part is flipped because of the horizontal flip bit is set in flags_2.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the part, usually the top left corner of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: In TIM 2 and 3, a programmed behavior of the part. (However, for many parts, &amp;quot;programming&amp;quot; modifies the &#039;&#039;appearance&#039;&#039; member.) For example the number of shots of the phazer gun or character shown by the message computer.  Meaning is different for rope parts, see below. Unused in TIM and TEMIM (except for ropes).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Probably unused, usually 0. Note that belt parts have a value of 1 in this position.&lt;br /&gt;
* &#039;&#039;&#039;belt_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;belt_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Always positive or 0, because &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039; are the coordinates of the top left corner where the sprite starts. Note that the formulas required for calculating the exact position of the belt are slightly different between TIM and TIM 2. Parts for which connection of a belt is allowed have a distinct circular area in their sprite, corresponding to the location where the belt is connected. In TIM / TEMIM, &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; is approximately the top left corner of its bounding rectangle, while in TIM 2 /3 it is close to the center of the circle.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_line_distance&#039;&#039;&#039;: The belts in the game appear as two, usually not perfectly parallel black (TIM / TEMIM) or gray (TIM 2 / 3) lines. This parameter determines the distance between the two segments, More precisely, it is either approximately the diameter of the circular area mentioned at &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; (TIM / TEMIM) or its radius (TIM 2 / 3).&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Similarly to belt_connect_pos_x/y, always positive or 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_2_connect_pos_y&#039;&#039;&#039;: The same as &#039;&#039;rope_1_connect_pos_x&#039;&#039;, &#039;&#039;rope_1_connect_pos_y&#039;&#039;, bit for another connected rope part.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;: The index of one or two parts in the puzzle that are connected to this part with a rope. If the rope runs through pulleys, this is the part index of the first pulley. If no rope is connected or this is not possible for the part, the value of both structure members are -1. (Of course, if one rope is connected, the value of one structure member (usually connected_rope_1) is the index of the rope part and the other is -1) )In TIM 2 and 3, the &amp;quot;remote bomb&amp;quot; part actually corresponds to two entries in the puzzle file. The connected_rope_2 field contains the index of the another &amp;quot;element&amp;quot; of the bomb, in both entries.&lt;br /&gt;
* &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: These structure members are only meaningful for electric outlet parts. Electric outlets always have 2 &amp;quot;sockets&amp;quot; for parts requiring electricity. It contains the index/indices of the part/parts plugged into the electric outlet, or -1 if the &amp;quot;socket&amp;quot; is free. If the part does not support this, both values are -1.&lt;br /&gt;
&lt;br /&gt;
=== Belts ===&lt;br /&gt;
&lt;br /&gt;
Belt parts (part 8) (except in the demo version of TIM, see below) use a 52-byte entry, with the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 8 for belts */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  INT16LE belt_connected_part_1;&lt;br /&gt;
  INT16LE belt_connected_part_2;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  UINT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x40&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, belts have no true sprite (represented by two lines).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for belts, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039; In TIM / TEMIM, either 0 or -1. In TIM 2, -1 or -100 (0xff9c). Meaning of these numbers is unclear, and the usage of the two different values do not correlate with the flags.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Always 1, perhaps indicates that the part is a belt.&lt;br /&gt;
* &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;belt_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this belt. In TIM and TEMIM, both are -1 if the belt is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;, &#039;&#039;&#039;unknown_40&#039;&#039;&#039;, &#039;&#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Ropes ===&lt;br /&gt;
&lt;br /&gt;
Rope parts (part 10) (except in the demo version of TIM, see below) use a 54-byte entry. TIM 2 and 3 also have a &amp;quot;steel cable&amp;quot; part (part 76) which also behaves as a rope and the size of the part entry is also identical. The rope part entry has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 10 for rope, 76 for steel cable */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE rope_segment_length;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  INT16LE rope_connected_part_1;&lt;br /&gt;
  INT16LE rope_connected_part_2;&lt;br /&gt;
  BYTE part_1_connect_field_usage;&lt;br /&gt;
  BYTE part_2_connect_field_usage;&lt;br /&gt;
  UINT16LE unknown_44;&lt;br /&gt;
  UINT16LE unknown_46;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039;: Same flags used as in the belt part structure.&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, ropes have no true sprite (represented by one or more line segments).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for ropes, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: Similarly to belts, possible values are 0 and -1 in TIM / TEMIM; and -1 and -100 in TIM 2 / 3.&lt;br /&gt;
* &#039;&#039;&#039;rope_segment_length&#039;&#039;&#039;: The length of the rope (Euclidean distance between the two ends) if the rope does not run through pulleys. Otherwise, the length of the rope segment between the part at one end (rope_connected_part_1 (?)) and the first pulley ({{TODO|additional testing needed}}).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for pulleys.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;rope_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this rope (never the pulleys). In TIM and TEMIM, both are -1 if the rope is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;part_1_connect_field_usage&#039;&#039;&#039;, &#039;&#039;&#039;part_2_connect_field_usage&#039;&#039;&#039;: Whether &#039;&#039;connected_1&#039;&#039; or &#039;&#039;connected_2&#039;&#039; is used in the two connected parts for this rope. 0 if connected_1, 1 if connected_2. ({{TODO|additional testing needed}})&lt;br /&gt;
* &#039;&#039;&#039;unknown_44&#039;&#039;&#039;, &#039;&#039;&#039;unknown_46&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Pulleys ===&lt;br /&gt;
&lt;br /&gt;
The format of the 56-byte puzzle part entry for the pulley (part 7):&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 7 for pulley */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_y;&lt;br /&gt;
  INT16LE unknown_36;&lt;br /&gt;
  INT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE pulley_connected_1;&lt;br /&gt;
  INT16LE pulley_connected_2;&lt;br /&gt;
  INT16LE unknown_50;&lt;br /&gt;
  INT16LE unknown_52;&lt;br /&gt;
  INT16LE rope_index;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x8&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;0x0&amp;lt;/code&amp;gt; {{TODO|in some cases}})&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x48&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Pulleys can have four different sprites depending on the orientation. Possible values are 0-3.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: The size of the pulley sprite. In TIM 2 / 3, also depends on the orientation.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the pulley, top left coordinates of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;, &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for ropes.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where one rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Depends on the orientation of the pulley, like &#039;&#039;appearance&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;unknown_40&#039;&#039;, &#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_2_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where the other rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;pulley_connected_1&#039;&#039;&#039;, &#039;&#039;&#039;pulley_connected_2&#039;&#039;&#039;: Either the index of part at one of the two ends of the rope, or the index of next or previous pulley the rope is running through.&lt;br /&gt;
* &#039;&#039;&#039;unknown_50&#039;&#039;&#039;, &#039;&#039;&#039;unknown_52&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;rope_index&#039;&#039;&#039;: In TIM 2 / 3, the index of the rope part. Not used (-1) in TIM and TEMIM.&lt;br /&gt;
&lt;br /&gt;
=== Programmable ball (TIM 2 / 3) ===&lt;br /&gt;
&lt;br /&gt;
The programmable ball part is present in TIM 2 and 3, and its part type number is 87. The size of the entry is 60 bytes in total. The first 48 bytes is the same as the default part data structure, which is followed by another, 12-byte structure specific to this part. The format of the programmable ball data is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE density;&lt;br /&gt;
  UINT16LE elasticity;&lt;br /&gt;
  UINT16LE friction;&lt;br /&gt;
  INT16LE gravity_buoyancy;&lt;br /&gt;
  UINT16LE mass;&lt;br /&gt;
  UINT16LE appearance_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;density&#039;&#039;&#039;: The density of the ball, affects the buoyant force acting on the ball.&lt;br /&gt;
* &#039;&#039;&#039;elasticity&#039;&#039;&#039;: The elasticity of the ball.&lt;br /&gt;
* &#039;&#039;&#039;friction&#039;&#039;&#039;: The friction.&lt;br /&gt;
* &#039;&#039;&#039;gravity_buoyancy&#039;&#039;&#039;: A calculated parameter, using the density and the mass of the ball, as well as the gravity and the pressure set for the puzzle. If its value is negative, the ball will rise due to the buoyant force rather than fall.&lt;br /&gt;
* &#039;&#039;&#039;mass&#039;&#039;&#039;: The mass of the ball.&lt;br /&gt;
* &#039;&#039;&#039;appearance_2&#039;&#039;&#039;: Has the same value as the &#039;&#039;appearance&#039;&#039; field. The ball can have 7 different colors/patterns.&lt;br /&gt;
&lt;br /&gt;
The game has a dialog for setting the four physical properties (mass, elasticity, density, friction, in this order). However, the number stored in the data structure is not the same as the numbers shown on the program dialog. For example, if following settings are used for the ball: &amp;lt;code&amp;gt;mass = 8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 3&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;density = 7&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 3&amp;lt;/code&amp;gt;; and the default values are used for gravity/pressure, the puzzle file will contain the following values: &amp;lt;code&amp;gt;density = 3000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 128&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 16&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;gravity_buoyancy = 269&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mass = 201&amp;lt;/code&amp;gt;. (Note: There is an inconsistency in the game here, the programmable ball part uses &amp;lt;code&amp;gt;density = 2832&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mass = 200&amp;lt;/code&amp;gt; by default, which does not correspond exactly to any value that can be set in the dialog.)&lt;br /&gt;
&lt;br /&gt;
=== TIM demo version ===&lt;br /&gt;
&lt;br /&gt;
In the demo version of the (original) TIM (available at several DOS shareware game websites), the &#039;&#039;flags_3&#039;&#039;, &#039;&#039;outlet_plugged_1&#039;&#039; and &#039;&#039;outlet_plugged_2&#039;&#039; fields are missing.&lt;br /&gt;
Instead, the 42-byte part data (46 for belts, 48 for ropes, 50 for pulleys) is followed by an another, variable length data structure of unknown significance consisting of 16-bit little endian integers. It is always at least 2 bytes long, and the first two bytes contain the number of additional 16-bit words after this size word. The reverse engineering of this structure is complicated by the fact that it is only present in a demo version containing only 8 puzzles.&lt;br /&gt;
&lt;br /&gt;
== Puzzle solution information ==&lt;br /&gt;
&lt;br /&gt;
Puzzle solution information is only present in TIM 2 and TIM 3 puzzles. Its size is always 132 bytes and can contain 8 different conditions that must be satisfied so that the game will recognize the puzzle as solved. The first two bytes contains the number of such conditions actually set, in a 16-bit little endian format. This is followed by 8 entries, 16 bytes each, containing the required information for solution checking by the game. The format of each entry is:&lt;br /&gt;
&lt;br /&gt;
  INT16LE part_index;&lt;br /&gt;
  UINT16LE part_state_1;&lt;br /&gt;
  UINT16LE part_state_2;&lt;br /&gt;
  UINT16LE part_count;&lt;br /&gt;
  INT16LE position_rect_x;&lt;br /&gt;
  INT16LE position_rect_y;&lt;br /&gt;
  INT16LE position_rect_width;&lt;br /&gt;
  INT16LE position_rect_height;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_index&#039;&#039;&#039;: The index of the part in the puzzle file involved in the solution. -1 (0xFF 0xFF) for unused entries.&lt;br /&gt;
* &#039;&#039;&#039;part_state_1&#039;&#039;&#039;: An ID for a &amp;quot;physical state&amp;quot; of a part (for example a balloon was popped or a candle was lit). In many puzzles, one specific part must be in a specified &amp;quot;physical state&amp;quot; in order to complete the level. This is the same ID for a &amp;quot;part state&amp;quot; as the &#039;&#039;first_frame_id&#039;&#039; member found in the C section of the part&#039;s ANM file.&lt;br /&gt;
* &#039;&#039;&#039;part_state_2&#039;&#039;&#039;: Another ID for a &amp;quot;physical state&amp;quot;, the exact meaning is unclear.&lt;br /&gt;
* &#039;&#039;&#039;part_count&#039;&#039;&#039;: The value of the &amp;quot;Part count&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_x&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_y&#039;&#039;&#039;: The top left corner of the &amp;quot;position rectangle&amp;quot;. If such a solution specified puzzle part must be located within this rectangle in order to solve the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_width&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_height&#039;&#039;&#039;: Width and height of the &amp;quot;position rectangle&amp;quot;, see above.&lt;br /&gt;
&lt;br /&gt;
For the last four members (&amp;quot;position rectangle&amp;quot;), there are &amp;quot;fixed&amp;quot; combinations of values with special meaning:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-1, -1, -1, -1&amp;lt;/code&amp;gt;: &amp;quot;Off screen&amp;quot;, the part must leave the area visible on the game screen.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, -2000, 1640, 2000&amp;lt;/code&amp;gt;: &amp;quot;Off top&amp;quot;, the part must leave the visible area at the top.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, 400, 1640, 3000&amp;lt;/code&amp;gt;: &amp;quot;Off bottom&amp;quot;&lt;br /&gt;
* &amp;lt;code&amp;gt;0, 0, 0, 0&amp;lt;/code&amp;gt;: No such solution programmed, either this is &amp;quot;part state&amp;quot; solution or an unused entry (&amp;lt;code&amp;gt;part_index = -1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The last 2 bytes of the section contain the value of the &amp;quot;Delay&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game, in 16-bit little endian format.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note on puzzle solution information in TIM and TEMIM&#039;&#039;&#039;: TIM / TEMIM puzzles do not contain such data. This can also be demonstrated by extracting e.g. &amp;lt;tt&amp;gt;L1.LEV&amp;lt;/tt&amp;gt; from the archive file and rename the file to change the number. After starting the game, the level with the same number as the renamed file will be replaced with level 1. When playing the modified level, the game will not be able to check whether the puzzle is solved. Depending on its number, the level can become unwinnable or winnable by just clicking on the start machine button. Sometimes the game freezes.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{TODO|Level viewer will be published soon}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10586</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10586"/>
		<updated>2022-07-21T15:25:49Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* In TIM and TEMIM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 00 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;EF AC 12 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;). An empty string in .GKC files with magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
Hints are supported only in TIM 2 and 3 puzzles. The first two bytes of the hint data contain the number of the hints in 16-bit little endian format. This is followed by 8 hint entries, some of them may be unused. A size of an unused entry is 7 bytes. One entry consists of three 16-bit integers and a null-terminated string containing the hint text. The three integer members are (all have a 16-bit little endian format):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;position_x&#039;&#039;&#039;: The X position of the hand icon for the hint.&lt;br /&gt;
* &#039;&#039;&#039;position_y&#039;&#039;&#039;: The Y position.&lt;br /&gt;
* &#039;&#039;&#039;hint_icon_flip&#039;&#039;&#039;: The hand icon of a hint can be flipped and can have four different orientations. Possible values are 0-3.&lt;br /&gt;
&lt;br /&gt;
In TIM 2, there are 3 (?) puzzles with magic number &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;. Neither of these files contain hints. However, the size of the empty hints section is 42 bytes in them instead of the expected 58.&lt;br /&gt;
&lt;br /&gt;
== Puzzle information data structure ==&lt;br /&gt;
&lt;br /&gt;
=== In TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
In TIM and TEMIM, there are two different puzzle header information data structures, one is used by the puzzles, and the another is found in saved &amp;quot;freeform&amp;quot; machines and the GKC files.&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM / TEMIM puzzles:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] bonus_1;&lt;br /&gt;
  UINT16LE bonus_2;&lt;br /&gt;
  [[INT16LE]] pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  INT16LE unknown_8;&lt;br /&gt;
  INT16LE unknown_10;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
The information structure format in saved &amp;quot;freeform&amp;quot; machines and GKC files:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bonus_1&#039;&#039;&#039;: The value of &amp;quot;Bonus 1&amp;quot; immediately after the puzzle is loaded (its value is constantly decreasing while the player is solving the puzzle).&lt;br /&gt;
* &#039;&#039;&#039;bonus_2&#039;&#039;&#039;: The value of &amp;quot;Bonus 2&amp;quot; for the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;unknown_8&#039;&#039;&#039;, &#039;&#039;unknown_10&#039;&#039;: The value of these two members is always -8. Perhaps the top left corner of the screen in the coordinate system used for puzzle parts, which is also (-8, -8).&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1001-1016 for TIM and 1001-1021 for TEMIM.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move (e.g. walls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that move (e.g. balls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_in_partsbin&#039;&#039;&#039;: The number of parts that are placed into the parts bin. (The player needs to position them in order to solve the puzzle.)&lt;br /&gt;
&lt;br /&gt;
=== In TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM 2 and 3:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE unknown_4;&lt;br /&gt;
  UINT16LE unknown_6;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE unknown_14;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1000-1023.&lt;br /&gt;
* &#039;&#039;&#039;unknown_4&#039;&#039;&#039;, &#039;&#039;&#039;unknown_6&#039;&#039;&#039;: Meaning is unknown, always 0.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move, regardless of whether they are placed initially into the parts bin or not.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that can move.&lt;br /&gt;
* &#039;&#039;&#039;unknown_14&#039;&#039;&#039;: Value is always 0. Likely this member corresponds to num_parts_in_partsbin in TIM/TEMIM puzzle header. However, parts found in the parts bin are not a separate section in TIM 2 / 3, &lt;br /&gt;
&lt;br /&gt;
== Puzzle part data ==&lt;br /&gt;
&lt;br /&gt;
As already discussed in the With the exception of TIM demo version (see below), the size of a part entry for the majority of puzzle parts is 48 bytes. However, there are exceptions, which are discussed in separate sub-sections. The format of the &amp;quot;default&amp;quot; part entry:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  [[BYTE]] belt_connect_pos_x;&lt;br /&gt;
  BYTE belt_connect_pos_y;&lt;br /&gt;
  UINT16LE belt_line_distance;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE rope_1_connect_pos_x;&lt;br /&gt;
  BYTE rope_1_connect_pos_y;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  BYTE rope_2_connect_pos_x;&lt;br /&gt;
  BYTE rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_type_num&#039;&#039;&#039;: A number associated with the type of the part (e.g. 0 - bowling ball). Required for identifying parts with an entry size different from the default. See [[The Incredible Machine Level Format/Part Numbers]]&lt;br /&gt;
* &#039;&#039;&#039;flags_1&#039;&#039;&#039;: A combination of flag bits.&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039; uses the following flag bits:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: Unknown meaning, used for a few &amp;quot;moving&amp;quot; parts (bucket, candle)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Set if the part is a wall.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x800&amp;lt;/code&amp;gt;: Part is placed initially into the parts bin (see num_parts_in_partsbin in part information data structure)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x4000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position (see &#039;&#039;num_parts_fixed&#039;&#039;)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: Set when 0x800 is not set ({{TODO|further testing needed}})&lt;br /&gt;
** In &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;, the bits have a known meaning:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Meaning unclear, used for &amp;quot;moving&amp;quot; parts only, but not always set, even for a single type of part.***&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, affected by gravity.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;, 0x4000: Used in combination for parts that do not move and are not affected by gravity.&lt;br /&gt;
* &#039;&#039;&#039;flags_2&#039;&#039;&#039;: Another word containing flag bits. The meaning of most flags is the same in all game versions.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: A belt can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: A belt is connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: A rope can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: A second rope can be connected to the part (teeter-totter)&lt;br /&gt;
** &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;: The part sprite is drawn horizontally flipped.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: The part sprite is drawn vertically flipped. Note on flip flags: Flipping a part in the game does not necessarily mean that one of the flip flags will be changed. For several parts, especially in TIM 2 / 3, flipping will affect the value of the &#039;&#039;appearance&#039;&#039; member.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Probably unused&lt;br /&gt;
** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Part can be stretched in at least one direction: inclines, conveyor belt, walls.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: Parts that can be stretched both horizontally and vertically, the walls.&lt;br /&gt;
* &#039;&#039;&#039;flags_3&#039;&#039;&#039;: Some flags are only present in TIM 2 / 3. This member of the part data structure is missing in the demo version of TIM.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: The part can be plugged into an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: The part is an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: The part can burn (e.g. candle) or has a fuse that can be lit (e.g. dynamite, cannon). Usually in combination with flag 0x8. &lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: Meaning of this flag is unclear. Used for several part types, but changing it has no apparent consequence (?) &lt;br /&gt;
** Flags present only in &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Part is &amp;quot;locked&amp;quot;, i.e not placed into the part bin.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Sizable scenery part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: {{TODO|unknown meaning}}&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: A &amp;quot;program&amp;quot; icon is shown for the part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: Scenery part&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Wall part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: A &amp;quot;Puzzle solution&amp;quot; icon is shown for the part (?)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: An identifier for the sprite that is shown for a part before the machine is started. (Once the machine is started, the state of the part can change and so can the sprite shown.) The meaning is different between TIM and TIM 2. In TIM, the sprite of some parts consists of only one image, in this case, this is often the number of the sub-image in the image resource file. ({{TODO|For other parts, this is probably an internal identifier for the sprite (?)}}). In TIM 2 and 3, the meaning of the appearance is an index in the A section of the [[The Incredible Machine 2-3 ANM File Format|.ANM file]] for the part, or if this is absent, an index in the B section. &amp;quot;Programming&amp;quot; a part in TIM 2 and 3 often results in the change of this field.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;: The width and height of the selectable area of the part ({{TODO|more reverse engineering work needed}})&lt;br /&gt;
* &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: At least in TIM 2, witdh_2 is used for calculating the position of part sprite when the part is flipped because of the horizontal flip bit is set in flags_2.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the part, usually the top left corner of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: In TIM 2 and 3, a programmed behavior of the part. (However, for many parts, &amp;quot;programming&amp;quot; modifies the &#039;&#039;appearance&#039;&#039; member.) For example the number of shots of the phazer gun or character shown by the message computer.  Meaning is different for rope parts, see below. Unused in TIM and TEMIM (except for ropes).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Probably unused, usually 0. Note that belt parts have a value of 1 in this position.&lt;br /&gt;
* &#039;&#039;&#039;belt_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;belt_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Always positive or 0, because &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039; are the coordinates of the top left corner where the sprite starts. Note that the formulas required for calculating the exact position of the belt are slightly different between TIM and TIM 2. Parts for which connection of a belt is allowed have a distinct circular area in their sprite, corresponding to the location where the belt is connected. In TIM / TEMIM, &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; is approximately the top left corner of its bounding rectangle, while in TIM 2 /3 it is close to the center of the circle.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_line_distance&#039;&#039;&#039;: The belts in the game appear as two, usually not perfectly parallel black (TIM / TEMIM) or gray (TIM 2 / 3) lines. This parameter determines the distance between the two segments, More precisely, it is either approximately the diameter of the circular area mentioned at &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; (TIM / TEMIM) or its radius (TIM 2 / 3).&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Similarly to belt_connect_pos_x/y, always positive or 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_2_connect_pos_y&#039;&#039;&#039;: The same as &#039;&#039;rope_1_connect_pos_x&#039;&#039;, &#039;&#039;rope_1_connect_pos_y&#039;&#039;, bit for another connected rope part.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;: The index of one or two parts in the puzzle that are connected to this part with a rope. If the rope runs through pulleys, this is the part index of the first pulley. If no rope is connected or this is not possible for the part, the value of both structure members are -1. (Of course, if one rope is connected, the value of one structure member (usually connected_rope_1) is the index of the rope part and the other is -1) )In TIM 2 and 3, the &amp;quot;remote bomb&amp;quot; part actually corresponds to two entries in the puzzle file. The connected_rope_2 field contains the index of the another &amp;quot;element&amp;quot; of the bomb, in both entries.&lt;br /&gt;
* &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: These structure members are only meaningful for electric outlet parts. Electric outlets always have 2 &amp;quot;sockets&amp;quot; for parts requiring electricity. It contains the index/indices of the part/parts plugged into the electric outlet, or -1 if the &amp;quot;socket&amp;quot; is free. If the part does not support this, both values are -1.&lt;br /&gt;
&lt;br /&gt;
=== Belts ===&lt;br /&gt;
&lt;br /&gt;
Belt parts (part 8) (except in the demo version of TIM, see below) use a 52-byte entry, with the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 8 for belts */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  INT16LE belt_connected_part_1;&lt;br /&gt;
  INT16LE belt_connected_part_2;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  UINT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x40&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, belts have no true sprite (represented by two lines).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for belts, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039; In TIM/TEMIM, either 0 or -1. In TIM 2, -1 or -100 (0xff9c). Meaning of these numbers is unclear, and the usage of the two different values do not correlate with the flags.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Always 1, perhaps indicates that the part is a belt.&lt;br /&gt;
* &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;belt_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this belt. In TIM and TEMIM, both are -1 if the belt is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;, &#039;&#039;&#039;unknown_40&#039;&#039;&#039;, &#039;&#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Ropes ===&lt;br /&gt;
&lt;br /&gt;
Rope parts (part 10) (except in the demo version of TIM, see below) use a 54-byte entry. TIM 2 and 3 also have a &amp;quot;steel cable&amp;quot; part (part 76) which also behaves as a rope and the size of the part entry as also identical. The rope part entry has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 10 for rope, 76 for steel cable */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE rope_segment_length;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  INT16LE rope_connected_part_1;&lt;br /&gt;
  INT16LE rope_connected_part_2;&lt;br /&gt;
  BYTE part_1_connect_field_usage;&lt;br /&gt;
  BYTE part_2_connect_field_usage;&lt;br /&gt;
  UINT16LE unknown_44;&lt;br /&gt;
  UINT16LE unknown_46;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039;: Same flags used as in the belt part structure.&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, ropes have no true sprite (represented by one or more line segments).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for ropes, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: Similarly to belts, possible values are 0 and -1 in TIM / TEMIM; and -1 and -100 in TIM 2 / 3.&lt;br /&gt;
* &#039;&#039;&#039;rope_segment_length&#039;&#039;&#039;: The length of the rope (Euclidean distance between the two ends) if the rope does not run through pulleys. Otherwise, the length of the rope segment between the part at one end (rope_connected_part_1 (?)) and the first pulley ({{TODO|additional testing needed}}).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for pulleys.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;rope_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this rope (never the pulleys). In TIM and TEMIM, both are -1 if the rope is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;part_1_connect_field_usage&#039;&#039;&#039;, &#039;&#039;&#039;part_2_connect_field_usage&#039;&#039;&#039;: Whether &#039;&#039;connected_1&#039;&#039; or &#039;&#039;connected_2&#039;&#039; is used in the two connected parts for this rope. 0 if connected_1, 1 if connected_2. ({{TODO|additional testing needed}})&lt;br /&gt;
* &#039;&#039;&#039;unknown_44&#039;&#039;&#039;, &#039;&#039;&#039;unknown_46&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Pulleys ===&lt;br /&gt;
&lt;br /&gt;
The format of the 56-byte puzzle part entry for the pulley (part 7):&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 7 for pulley */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_y;&lt;br /&gt;
  INT16LE unknown_36;&lt;br /&gt;
  INT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE pulley_connected_1;&lt;br /&gt;
  INT16LE pulley_connected_2;&lt;br /&gt;
  INT16LE unknown_50;&lt;br /&gt;
  INT16LE unknown_52;&lt;br /&gt;
  INT16LE rope_index;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x8&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;0x0&amp;lt;/code&amp;gt; {{TODO|in some cases}})&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x48&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Pulleys can have four different sprites depending on the orientation. Possible values are 0-3.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: The size of the pulley sprite. In TIM 2 / 3, also depends on the orientation.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the pulley, top left coordinates of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;, &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for ropes.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where one rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Depends on the orientation of the pulley, like &#039;&#039;appearance&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;unknown_40&#039;&#039;, &#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_2_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where the other rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;pulley_connected_1&#039;&#039;&#039;, &#039;&#039;&#039;pulley_connected_2&#039;&#039;&#039;: Either the index of part at one of the two ends of the rope, or the index of next or previous pulley the rope is running through.&lt;br /&gt;
* &#039;&#039;&#039;unknown_50&#039;&#039;&#039;, &#039;&#039;&#039;unknown_52&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;rope_index&#039;&#039;&#039;: In TIM 2 / 3, the index of the rope part. Not used (-1) in TIM and TEMIM.&lt;br /&gt;
&lt;br /&gt;
=== Programmable ball (TIM 2 / 3) ===&lt;br /&gt;
&lt;br /&gt;
The programmable ball part is present in TIM 2 and 3, and its part type number is 87. The size of the entry is 60 bytes in total. The first 48 bytes is the same as the default part data structure, which is followed by another, 12-byte structure specific to this part. The format of the programmable ball data is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE density;&lt;br /&gt;
  UINT16LE elasticity;&lt;br /&gt;
  UINT16LE friction;&lt;br /&gt;
  INT16LE gravity_buoyancy;&lt;br /&gt;
  UINT16LE mass;&lt;br /&gt;
  UINT16LE appearance_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;density&#039;&#039;&#039;: The density of the ball, affects the buoyant force acting on the ball.&lt;br /&gt;
* &#039;&#039;&#039;elasticity&#039;&#039;&#039;: The elasticity of the ball.&lt;br /&gt;
* &#039;&#039;&#039;friction&#039;&#039;&#039;: The friction.&lt;br /&gt;
* &#039;&#039;&#039;gravity_buoyancy&#039;&#039;&#039;: A calculated parameter, using the density and the mass of the ball, as well as the gravity and the pressure set for the puzzle. If its value is negative, the ball will rise due to the buoyant force rather than fall.&lt;br /&gt;
* &#039;&#039;&#039;mass&#039;&#039;&#039;: The mass of the ball.&lt;br /&gt;
* &#039;&#039;&#039;appearance_2&#039;&#039;&#039;: Has the same value as the &#039;&#039;appearance&#039;&#039; field. The ball can have 7 different colors/patterns.&lt;br /&gt;
&lt;br /&gt;
The game has a dialog for setting the four physical properties (mass, elasticity, density, friction, in this order). However, the number stored in the data structure is not the same as the numbers shown on the program dialog. For example, if following settings are used for the ball: &amp;lt;code&amp;gt;mass = 8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 3&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;density = 7&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 3&amp;lt;/code&amp;gt;; and the default values are used for gravity/pressure, the puzzle file will contain the following values: &amp;lt;code&amp;gt;density = 3000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 128&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 16&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;gravity_buoyancy = 269&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mass = 201&amp;lt;/code&amp;gt;. (Note: There is an inconsistency in the game here, the programmable ball part uses &amp;lt;code&amp;gt;density = 2832&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mass = 200&amp;lt;/code&amp;gt; by default, which does not correspond exactly to any value that can be set in the dialog.)&lt;br /&gt;
&lt;br /&gt;
=== TIM demo version ===&lt;br /&gt;
&lt;br /&gt;
In the demo version of the (original) TIM (available at several DOS shareware game websites), the &#039;&#039;flags_3&#039;&#039;, &#039;&#039;outlet_plugged_1&#039;&#039; and &#039;&#039;outlet_plugged_2&#039;&#039; fields are missing.&lt;br /&gt;
Instead, the 42-byte part data (46 for belts, 48 for ropes, 50 for pulleys) is followed by an another, variable length data structure of unknown significance consisting of 16-bit little endian integers. It is always at least 2 bytes long, and the first two bytes contain the number of additional 16-bit words after this size word. The reverse engineering of this structure is complicated by the fact that it is only present in a demo version containing only 8 puzzles.&lt;br /&gt;
&lt;br /&gt;
== Puzzle solution information ==&lt;br /&gt;
&lt;br /&gt;
Puzzle solution information is only present in TIM 2 and TIM 3 puzzles. Its size is always 132 bytes and can contain 8 different conditions that must be satisfied so that the game will recognize the puzzle as solved. The first two bytes contains the number of such conditions actually set, in a 16-bit little endian format. This is followed by 8 entries, 16 bytes each, containing the required information for solution checking by the game. The format of each entry is:&lt;br /&gt;
&lt;br /&gt;
  INT16LE part_index;&lt;br /&gt;
  UINT16LE part_state_1;&lt;br /&gt;
  UINT16LE part_state_2;&lt;br /&gt;
  UINT16LE part_count;&lt;br /&gt;
  INT16LE position_rect_x;&lt;br /&gt;
  INT16LE position_rect_y;&lt;br /&gt;
  INT16LE position_rect_width;&lt;br /&gt;
  INT16LE position_rect_height;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_index&#039;&#039;&#039;: The index of the part in the puzzle file involved in the solution. -1 (0xFF 0xFF) for unused entries.&lt;br /&gt;
* &#039;&#039;&#039;part_state_1&#039;&#039;&#039;: An ID for a &amp;quot;physical state&amp;quot; of a part (for example a balloon was popped or a candle was lit). In many puzzles, one specific part must be in a specified &amp;quot;physical state&amp;quot; in order to complete the level. This is the same ID for a &amp;quot;part state&amp;quot; as the &#039;&#039;first_frame_id&#039;&#039; member found in the C section of the part&#039;s ANM file.&lt;br /&gt;
* &#039;&#039;&#039;part_state_2&#039;&#039;&#039;: Another ID for a &amp;quot;physical state&amp;quot;, the exact meaning is unclear.&lt;br /&gt;
* &#039;&#039;&#039;part_count&#039;&#039;&#039;: The value of the &amp;quot;Part count&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_x&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_y&#039;&#039;&#039;: The top left corner of the &amp;quot;position rectangle&amp;quot;. If such a solution specified puzzle part must be located within this rectangle in order to solve the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_width&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_height&#039;&#039;&#039;: Width and height of the &amp;quot;position rectangle&amp;quot;, see above.&lt;br /&gt;
&lt;br /&gt;
For the last four members (&amp;quot;position rectangle&amp;quot;), there are &amp;quot;fixed&amp;quot; combinations of values with special meaning:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-1, -1, -1, -1&amp;lt;/code&amp;gt;: &amp;quot;Off screen&amp;quot;, the part must leave the area visible on the game screen.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, -2000, 1640, 2000&amp;lt;/code&amp;gt;: &amp;quot;Off top&amp;quot;, the part must leave the visible area at the top.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, 400, 1640, 3000&amp;lt;/code&amp;gt;: &amp;quot;Off bottom&amp;quot;&lt;br /&gt;
* &amp;lt;code&amp;gt;0, 0, 0, 0&amp;lt;/code&amp;gt;: No such solution programmed, either this is &amp;quot;part state&amp;quot; solution or an unused entry (&amp;lt;code&amp;gt;part_index = -1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The last 2 bytes of the section contain the value of the &amp;quot;Delay&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game, in 16-bit little endian format.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note on puzzle solution information in TIM and TEMIM&#039;&#039;&#039;: TIM / TEMIM puzzles do not contain such data. This can also be demonstrated by extracting e.g. &amp;lt;tt&amp;gt;L1.LEV&amp;lt;/tt&amp;gt; from the archive file and rename the file to change the number. After starting the game, the level with the same number as the renamed file will be replaced with level 1. When playing the modified level, the game will not be able to check whether the puzzle is solved. Depending on its number, the level can become unwinnable or winnable by just clicking on the start machine button. Sometimes the game freezes.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{TODO|Level viewer will be published soon}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine&amp;diff=10585</id>
		<title>The Incredible Machine</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine&amp;diff=10585"/>
		<updated>2022-07-21T15:16:32Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Files inside the RESOURCE.00? archive files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Game Infobox&lt;br /&gt;
 | Levels = No&lt;br /&gt;
 | Tiles = No&lt;br /&gt;
 | Sprites = No&lt;br /&gt;
 | Fullscreen = No&lt;br /&gt;
 | Sound = No&lt;br /&gt;
 | Music = No&lt;br /&gt;
 | Text = No&lt;br /&gt;
 | Story = No&lt;br /&gt;
 | Interface = No&lt;br /&gt;
}}&lt;br /&gt;
{{NoModdingInfo}}&lt;br /&gt;
== File formats ==&lt;br /&gt;
&lt;br /&gt;
This section lists the file formats used in the game.&lt;br /&gt;
&lt;br /&gt;
=== Resource file format ===&lt;br /&gt;
See [[TIM Resource Format]]. Resource sub-files are stored in files named &amp;lt;tt&amp;gt;RESOURCE.00?&amp;lt;/tt&amp;gt;. The Incredible Machine has four such files: &amp;lt;tt&amp;gt;RESOURCE.001&amp;lt;/tt&amp;gt;-&amp;lt;tt&amp;gt;.004&amp;lt;/tt&amp;gt;. (However, the demo versions of both The Incredible Machine and The Even More Incredible Machine has only one. {{TODO|Add information for The Even More Incredible Machine.}}) The &amp;lt;tt&amp;gt;RESOURCE.MAP&amp;lt;/tt&amp;gt; file contains the offsets for the sub-files.&lt;br /&gt;
&lt;br /&gt;
=== Files inside the RESOURCE.00? archive files ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! File name or extension !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;*.BMP&amp;lt;/tt&amp;gt; || 16-color images. See [[The Incredible Machine Image Format]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;MEMOFNT8.FNT&amp;lt;/tt&amp;gt; || 1BPP font, [[Dynamix Font Format v4-v5|Dynamix Font Format v4]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; || Title screen and credits animation. This is a variant of the [[The Incredible Machine Level Format|level format]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SX.OVL&amp;lt;/tt&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;tt&amp;gt;VM.OVL&amp;lt;/tt&amp;gt; || {{TODO|TODO: Add information}} &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;*.PAL&amp;lt;/tt&amp;gt; || VGA palettes. Similar to the palette format of [[RES Format (Stellar 7)#PAL: Palette|Stellar 7]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;*.SCR&amp;lt;/tt&amp;gt; || Full-screen image (640x480x16 color). See [[RES Format (Stellar 7)#SCR: Fullscreen image|RES Format (Stellar 7)]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;TIM.SX&amp;lt;/tt&amp;gt; || Sound and music. {{TODO|TODO: Add information}} &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;L*.TIM&amp;lt;/tt&amp;gt; || [[The Incredible Machine Level Format|Level/puzzle files]] &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;PASSWORD.TXT&amp;lt;/tt&amp;gt; || Plain text file. Contains passwords for each level.&lt;br /&gt;
|- &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[RES Format (Stellar 7)]] - Contains the documentation for several identical or related file formats.&lt;br /&gt;
&lt;br /&gt;
[[Category:Sierra/Dynamix]]&lt;br /&gt;
[[Category:Puzzle]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10584</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10584"/>
		<updated>2022-07-21T15:11:25Z</updated>

		<summary type="html">&lt;p&gt;Knt47: credits, other small changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 00 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;EF AC 12 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;). An empty string in .GKC files with magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
Hints are supported only in TIM 2 and 3 puzzles. The first two bytes of the hint data contain the number of the hints in 16-bit little endian format. This is followed by 8 hint entries, some of them may be unused. A size of an unused entry is 7 bytes. One entry consists of three 16-bit integers and a null-terminated string containing the hint text. The three integer members are (all have a 16-bit little endian format):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;position_x&#039;&#039;&#039;: The X position of the hand icon for the hint.&lt;br /&gt;
* &#039;&#039;&#039;position_y&#039;&#039;&#039;: The Y position.&lt;br /&gt;
* &#039;&#039;&#039;hint_icon_flip&#039;&#039;&#039;: The hand icon of a hint can be flipped and can have four different orientations. Possible values are 0-3.&lt;br /&gt;
&lt;br /&gt;
In TIM 2, there are 3 (?) puzzles with magic number &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;. Neither of these files contain hints. However, the size of the empty hints section is 42 bytes in them instead of the expected 58.&lt;br /&gt;
&lt;br /&gt;
== Puzzle information data structure ==&lt;br /&gt;
&lt;br /&gt;
=== In TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
In TIM and TEMIM, there are two different puzzle header information data structures, one is used by the puzzles, and the another is found in saved &amp;quot;freeform&amp;quot; machines and the GKC files.&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM / TEMIM puzzles:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] bonus_1;&lt;br /&gt;
  UINT16LE bonus_2;&lt;br /&gt;
  [[INT16LE]] pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  INT16LE unknown_8;&lt;br /&gt;
  INT16LE unknown_10;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
The information structure format in saved &amp;quot;freeform&amp;quot; machines and GKC files:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bonus_1&#039;&#039;&#039;: The value of &amp;quot;Bonus 1&amp;quot; immediately after the puzzle is loaded (its value is constantly decreasing while the player is solving the puzzle).&lt;br /&gt;
* &#039;&#039;&#039;bonus_2&#039;&#039;&#039;: The value of &amp;quot;Bonus 2&amp;quot; for the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;unknown_8&#039;&#039;&#039;, &#039;&#039;unknown_10&#039;&#039;: The value of these two members is always -8. Perhaps the top left corner of the screen in the coordinate system used for puzzle parts, which is also (-8, -8).&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1001-1016 for TIM and 1001-1021 for TEMIM.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move (e.g. walls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that move (e.g. balls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_in_partsbin1&#039;&#039;&#039;: The number of parts that are placed into the parts bin. (The player needs to position them in order to solve the puzzle.)&lt;br /&gt;
&lt;br /&gt;
=== In TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM 2 and 3:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE unknown_4;&lt;br /&gt;
  UINT16LE unknown_6;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE unknown_14;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1000-1023.&lt;br /&gt;
* &#039;&#039;&#039;unknown_4&#039;&#039;&#039;, &#039;&#039;&#039;unknown_6&#039;&#039;&#039;: Meaning is unknown, always 0.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move, regardless of whether they are placed initially into the parts bin or not.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that can move.&lt;br /&gt;
* &#039;&#039;&#039;unknown_14&#039;&#039;&#039;: Value is always 0. Likely this member corresponds to num_parts_in_partsbin in TIM/TEMIM puzzle header. However, parts found in the parts bin are not a separate section in TIM 2 / 3, &lt;br /&gt;
&lt;br /&gt;
== Puzzle part data ==&lt;br /&gt;
&lt;br /&gt;
As already discussed in the With the exception of TIM demo version (see below), the size of a part entry for the majority of puzzle parts is 48 bytes. However, there are exceptions, which are discussed in separate sub-sections. The format of the &amp;quot;default&amp;quot; part entry:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  [[BYTE]] belt_connect_pos_x;&lt;br /&gt;
  BYTE belt_connect_pos_y;&lt;br /&gt;
  UINT16LE belt_line_distance;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE rope_1_connect_pos_x;&lt;br /&gt;
  BYTE rope_1_connect_pos_y;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  BYTE rope_2_connect_pos_x;&lt;br /&gt;
  BYTE rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_type_num&#039;&#039;&#039;: A number associated with the type of the part (e.g. 0 - bowling ball). Required for identifying parts with an entry size different from the default. See [[The Incredible Machine Level Format/Part Numbers]]&lt;br /&gt;
* &#039;&#039;&#039;flags_1&#039;&#039;&#039;: A combination of flag bits.&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039; uses the following flag bits:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: Unknown meaning, used for a few &amp;quot;moving&amp;quot; parts (bucket, candle)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Set if the part is a wall.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x800&amp;lt;/code&amp;gt;: Part is placed initially into the parts bin (see num_parts_in_partsbin in part information data structure)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x4000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position (see &#039;&#039;num_parts_fixed&#039;&#039;)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: Set when 0x800 is not set ({{TODO|further testing needed}})&lt;br /&gt;
** In &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;, the bits have a known meaning:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Meaning unclear, used for &amp;quot;moving&amp;quot; parts only, but not always set, even for a single type of part.***&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, affected by gravity.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;, 0x4000: Used in combination for parts that do not move and are not affected by gravity.&lt;br /&gt;
* &#039;&#039;&#039;flags_2&#039;&#039;&#039;: Another word containing flag bits. The meaning of most flags is the same in all game versions.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: A belt can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: A belt is connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: A rope can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: A second rope can be connected to the part (teeter-totter)&lt;br /&gt;
** &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;: The part sprite is drawn horizontally flipped.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: The part sprite is drawn vertically flipped. Note on flip flags: Flipping a part in the game does not necessarily mean that one of the flip flags will be changed. For several parts, especially in TIM 2 / 3, flipping will affect the value of the &#039;&#039;appearance&#039;&#039; member.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Probably unused&lt;br /&gt;
** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Part can be stretched in at least one direction: inclines, conveyor belt, walls.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: Parts that can be stretched both horizontally and vertically, the walls.&lt;br /&gt;
* &#039;&#039;&#039;flags_3&#039;&#039;&#039;: Some flags are only present in TIM 2 / 3. This member of the part data structure is missing in the demo version of TIM.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: The part can be plugged into an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: The part is an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: The part can burn (e.g. candle) or has a fuse that can be lit (e.g. dynamite, cannon). Usually in combination with flag 0x8. &lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: Meaning of this flag is unclear. Used for several part types, but changing it has no apparent consequence (?) &lt;br /&gt;
** Flags present only in &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Part is &amp;quot;locked&amp;quot;, i.e not placed into the part bin.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Sizable scenery part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: {{TODO|unknown meaning}}&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: A &amp;quot;program&amp;quot; icon is shown for the part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: Scenery part&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Wall part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: A &amp;quot;Puzzle solution&amp;quot; icon is shown for the part (?)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: An identifier for the sprite that is shown for a part before the machine is started. (Once the machine is started, the state of the part can change and so can the sprite shown.) The meaning is different between TIM and TIM 2. In TIM, the sprite of some parts consists of only one image, in this case, this is often the number of the sub-image in the image resource file. ({{TODO|For other parts, this is probably an internal identifier for the sprite (?)}}). In TIM 2 and 3, the meaning of the appearance is an index in the A section of the [[The Incredible Machine 2-3 ANM File Format|.ANM file]] for the part, or if this is absent, an index in the B section. &amp;quot;Programming&amp;quot; a part in TIM 2 and 3 often results in the change of this field.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;: The width and height of the selectable area of the part ({{TODO|more reverse engineering work needed}})&lt;br /&gt;
* &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: At least in TIM 2, witdh_2 is used for calculating the position of part sprite when the part is flipped because of the horizontal flip bit is set in flags_2.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the part, usually the top left corner of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: In TIM 2 and 3, a programmed behavior of the part. (However, for many parts, &amp;quot;programming&amp;quot; modifies the &#039;&#039;appearance&#039;&#039; member.) For example the number of shots of the phazer gun or character shown by the message computer.  Meaning is different for rope parts, see below. Unused in TIM and TEMIM (except for ropes).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Probably unused, usually 0. Note that belt parts have a value of 1 in this position.&lt;br /&gt;
* &#039;&#039;&#039;belt_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;belt_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Always positive or 0, because &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039; are the coordinates of the top left corner where the sprite starts. Note that the formulas required for calculating the exact position of the belt are slightly different between TIM and TIM 2. Parts for which connection of a belt is allowed have a distinct circular area in their sprite, corresponding to the location where the belt is connected. In TIM / TEMIM, &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; is approximately the top left corner of its bounding rectangle, while in TIM 2 /3 it is close to the center of the circle.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_line_distance&#039;&#039;&#039;: The belts in the game appear as two, usually not perfectly parallel black (TIM / TEMIM) or gray (TIM 2 / 3) lines. This parameter determines the distance between the two segments, More precisely, it is either approximately the diameter of the circular area mentioned at &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; (TIM / TEMIM) or its radius (TIM 2 / 3).&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Similarly to belt_connect_pos_x/y, always positive or 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_2_connect_pos_y&#039;&#039;&#039;: The same as &#039;&#039;rope_1_connect_pos_x&#039;&#039;, &#039;&#039;rope_1_connect_pos_y&#039;&#039;, bit for another connected rope part.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;: The index of one or two parts in the puzzle that are connected to this part with a rope. If the rope runs through pulleys, this is the part index of the first pulley. If no rope is connected or this is not possible for the part, the value of both structure members are -1. (Of course, if one rope is connected, the value of one structure member (usually connected_rope_1) is the index of the rope part and the other is -1) )In TIM 2 and 3, the &amp;quot;remote bomb&amp;quot; part actually corresponds to two entries in the puzzle file. The connected_rope_2 field contains the index of the another &amp;quot;element&amp;quot; of the bomb, in both entries.&lt;br /&gt;
* &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: These structure members are only meaningful for electric outlet parts. Electric outlets always have 2 &amp;quot;sockets&amp;quot; for parts requiring electricity. It contains the index/indices of the part/parts plugged into the electric outlet, or -1 if the &amp;quot;socket&amp;quot; is free. If the part does not support this, both values are -1.&lt;br /&gt;
&lt;br /&gt;
=== Belts ===&lt;br /&gt;
&lt;br /&gt;
Belt parts (part 8) (except in the demo version of TIM, see below) use a 52-byte entry, with the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 8 for belts */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  INT16LE belt_connected_part_1;&lt;br /&gt;
  INT16LE belt_connected_part_2;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  UINT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x40&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, belts have no true sprite (represented by two lines).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for belts, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039; In TIM/TEMIM, either 0 or -1. In TIM 2, -1 or -100 (0xff9c). Meaning of these numbers is unclear, and the usage of the two different values do not correlate with the flags.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Always 1, perhaps indicates that the part is a belt.&lt;br /&gt;
* &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;belt_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this belt. In TIM and TEMIM, both are -1 if the belt is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;, &#039;&#039;&#039;unknown_40&#039;&#039;&#039;, &#039;&#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Ropes ===&lt;br /&gt;
&lt;br /&gt;
Rope parts (part 10) (except in the demo version of TIM, see below) use a 54-byte entry. TIM 2 and 3 also have a &amp;quot;steel cable&amp;quot; part (part 76) which also behaves as a rope and the size of the part entry as also identical. The rope part entry has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 10 for rope, 76 for steel cable */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE rope_segment_length;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  INT16LE rope_connected_part_1;&lt;br /&gt;
  INT16LE rope_connected_part_2;&lt;br /&gt;
  BYTE part_1_connect_field_usage;&lt;br /&gt;
  BYTE part_2_connect_field_usage;&lt;br /&gt;
  UINT16LE unknown_44;&lt;br /&gt;
  UINT16LE unknown_46;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039;: Same flags used as in the belt part structure.&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, ropes have no true sprite (represented by one or more line segments).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for ropes, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: Similarly to belts, possible values are 0 and -1 in TIM / TEMIM; and -1 and -100 in TIM 2 / 3.&lt;br /&gt;
* &#039;&#039;&#039;rope_segment_length&#039;&#039;&#039;: The length of the rope (Euclidean distance between the two ends) if the rope does not run through pulleys. Otherwise, the length of the rope segment between the part at one end (rope_connected_part_1 (?)) and the first pulley ({{TODO|additional testing needed}}).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for pulleys.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;rope_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this rope (never the pulleys). In TIM and TEMIM, both are -1 if the rope is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;part_1_connect_field_usage&#039;&#039;&#039;, &#039;&#039;&#039;part_2_connect_field_usage&#039;&#039;&#039;: Whether &#039;&#039;connected_1&#039;&#039; or &#039;&#039;connected_2&#039;&#039; is used in the two connected parts for this rope. 0 if connected_1, 1 if connected_2. ({{TODO|additional testing needed}})&lt;br /&gt;
* &#039;&#039;&#039;unknown_44&#039;&#039;&#039;, &#039;&#039;&#039;unknown_46&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Pulleys ===&lt;br /&gt;
&lt;br /&gt;
The format of the 56-byte puzzle part entry for the pulley (part 7):&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 7 for pulley */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_y;&lt;br /&gt;
  INT16LE unknown_36;&lt;br /&gt;
  INT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE pulley_connected_1;&lt;br /&gt;
  INT16LE pulley_connected_2;&lt;br /&gt;
  INT16LE unknown_50;&lt;br /&gt;
  INT16LE unknown_52;&lt;br /&gt;
  INT16LE rope_index;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x8&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;0x0&amp;lt;/code&amp;gt; {{TODO|in some cases}})&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x48&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Pulleys can have four different sprites depending on the orientation. Possible values are 0-3.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: The size of the pulley sprite. In TIM 2 / 3, also depends on the orientation.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the pulley, top left coordinates of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;, &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for ropes.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where one rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Depends on the orientation of the pulley, like &#039;&#039;appearance&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;unknown_40&#039;&#039;, &#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_2_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where the other rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;pulley_connected_1&#039;&#039;&#039;, &#039;&#039;&#039;pulley_connected_2&#039;&#039;&#039;: Either the index of part at one of the two ends of the rope, or the index of next or previous pulley the rope is running through.&lt;br /&gt;
* &#039;&#039;&#039;unknown_50&#039;&#039;&#039;, &#039;&#039;&#039;unknown_52&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;rope_index&#039;&#039;&#039;: In TIM 2 / 3, the index of the rope part. Not used (-1) in TIM and TEMIM.&lt;br /&gt;
&lt;br /&gt;
=== Programmable ball (TIM 2 / 3) ===&lt;br /&gt;
&lt;br /&gt;
The programmable ball part is present in TIM 2 and 3, and its part type number is 87. The size of the entry is 60 bytes in total. The first 48 bytes is the same as the default part data structure, which is followed by another, 12-byte structure specific to this part. The format of the programmable ball data is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE density;&lt;br /&gt;
  UINT16LE elasticity;&lt;br /&gt;
  UINT16LE friction;&lt;br /&gt;
  INT16LE gravity_buoyancy;&lt;br /&gt;
  UINT16LE mass;&lt;br /&gt;
  UINT16LE appearance_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;density&#039;&#039;&#039;: The density of the ball, affects the buoyant force acting on the ball.&lt;br /&gt;
* &#039;&#039;&#039;elasticity&#039;&#039;&#039;: The elasticity of the ball.&lt;br /&gt;
* &#039;&#039;&#039;friction&#039;&#039;&#039;: The friction.&lt;br /&gt;
* &#039;&#039;&#039;gravity_buoyancy&#039;&#039;&#039;: A calculated parameter, using the density and the mass of the ball, as well as the gravity and the pressure set for the puzzle. If its value is negative, the ball will rise due to the buoyant force rather than fall.&lt;br /&gt;
* &#039;&#039;&#039;mass&#039;&#039;&#039;: The mass of the ball.&lt;br /&gt;
* &#039;&#039;&#039;appearance_2&#039;&#039;&#039;: Has the same value as the &#039;&#039;appearance&#039;&#039; field. The ball can have 7 different colors/patterns.&lt;br /&gt;
&lt;br /&gt;
The game has a dialog for setting the four physical properties (mass, elasticity, density, friction, in this order). However, the number stored in the data structure is not the same as the numbers shown on the program dialog. For example, if following settings are used for the ball: &amp;lt;code&amp;gt;mass = 8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 3&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;density = 7&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 3&amp;lt;/code&amp;gt;; and the default values are used for gravity/pressure, the puzzle file will contain the following values: &amp;lt;code&amp;gt;density = 3000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 128&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 16&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;gravity_buoyancy = 269&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mass = 201&amp;lt;/code&amp;gt;. (Note: There is an inconsistency in the game here, the programmable ball part uses &amp;lt;code&amp;gt;density = 2832&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mass = 200&amp;lt;/code&amp;gt; by default, which does not correspond exactly to any value that can be set in the dialog.)&lt;br /&gt;
&lt;br /&gt;
=== TIM demo version ===&lt;br /&gt;
&lt;br /&gt;
In the demo version of the (original) TIM (available at several DOS shareware game websites), the &#039;&#039;flags_3&#039;&#039;, &#039;&#039;outlet_plugged_1&#039;&#039; and &#039;&#039;outlet_plugged_2&#039;&#039; fields are missing.&lt;br /&gt;
Instead, the 42-byte part data (46 for belts, 48 for ropes, 50 for pulleys) is followed by an another, variable length data structure of unknown significance consisting of 16-bit little endian integers. It is always at least 2 bytes long, and the first two bytes contain the number of additional 16-bit words after this size word. The reverse engineering of this structure is complicated by the fact that it is only present in a demo version containing only 8 puzzles.&lt;br /&gt;
&lt;br /&gt;
== Puzzle solution information ==&lt;br /&gt;
&lt;br /&gt;
Puzzle solution information is only present in TIM 2 and TIM 3 puzzles. Its size is always 132 bytes and can contain 8 different conditions that must be satisfied so that the game will recognize the puzzle as solved. The first two bytes contains the number of such conditions actually set, in a 16-bit little endian format. This is followed by 8 entries, 16 bytes each, containing the required information for solution checking by the game. The format of each entry is:&lt;br /&gt;
&lt;br /&gt;
  INT16LE part_index;&lt;br /&gt;
  UINT16LE part_state_1;&lt;br /&gt;
  UINT16LE part_state_2;&lt;br /&gt;
  UINT16LE part_count;&lt;br /&gt;
  INT16LE position_rect_x;&lt;br /&gt;
  INT16LE position_rect_y;&lt;br /&gt;
  INT16LE position_rect_width;&lt;br /&gt;
  INT16LE position_rect_height;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_index&#039;&#039;&#039;: The index of the part in the puzzle file involved in the solution. -1 (0xFF 0xFF) for unused entries.&lt;br /&gt;
* &#039;&#039;&#039;part_state_1&#039;&#039;&#039;: An ID for a &amp;quot;physical state&amp;quot; of a part (for example a balloon was popped or a candle was lit). In many puzzles, one specific part must be in a specified &amp;quot;physical state&amp;quot; in order to complete the level. This is the same ID for a &amp;quot;part state&amp;quot; as the &#039;&#039;first_frame_id&#039;&#039; member found in the C section of the part&#039;s ANM file.&lt;br /&gt;
* &#039;&#039;&#039;part_state_2&#039;&#039;&#039;: Another ID for a &amp;quot;physical state&amp;quot;, the exact meaning is unclear.&lt;br /&gt;
* &#039;&#039;&#039;part_count&#039;&#039;&#039;: The value of the &amp;quot;Part count&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_x&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_y&#039;&#039;&#039;: The top left corner of the &amp;quot;position rectangle&amp;quot;. If such a solution specified puzzle part must be located within this rectangle in order to solve the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_width&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_height&#039;&#039;&#039;: Width and height of the &amp;quot;position rectangle&amp;quot;, see above.&lt;br /&gt;
&lt;br /&gt;
For the last four members (&amp;quot;position rectangle&amp;quot;), there are &amp;quot;fixed&amp;quot; combinations of values with special meaning:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-1, -1, -1, -1&amp;lt;/code&amp;gt;: &amp;quot;Off screen&amp;quot;, the part must leave the area visible on the game screen.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, -2000, 1640, 2000&amp;lt;/code&amp;gt;: &amp;quot;Off top&amp;quot;, the part must leave the visible area at the top.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, 400, 1640, 3000&amp;lt;/code&amp;gt;: &amp;quot;Off bottom&amp;quot;&lt;br /&gt;
* &amp;lt;code&amp;gt;0, 0, 0, 0&amp;lt;/code&amp;gt;: No such solution programmed, either this is &amp;quot;part state&amp;quot; solution or an unused entry (&amp;lt;code&amp;gt;part_index = -1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The last 2 bytes of the section contain the value of the &amp;quot;Delay&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game, in 16-bit little endian format.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note on puzzle solution information in TIM and TEMIM&#039;&#039;&#039;: TIM / TEMIM puzzles do not contain such data. This can also be demonstrated by extracting e.g. &amp;lt;tt&amp;gt;L1.LEV&amp;lt;/tt&amp;gt; from the archive file and rename the file to change the number. After starting the game, the level with the same number as the renamed file will be replaced with level 1. When playing the modified level, the game will not be able to check whether the puzzle is solved. Depending on its number, the level can become unwinnable or winnable by just clicking on the start machine button. Sometimes the game freezes.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{TODO|Level viewer will be published soon}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Knt47|knt47]]. If you find this information helpful in a project you&#039;re working on, please give credit where credit is due. (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10583</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10583"/>
		<updated>2022-07-21T14:53:37Z</updated>

		<summary type="html">&lt;p&gt;Knt47: Part info part 3, puzzle solution&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 00 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;EF AC 12 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;). An empty string in .GKC files with magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
Hints are supported only in TIM 2 and 3 puzzles. The first two bytes of the hint data contain the number of the hints in 16-bit little endian format. This is followed by 8 hint entries, some of them may be unused. A size of an unused entry is 7 bytes. One entry consists of three 16-bit integers and a null-terminated string containing the hint text. The three integer members are (all have a 16-bit little endian format):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;position_x&#039;&#039;&#039;: The X position of the hand icon for the hint.&lt;br /&gt;
* &#039;&#039;&#039;position_y&#039;&#039;&#039;: The Y position.&lt;br /&gt;
* &#039;&#039;&#039;hint_icon_flip&#039;&#039;&#039;: The hand icon of a hint can be flipped and can have four different orientations. Possible values are 0-3.&lt;br /&gt;
&lt;br /&gt;
In TIM 2, there are 3 (?) puzzles with magic number &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;. Neither of these files contain hints. However, the size of the empty hints section is 42 bytes in them instead of the expected 58.&lt;br /&gt;
&lt;br /&gt;
== Puzzle information data structure ==&lt;br /&gt;
&lt;br /&gt;
=== In TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
In TIM and TEMIM, there are two different puzzle header information data structures, one is used by the puzzles, and the another is found in saved &amp;quot;freeform&amp;quot; machines and the GKC files.&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM / TEMIM puzzles:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] bonus_1;&lt;br /&gt;
  UINT16LE bonus_2;&lt;br /&gt;
  [[INT16LE]] pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  INT16LE unknown_8;&lt;br /&gt;
  INT16LE unknown_10;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
The information structure format in saved &amp;quot;freeform&amp;quot; machines and GKC files:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bonus_1&#039;&#039;&#039;: The value of &amp;quot;Bonus 1&amp;quot; immediately after the puzzle is loaded (its value is constantly decreasing while the player is solving the puzzle).&lt;br /&gt;
* &#039;&#039;&#039;bonus_2&#039;&#039;&#039;: The value of &amp;quot;Bonus 2&amp;quot; for the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;unknown_8&#039;&#039;&#039;, &#039;&#039;unknown_10&#039;&#039;: The value of these two members is always -8. Perhaps the top left corner of the screen in the coordinate system used for puzzle parts, which is also (-8, -8).&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1001-1016 for TIM and 1001-1021 for TEMIM.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move (e.g. walls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that move (e.g. balls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_in_partsbin1&#039;&#039;&#039;: The number of parts that are placed into the parts bin. (The player needs to position them in order to solve the puzzle.)&lt;br /&gt;
&lt;br /&gt;
=== In TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM 2 and 3:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE unknown_4;&lt;br /&gt;
  UINT16LE unknown_6;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE unknown_14;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1000-1023.&lt;br /&gt;
* &#039;&#039;&#039;unknown_4&#039;&#039;&#039;, &#039;&#039;&#039;unknown_6&#039;&#039;&#039;: Meaning is unknown, always 0.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move, regardless of whether they are placed initially into the parts bin or not.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that can move.&lt;br /&gt;
* &#039;&#039;&#039;unknown_14&#039;&#039;&#039;: Value is always 0. Likely this member corresponds to num_parts_in_partsbin in TIM/TEMIM puzzle header. However, parts found in the parts bin are not a separate section in TIM 2 / 3, &lt;br /&gt;
&lt;br /&gt;
== Puzzle part data ==&lt;br /&gt;
&lt;br /&gt;
As already discussed in the With the exception of TIM demo version (see below), the size of a part entry for the majority of puzzle parts is 48 bytes. However, there are exceptions, which are discussed in separate sub-sections. The format of the &amp;quot;default&amp;quot; part entry:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  [[BYTE]] belt_connect_pos_x;&lt;br /&gt;
  BYTE belt_connect_pos_y;&lt;br /&gt;
  UINT16LE belt_line_distance;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE rope_1_connect_pos_x;&lt;br /&gt;
  BYTE rope_1_connect_pos_y;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  BYTE rope_2_connect_pos_x;&lt;br /&gt;
  BYTE rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_type_num&#039;&#039;&#039;: A number associated with the type of the part (e.g. 0 - bowling ball). Required for identifying parts with an entry size different from the default. &lt;br /&gt;
* &#039;&#039;&#039;flags_1&#039;&#039;&#039;: A combination of flag bits.&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039; uses the following flag bits:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: Unknown meaning, used for a few &amp;quot;moving&amp;quot; parts (bucket, candle)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Set if the part is a wall.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x800&amp;lt;/code&amp;gt;: Part is placed initially into the parts bin (see num_parts_in_partsbin in part information data structure)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x4000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position (see &#039;&#039;num_parts_fixed&#039;&#039;)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: Set when 0x800 is not set ({{TODO|further testing needed}})&lt;br /&gt;
** In &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;, the bits have a known meaning:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Meaning unclear, used for &amp;quot;moving&amp;quot; parts only, but not always set, even for a single type of part.***&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, affected by gravity.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;, 0x4000: Used in combination for parts that do not move and are not affected by gravity.&lt;br /&gt;
* &#039;&#039;&#039;flags_2&#039;&#039;&#039;: Another word containing flag bits. The meaning of most flags is the same in all game versions.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: A belt can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: A belt is connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: A rope can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: A second rope can be connected to the part (teeter-totter)&lt;br /&gt;
** &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;: The part sprite is drawn horizontally flipped.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: The part sprite is drawn vertically flipped. Note on flip flags: Flipping a part in the game does not necessarily mean that one of the flip flags will be changed. For several parts, especially in TIM 2 / 3, flipping will affect the value of the &#039;&#039;appearance&#039;&#039; member.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Probably unused&lt;br /&gt;
** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Part can be stretched in at least one direction: inclines, conveyor belt, walls.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: Parts that can be stretched both horizontally and vertically, the walls.&lt;br /&gt;
* &#039;&#039;&#039;flags_3&#039;&#039;&#039;: Some flags are only present in TIM 2 / 3. This member of the part data structure is missing in the demo version of TIM.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: The part can be plugged into an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: The part is an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: The part can burn (e.g. candle) or has a fuse that can be lit (e.g. dynamite, cannon). Usually in combination with flag 0x8. &lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: Meaning of this flag is unclear. Used for several part types, but changing it has no apparent consequence (?) &lt;br /&gt;
** Flags present only in &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Part is &amp;quot;locked&amp;quot;, i.e not placed into the part bin.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Sizable scenery part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: {{TODO|unknown meaning}}&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: A &amp;quot;program&amp;quot; icon is shown for the part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: Scenery part&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Wall part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: A &amp;quot;Puzzle solution&amp;quot; icon is shown for the part (?)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: An identifier for the sprite that is shown for a part before the machine is started. (Once the machine is started, the state of the part can change and so can the sprite shown.) The meaning is different between TIM and TIM 2. In TIM, the sprite of some parts consists of only one image, in this case, this is often the number of the sub-image in the image resource file. ({{TODO|For other parts, this is probably an internal identifier for the sprite (?)}}). In TIM 2 and 3, the meaning of the appearance is an index in the A section of the animation file for the part, or if this is absent, an index in the B section. &amp;quot;Programming&amp;quot; a part in TIM 2 and 3 often results in the change of this field.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;: The width and height of the selectable area of the part ({{TODO|more reverse engineering work needed}})&lt;br /&gt;
* &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: At least in TIM 2, witdh_2 is used for calculating the position of part sprite when the part is flipped because of the horizontal flip bit is set in flags_2.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the part, usually the top left corner of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: In TIM 2 and 3, a programmed behavior of the part. (However, for many parts, &amp;quot;programming&amp;quot; modifies the &#039;&#039;appearance&#039;&#039; member.) For example the number of shots of the phazer gun or character shown by the message computer.  Meaning is different for rope parts, see below. Unused in TIM and TEMIM (except for ropes).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Probably unused, usually 0. Note that belt parts have a value of 1 in this position.&lt;br /&gt;
* &#039;&#039;&#039;belt_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;belt_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Always positive or 0, because &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039; are the coordinates of the top left corner where the sprite starts. Note that the formulas required for calculating the exact position of the belt are slightly different between TIM and TIM 2. Parts for which connection of a belt is allowed have a distinct circular area in their sprite, corresponding to the location where the belt is connected. In TIM / TEMIM, &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; is approximately the top left corner of its bounding rectangle, while in TIM 2 /3 it is close to the center of the circle.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_line_distance&#039;&#039;&#039;: The belts in the game appear as two, usually not perfectly parallel black (TIM / TEMIM) or gray (TIM 2 / 3) lines. This parameter determines the distance between the two segments, More precisely, it is either approximately the diameter of the circular area mentioned at &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; (TIM / TEMIM) or its radius (TIM 2 / 3).&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Similarly to belt_connect_pos_x/y, always positive or 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_2_connect_pos_y&#039;&#039;&#039;: The same as &#039;&#039;rope_1_connect_pos_x&#039;&#039;, &#039;&#039;rope_1_connect_pos_y&#039;&#039;, bit for another connected rope part.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;: The index of one or two parts in the puzzle that are connected to this part with a rope. If the rope runs through pulleys, this is the part index of the first pulley. If no rope is connected or this is not possible for the part, the value of both structure members are -1. (Of course, if one rope is connected, the value of one structure member (usually connected_rope_1) is the index of the rope part and the other is -1) )In TIM 2 and 3, the &amp;quot;remote bomb&amp;quot; part actually corresponds to two entries in the puzzle file. The connected_rope_2 field contains the index of the another &amp;quot;element&amp;quot; of the bomb, in both entries.&lt;br /&gt;
* &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: These structure members are only meaningful for electric outlet parts. Electric outlets always have 2 &amp;quot;sockets&amp;quot; for parts requiring electricity. It contains the index/indices of the part/parts plugged into the electric outlet, or -1 if the &amp;quot;socket&amp;quot; is free. If the part does not support this, both values are -1.&lt;br /&gt;
&lt;br /&gt;
=== Belts ===&lt;br /&gt;
&lt;br /&gt;
Belt parts (part 8) (except in the demo version of TIM, see below) use a 52-byte entry, with the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 8 for belts */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  INT16LE belt_connected_part_1;&lt;br /&gt;
  INT16LE belt_connected_part_2;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  UINT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x40&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, belts have no true sprite (represented by two lines).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for belts, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039; In TIM/TEMIM, either 0 or -1. In TIM 2, -1 or -100 (0xff9c). Meaning of these numbers is unclear, and the usage of the two different values do not correlate with the flags.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Always 1, perhaps indicates that the part is a belt.&lt;br /&gt;
* &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;belt_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this belt. In TIM and TEMIM, both are -1 if the belt is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;, &#039;&#039;&#039;unknown_40&#039;&#039;&#039;, &#039;&#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Ropes ===&lt;br /&gt;
&lt;br /&gt;
Rope parts (part 10) (except in the demo version of TIM, see below) use a 54-byte entry. TIM 2 and 3 also have a &amp;quot;steel cable&amp;quot; part (part 76) which also behaves as a rope and the size of the part entry as also identical. The rope part entry has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 10 for rope, 76 for steel cable */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE rope_segment_length;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  INT16LE rope_connected_part_1;&lt;br /&gt;
  INT16LE rope_connected_part_2;&lt;br /&gt;
  BYTE part_1_connect_field_usage;&lt;br /&gt;
  BYTE part_2_connect_field_usage;&lt;br /&gt;
  UINT16LE unknown_44;&lt;br /&gt;
  UINT16LE unknown_46;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039;: Same flags used as in the belt part structure.&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, ropes have no true sprite (represented by one or more line segments).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for ropes, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: Similarly to belts, possible values are 0 and -1 in TIM / TEMIM; and -1 and -100 in TIM 2 / 3.&lt;br /&gt;
* &#039;&#039;&#039;rope_segment_length&#039;&#039;&#039;: The length of the rope (Euclidean distance between the two ends) if the rope does not run through pulleys. Otherwise, the length of the rope segment between the part at one end (rope_connected_part_1 (?)) and the first pulley ({{TODO|additional testing needed}}).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for pulleys.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;rope_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this rope (never the pulleys). In TIM and TEMIM, both are -1 if the rope is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;part_1_connect_field_usage&#039;&#039;&#039;, &#039;&#039;&#039;part_2_connect_field_usage&#039;&#039;&#039;: Whether &#039;&#039;connected_1&#039;&#039; or &#039;&#039;connected_2&#039;&#039; is used in the two connected parts for this rope. 0 if connected_1, 1 if connected_2. ({{TODO|additional testing needed}})&lt;br /&gt;
* &#039;&#039;&#039;unknown_44&#039;&#039;&#039;, &#039;&#039;&#039;unknown_46&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Pulleys ===&lt;br /&gt;
&lt;br /&gt;
The format of the 56-byte puzzle part entry for the pulley (part 7):&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 7 for pulley */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_y;&lt;br /&gt;
  INT16LE unknown_36;&lt;br /&gt;
  INT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE pulley_connected_1;&lt;br /&gt;
  INT16LE pulley_connected_2;&lt;br /&gt;
  INT16LE unknown_50;&lt;br /&gt;
  INT16LE unknown_52;&lt;br /&gt;
  INT16LE rope_index;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x8&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;0x0&amp;lt;/code&amp;gt; {{TODO|in some cases}})&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x48&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Pulleys can have four different sprites depending on the orientation. Possible values are 0-3.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: The size of the pulley sprite. In TIM 2 / 3, also depends on the orientation.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the pulley, top left coordinates of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;, &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for ropes.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where one rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Depends on the orientation of the pulley, like &#039;&#039;appearance&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;unknown_40&#039;&#039;, &#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_2_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where the other rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;pulley_connected_1&#039;&#039;&#039;, &#039;&#039;&#039;pulley_connected_2&#039;&#039;&#039;: Either the index of part at one of the two ends of the rope, or the index of next or previous pulley the rope is running through.&lt;br /&gt;
* &#039;&#039;&#039;unknown_50&#039;&#039;&#039;, &#039;&#039;&#039;unknown_52&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;rope_index&#039;&#039;&#039;: In TIM 2 / 3, the index of the rope part. Not used (-1) in TIM and TEMIM.&lt;br /&gt;
&lt;br /&gt;
=== Programmable ball (TIM 2 / 3) ===&lt;br /&gt;
&lt;br /&gt;
The programmable ball part is present in TIM 2 and 3, and its part type number is 87. The size of the entry is 60 bytes in total. The first 48 bytes is the same as the default part data structure, which is followed by another, 12-byte structure specific to this part. The format of the programmable ball data is:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE density;&lt;br /&gt;
  UINT16LE elasticity;&lt;br /&gt;
  UINT16LE friction;&lt;br /&gt;
  INT16LE gravity_buoyancy;&lt;br /&gt;
  UINT16LE mass;&lt;br /&gt;
  UINT16LE appearance_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;density&#039;&#039;&#039;: The density of the ball, affects the buoyant force acting on the ball.&lt;br /&gt;
* &#039;&#039;&#039;elasticity&#039;&#039;&#039;: The elasticity of the ball.&lt;br /&gt;
* &#039;&#039;&#039;friction&#039;&#039;&#039;: The friction.&lt;br /&gt;
* &#039;&#039;&#039;gravity_buoyancy&#039;&#039;&#039;: A calculated parameter, using the density and the mass of the ball, as well as the gravity and the pressure set for the puzzle. If its value is negative, the ball will rise due to the buoyant force rather than fall.&lt;br /&gt;
* &#039;&#039;&#039;mass&#039;&#039;&#039;: The mass of the ball.&lt;br /&gt;
* &#039;&#039;&#039;appearance_2&#039;&#039;&#039;: Has the same value as the &#039;&#039;appearance&#039;&#039; field. The ball can have 7 different colors/patterns.&lt;br /&gt;
&lt;br /&gt;
The game has a dialog for setting the four physical properties (mass, elasticity, density, friction, in this order). However, the number stored in the data structure is not the same as the numbers shown on the program dialog. For example, if following settings are used for the ball: &amp;lt;code&amp;gt;mass = 8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 3&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;density = 7&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 3&amp;lt;/code&amp;gt;; and the default values are used for gravity/pressure, the puzzle file will contain the following values: &amp;lt;code&amp;gt;density = 3000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;elasticity = 128&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;friction = 16&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;gravity_buoyancy = 269&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mass = 201&amp;lt;/code&amp;gt;. (Note: There is an inconsistency in the game here, the programmable ball part uses &amp;lt;code&amp;gt;density = 2832&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mass = 200&amp;lt;/code&amp;gt; by default, which does not correspond exactly to any value that can be set in the dialog.)&lt;br /&gt;
&lt;br /&gt;
=== TIM demo version ===&lt;br /&gt;
&lt;br /&gt;
In the demo version of the (original) TIM (available at several DOS shareware game websites), the &#039;&#039;flags_3&#039;&#039;, &#039;&#039;outlet_plugged_1&#039;&#039; and &#039;&#039;outlet_plugged_2&#039;&#039; fields are missing.&lt;br /&gt;
Instead, the 42-byte part data (46 for belts, 48 for ropes, 50 for pulleys) is followed by an another, variable length data structure of unknown significance consisting of 16-bit little endian integers. It is always at least 2 bytes long, and the first two bytes contain the number of additional 16-bit words after this size word. The reverse engineering of this structure is complicated by the fact that it is only present in a demo version containing only 8 puzzles.&lt;br /&gt;
&lt;br /&gt;
== Puzzle solution information ==&lt;br /&gt;
&lt;br /&gt;
Puzzle solution information is only present in TIM 2 and TIM 3 puzzles. Its size is always 132 bytes and can contain 8 different conditions that must be satisfied so that the game will recognize the puzzle as solved. The first two bytes contains the number of such conditions actually set, in a 16-bit little endian format. This is followed by 8 entries, 16 bytes each, containing the required information for solution checking by the game. The format of each entry is:&lt;br /&gt;
&lt;br /&gt;
  INT16LE part_index;&lt;br /&gt;
  UINT16LE part_state_1;&lt;br /&gt;
  UINT16LE part_state_2;&lt;br /&gt;
  UINT16LE part_count;&lt;br /&gt;
  INT16LE position_rect_x;&lt;br /&gt;
  INT16LE position_rect_y;&lt;br /&gt;
  INT16LE position_rect_width;&lt;br /&gt;
  INT16LE position_rect_height;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_index&#039;&#039;&#039;: The index of the part in the puzzle file involved in the solution. -1 (0xFF 0xFF) for unused entries.&lt;br /&gt;
* &#039;&#039;&#039;part_state_1&#039;&#039;&#039;: An ID for a &amp;quot;physical state&amp;quot; of a part (for example a balloon was popped or a candle was lit). In many puzzles, one specific part must be in a specified &amp;quot;physical state&amp;quot; in order to complete the level. This is the same ID for a &amp;quot;part state&amp;quot; as the &#039;&#039;first_frame_id&#039;&#039; member found in the C section of the part&#039;s ANM file.&lt;br /&gt;
* &#039;&#039;&#039;part_state_2&#039;&#039;&#039;: Another ID for a &amp;quot;physical state&amp;quot;, the exact meaning is unclear.&lt;br /&gt;
* &#039;&#039;&#039;part_count&#039;&#039;&#039;: The value of the &amp;quot;Part count&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_x&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_y&#039;&#039;&#039;: The top left corner of the &amp;quot;position rectangle&amp;quot;. If such a solution specified puzzle part must be located within this rectangle in order to solve the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;position_rect_width&#039;&#039;&#039;, &#039;&#039;&#039;position_rect_height&#039;&#039;&#039;: Width and height of the &amp;quot;position rectangle&amp;quot;, see above.&lt;br /&gt;
&lt;br /&gt;
For the last four members (&amp;quot;position rectangle&amp;quot;), there are &amp;quot;fixed&amp;quot; combinations of values with special meaning:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-1, -1, -1, -1&amp;lt;/code&amp;gt;: &amp;quot;Off screen&amp;quot;, the part must leave the area visible on the game screen.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, -2000, 1640, 2000&amp;lt;/code&amp;gt;: &amp;quot;Off top&amp;quot;, the part must leave the visible area at the top.&lt;br /&gt;
* &amp;lt;code&amp;gt;-500, 400, 1640, 3000&amp;lt;/code&amp;gt;: &amp;quot;Off bottom&amp;quot;&lt;br /&gt;
* &amp;lt;code&amp;gt;0, 0, 0, 0&amp;lt;/code&amp;gt;: No such solution programmed, either this is &amp;quot;part state&amp;quot; solution or an unused entry (&amp;lt;code&amp;gt;part_index = -1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The last 2 bytes of the section contain the value of the &amp;quot;Delay&amp;quot; option set in the &amp;quot;program solution&amp;quot; dialog of the game, in 16-bit little endian format.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note on puzzle solution information in TIM and TEMIM&#039;&#039;&#039;: TIM / TEMIM puzzles do not contain such data. This can also be demonstrated by extracting e.g. &amp;lt;tt&amp;gt;L1.LEV&amp;lt;/tt&amp;gt; from the archive file and rename the file to change the number. After starting the game, the level with the same number as the renamed file will be replaced with level 1. When playing the modified level, the game will not be able to check whether the puzzle is solved. Depending on its number, the level can become unwinnable or winnable by just clicking on the start machine button. Sometimes the game freezes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{TODO| This is a work in progress.}}&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10582</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10582"/>
		<updated>2022-07-21T14:38:40Z</updated>

		<summary type="html">&lt;p&gt;Knt47: part data, part 2&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 00 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;EF AC 12 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;). An empty string in .GKC files with magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
Hints are supported only in TIM 2 and 3 puzzles. The first two bytes of the hint data contain the number of the hints in 16-bit little endian format. This is followed by 8 hint entries, some of them may be unused. A size of an unused entry is 7 bytes. One entry consists of three 16-bit integers and a null-terminated string containing the hint text. The three integer members are (all have a 16-bit little endian format):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;position_x&#039;&#039;&#039;: The X position of the hand icon for the hint.&lt;br /&gt;
* &#039;&#039;&#039;position_y&#039;&#039;&#039;: The Y position.&lt;br /&gt;
* &#039;&#039;&#039;hint_icon_flip&#039;&#039;&#039;: The hand icon of a hint can be flipped and can have four different orientations. Possible values are 0-3.&lt;br /&gt;
&lt;br /&gt;
In TIM 2, there are 3 (?) puzzles with magic number &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;. Neither of these files contain hints. However, the size of the empty hints section is 42 bytes in them instead of the expected 58.&lt;br /&gt;
&lt;br /&gt;
== Puzzle information data structure ==&lt;br /&gt;
&lt;br /&gt;
=== In TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
In TIM and TEMIM, there are two different puzzle header information data structures, one is used by the puzzles, and the another is found in saved &amp;quot;freeform&amp;quot; machines and the GKC files.&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM / TEMIM puzzles:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] bonus_1;&lt;br /&gt;
  UINT16LE bonus_2;&lt;br /&gt;
  [[INT16LE]] pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  INT16LE unknown_8;&lt;br /&gt;
  INT16LE unknown_10;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
The information structure format in saved &amp;quot;freeform&amp;quot; machines and GKC files:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bonus_1&#039;&#039;&#039;: The value of &amp;quot;Bonus 1&amp;quot; immediately after the puzzle is loaded (its value is constantly decreasing while the player is solving the puzzle).&lt;br /&gt;
* &#039;&#039;&#039;bonus_2&#039;&#039;&#039;: The value of &amp;quot;Bonus 2&amp;quot; for the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;unknown_8&#039;&#039;&#039;, &#039;&#039;unknown_10&#039;&#039;: The value of these two members is always -8. Perhaps the top left corner of the screen in the coordinate system used for puzzle parts, which is also (-8, -8).&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1001-1016 for TIM and 1001-1021 for TEMIM.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move (e.g. walls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that move (e.g. balls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_in_partsbin1&#039;&#039;&#039;: The number of parts that are placed into the parts bin. (The player needs to position them in order to solve the puzzle.)&lt;br /&gt;
&lt;br /&gt;
=== In TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM 2 and 3:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE unknown_4;&lt;br /&gt;
  UINT16LE unknown_6;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE unknown_14;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1000-1023.&lt;br /&gt;
* &#039;&#039;&#039;unknown_4&#039;&#039;&#039;, &#039;&#039;&#039;unknown_6&#039;&#039;&#039;: Meaning is unknown, always 0.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move, regardless of whether they are placed initially into the parts bin or not.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that can move.&lt;br /&gt;
* &#039;&#039;&#039;unknown_14&#039;&#039;&#039;: Value is always 0. Likely this member corresponds to num_parts_in_partsbin in TIM/TEMIM puzzle header. However, parts found in the parts bin are not a separate section in TIM 2 / 3, &lt;br /&gt;
&lt;br /&gt;
== Puzzle part data ==&lt;br /&gt;
&lt;br /&gt;
As already discussed in the With the exception of TIM demo version (see below), the size of a part entry for the majority of puzzle parts is 48 bytes. However, there are exceptions, which are discussed in separate sub-sections. The format of the &amp;quot;default&amp;quot; part entry:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  [[BYTE]] belt_connect_pos_x;&lt;br /&gt;
  BYTE belt_connect_pos_y;&lt;br /&gt;
  UINT16LE belt_line_distance;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE rope_1_connect_pos_x;&lt;br /&gt;
  BYTE rope_1_connect_pos_y;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  BYTE rope_2_connect_pos_x;&lt;br /&gt;
  BYTE rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_type_num&#039;&#039;&#039;: A number associated with the type of the part (e.g. 0 - bowling ball). Required for identifying parts with an entry size different from the default. &lt;br /&gt;
* &#039;&#039;&#039;flags_1&#039;&#039;&#039;: A combination of flag bits.&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039; uses the following flag bits:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: Unknown meaning, used for a few &amp;quot;moving&amp;quot; parts (bucket, candle)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Set if the part is a wall.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x800&amp;lt;/code&amp;gt;: Part is placed initially into the parts bin (see num_parts_in_partsbin in part information data structure)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x4000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position (see &#039;&#039;num_parts_fixed&#039;&#039;)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: Set when 0x800 is not set ({{TODO|further testing needed}})&lt;br /&gt;
** In &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;, the bits have a known meaning:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Meaning unclear, used for &amp;quot;moving&amp;quot; parts only, but not always set, even for a single type of part.***&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, affected by gravity.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;, 0x4000: Used in combination for parts that do not move and are not affected by gravity.&lt;br /&gt;
* &#039;&#039;&#039;flags_2&#039;&#039;&#039;: Another word containing flag bits. The meaning of most flags is the same in all game versions.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: A belt can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: A belt is connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: A rope can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: A second rope can be connected to the part (teeter-totter)&lt;br /&gt;
** &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;: The part sprite is drawn horizontally flipped.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: The part sprite is drawn vertically flipped. Note on flip flags: Flipping a part in the game does not necessarily mean that one of the flip flags will be changed. For several parts, especially in TIM 2 / 3, flipping will affect the value of the &#039;&#039;appearance&#039;&#039; member.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Probably unused&lt;br /&gt;
** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Part can be stretched in at least one direction: inclines, conveyor belt, walls.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: Parts that can be stretched both horizontally and vertically, the walls.&lt;br /&gt;
* &#039;&#039;&#039;flags_3&#039;&#039;&#039;: Some flags are only present in TIM 2 / 3. This member of the part data structure is missing in the demo version of TIM.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: The part can be plugged into an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: The part is an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: The part can burn (e.g. candle) or has a fuse that can be lit (e.g. dynamite, cannon). Usually in combination with flag 0x8. &lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: Meaning of this flag is unclear. Used for several part types, but changing it has no apparent consequence (?) &lt;br /&gt;
** Flags present only in &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Part is &amp;quot;locked&amp;quot;, i.e not placed into the part bin.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Sizable scenery part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: {{TODO|unknown meaning}}&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: A &amp;quot;program&amp;quot; icon is shown for the part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: Scenery part&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Wall part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: A &amp;quot;Puzzle solution&amp;quot; icon is shown for the part (?)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: An identifier for the sprite that is shown for a part before the machine is started. (Once the machine is started, the state of the part can change and so can the sprite shown.) The meaning is different between TIM and TIM 2. In TIM, the sprite of some parts consists of only one image, in this case, this is often the number of the sub-image in the image resource file. ({{TODO|For other parts, this is probably an internal identifier for the sprite (?)}}). In TIM 2 and 3, the meaning of the appearance is an index in the A section of the animation file for the part, or if this is absent, an index in the B section. &amp;quot;Programming&amp;quot; a part in TIM 2 and 3 often results in the change of this field.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;: The width and height of the selectable area of the part ({{TODO|more reverse engineering work needed}})&lt;br /&gt;
* &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: At least in TIM 2, witdh_2 is used for calculating the position of part sprite when the part is flipped because of the horizontal flip bit is set in flags_2.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the part, usually the top left corner of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: In TIM 2 and 3, a programmed behavior of the part. (However, for many parts, &amp;quot;programming&amp;quot; modifies the &#039;&#039;appearance&#039;&#039; member.) For example the number of shots of the phazer gun or character shown by the message computer.  Meaning is different for rope parts, see below. Unused in TIM and TEMIM (except for ropes).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Probably unused, usually 0. Note that belt parts have a value of 1 in this position.&lt;br /&gt;
* &#039;&#039;&#039;belt_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;belt_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Always positive or 0, because &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039; are the coordinates of the top left corner where the sprite starts. Note that the formulas required for calculating the exact position of the belt are slightly different between TIM and TIM 2. Parts for which connection of a belt is allowed have a distinct circular area in their sprite, corresponding to the location where the belt is connected. In TIM / TEMIM, &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; is approximately the top left corner of its bounding rectangle, while in TIM 2 /3 it is close to the center of the circle.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_line_distance&#039;&#039;&#039;: The belts in the game appear as two, usually not perfectly parallel black (TIM / TEMIM) or gray (TIM 2 / 3) lines. This parameter determines the distance between the two segments, More precisely, it is either approximately the diameter of the circular area mentioned at &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; (TIM / TEMIM) or its radius (TIM 2 / 3).&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Similarly to belt_connect_pos_x/y, always positive or 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_2_connect_pos_y&#039;&#039;&#039;: The same as &#039;&#039;rope_1_connect_pos_x&#039;&#039;, &#039;&#039;rope_1_connect_pos_y&#039;&#039;, bit for another connected rope part.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;: The index of one or two parts in the puzzle that are connected to this part with a rope. If the rope runs through pulleys, this is the part index of the first pulley. If no rope is connected or this is not possible for the part, the value of both structure members are -1. (Of course, if one rope is connected, the value of one structure member (usually connected_rope_1) is the index of the rope part and the other is -1) )In TIM 2 and 3, the &amp;quot;remote bomb&amp;quot; part actually corresponds to two entries in the puzzle file. The connected_rope_2 field contains the index of the another &amp;quot;element&amp;quot; of the bomb, in both entries.&lt;br /&gt;
* &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: These structure members are only meaningful for electric outlet parts. Electric outlets always have 2 &amp;quot;sockets&amp;quot; for parts requiring electricity. It contains the index/indices of the part/parts plugged into the electric outlet, or -1 if the &amp;quot;socket&amp;quot; is free. If the part does not support this, both values are -1.&lt;br /&gt;
&lt;br /&gt;
=== Belts ===&lt;br /&gt;
&lt;br /&gt;
Belt parts (part 8) (except in the demo version of TIM, see below) use a 52-byte entry, with the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 8 for belts */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  INT16LE belt_connected_part_1;&lt;br /&gt;
  INT16LE belt_connected_part_2;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  UINT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0&amp;lt;/code&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x40&amp;lt;/code&amp;gt; (or 0 if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, belts have no true sprite (represented by two lines).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for belts, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039; In TIM/TEMIM, either 0 or -1. In TIM 2, -1 or -100 (0xff9c). Meaning of these numbers is unclear, and the usage of the two different values do not correlate with the flags.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Always 1, perhaps indicates that the part is a belt.&lt;br /&gt;
* &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;belt_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this belt. In TIM and TEMIM, both are -1 if the belt is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;, &#039;&#039;&#039;unknown_40&#039;&#039;&#039;, &#039;&#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Ropes ===&lt;br /&gt;
&lt;br /&gt;
Rope parts (part 10) (except in the demo version of TIM, see below) use a 54-byte entry. TIM 2 and 3 also have a &amp;quot;steel cable&amp;quot; part (part 76) which also behaves as a rope and the size of the part entry as also identical. The rope part entry has the following format:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 10 for rope, 76 for steel cable */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE rope_segment_length;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  INT16LE rope_connected_part_1;&lt;br /&gt;
  INT16LE rope_connected_part_2;&lt;br /&gt;
  BYTE part_1_connect_field_usage;&lt;br /&gt;
  BYTE part_2_connect_field_usage;&lt;br /&gt;
  UINT16LE unknown_44;&lt;br /&gt;
  UINT16LE unknown_46;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039;: Same flags used as in the belt part structure.&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Always 0, ropes have no true sprite (represented by one or more line segments).&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: Not used for ropes, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: Similarly to belts, possible values are 0 and -1 in TIM / TEMIM; and -1 and -100 in TIM 2 / 3.&lt;br /&gt;
* &#039;&#039;&#039;rope_segment_length&#039;&#039;&#039;: The length of the rope (Euclidean distance between the two ends) if the rope does not run through pulleys. Otherwise, the length of the rope segment between the part at one end (rope_connected_part_1 (?)) and the first pulley ({{TODO|additional testing needed}}).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for pulleys.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_connected_part_1&#039;&#039;&#039;, &#039;&#039;&#039;rope_connected_part_2&#039;&#039;&#039;: Index of the two parts in the puzzle connected by this rope (never the pulleys). In TIM and TEMIM, both are -1 if the rope is placed into the parts bin.&lt;br /&gt;
* &#039;&#039;&#039;part_1_connect_field_usage&#039;&#039;&#039;, &#039;&#039;&#039;part_2_connect_field_usage&#039;&#039;&#039;: Whether &#039;&#039;connected_1&#039;&#039; or &#039;&#039;connected_2&#039;&#039; is used in the two connected parts for this rope. 0 if connected_1, 1 if connected_2. ({{TODO|additional testing needed}})&lt;br /&gt;
* &#039;&#039;&#039;unknown_44&#039;&#039;&#039;, &#039;&#039;&#039;unknown_46&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
&lt;br /&gt;
=== Pulleys ===&lt;br /&gt;
&lt;br /&gt;
The format of the 56-byte puzzle part entry for the pulley (part 7):&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;  /* 7 for pulley */&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  UINT16LE unknown_28;&lt;br /&gt;
  UINT16LE unknown_30;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_1_connect_pos_y;&lt;br /&gt;
  INT16LE unknown_36;&lt;br /&gt;
  INT16LE unknown_38;&lt;br /&gt;
  UINT16LE unknown_40;&lt;br /&gt;
  UINT16LE unknown_42;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_x;&lt;br /&gt;
  BYTE pulley_rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE pulley_connected_1;&lt;br /&gt;
  INT16LE pulley_connected_2;&lt;br /&gt;
  INT16LE unknown_50;&lt;br /&gt;
  INT16LE unknown_52;&lt;br /&gt;
  INT16LE rope_index;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;flags&#039;&#039;&#039; (see meaning of the individual flags at the &amp;quot;default&amp;quot; part data structure):&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0xe000&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x4800&amp;lt;/code&amp;gt; if in parts bin), &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x8&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;0x0&amp;lt;/code&amp;gt; {{TODO|in some cases}})&lt;br /&gt;
** &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;: &amp;lt;code&amp;gt;flags_1 = 0x6000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_2 = 0x4&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;flags_3 = 0x48&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt; if in parts bin)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: Pulleys can have four different sprites depending on the orientation. Possible values are 0-3.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;, &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: The size of the pulley sprite. In TIM 2 / 3, also depends on the orientation.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the pulley, top left coordinates of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;, &#039;&#039;&#039;unknown_26&#039;&#039;&#039;, &#039;&#039;&#039;unknown_28&#039;&#039;&#039;, &#039;&#039;&#039;unknown_30&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Always 1, same value is used for ropes.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where one rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Depends on the orientation of the pulley, like &#039;&#039;appearance&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;, &#039;&#039;&#039;unknown_38&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;unknown_40&#039;&#039;, &#039;&#039;unknown_42&#039;&#039;&#039;: Not used, always 0.&lt;br /&gt;
* &#039;&#039;&#039;pulley_rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pulley_rope_2_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where the other rope segment is connected to the pulley, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;pulley_connected_1&#039;&#039;&#039;, &#039;&#039;&#039;pulley_connected_2&#039;&#039;&#039;: Either a the index of part at one of the two ends of the rope, or the index of next or previous pulley the rope is running through.&lt;br /&gt;
* &#039;&#039;&#039;unknown_50&#039;&#039;&#039;, &#039;&#039;&#039;unknown_52&#039;&#039;&#039;: Not used, always -1.&lt;br /&gt;
* &#039;&#039;&#039;rope_index&#039;&#039;&#039;: In TIM 2 / 3, the index of the rope part. Not used (-1) in TIM and TEMIM.&lt;br /&gt;
&lt;br /&gt;
{{TODO| This is a work in progress.}}&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10581</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10581"/>
		<updated>2022-07-21T14:15:42Z</updated>

		<summary type="html">&lt;p&gt;Knt47: Puzzle part data&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 00 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;EF AC 12 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;code&amp;gt;ED AC 02 01&amp;lt;/code&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;). An empty string in .GKC files with magic number &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;code&amp;gt;EE AC 05 01&amp;lt;/code&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;code&amp;gt;EF AC 13 01&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;EF AC 14 01&amp;lt;/code&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
Hints are supported only in TIM 2 and 3 puzzles. The first two bytes of the hint data contain the number of the hints in 16-bit little endian format. This is followed by 8 hint entries, some of them may be unused. A size of an unused entry is 7 bytes. One entry consists of three 16-bit integers and a null-terminated string containing the hint text. The three integer members are (all have a 16-bit little endian format):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;position_x&#039;&#039;&#039;: The X position of the hand icon for the hint.&lt;br /&gt;
* &#039;&#039;&#039;position_y&#039;&#039;&#039;: The Y position.&lt;br /&gt;
* &#039;&#039;&#039;hint_icon_flip&#039;&#039;&#039;: The hand icon of a hint can be flipped and can have four different orientations. Possible values are 0-3.&lt;br /&gt;
&lt;br /&gt;
In TIM 2, there are 3 (?) puzzles with magic number &amp;lt;code&amp;gt;EF AC 11 01&amp;lt;/code&amp;gt;. Neither of these files contain hints. However, the size of the empty hints section is 42 bytes in them instead of the expected 58.&lt;br /&gt;
&lt;br /&gt;
== Puzzle information data structure ==&lt;br /&gt;
&lt;br /&gt;
=== In TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
In TIM and TEMIM, there are two different puzzle header information data structures, one is used by the puzzles, and the another is found in saved &amp;quot;freeform&amp;quot; machines and the GKC files.&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM / TEMIM puzzles:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] bonus_1;&lt;br /&gt;
  UINT16LE bonus_2;&lt;br /&gt;
  [[INT16LE]] pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  INT16LE unknown_8;&lt;br /&gt;
  INT16LE unknown_10;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
The information structure format in saved &amp;quot;freeform&amp;quot; machines and GKC files:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bonus_1&#039;&#039;&#039;: The value of &amp;quot;Bonus 1&amp;quot; immediately after the puzzle is loaded (its value is constantly decreasing while the player is solving the puzzle).&lt;br /&gt;
* &#039;&#039;&#039;bonus_2&#039;&#039;&#039;: The value of &amp;quot;Bonus 2&amp;quot; for the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;unknown_8&#039;&#039;&#039;, &#039;&#039;unknown_10&#039;&#039;: The value of these two members is always -8. Perhaps the top left corner of the screen in the coordinate system used for puzzle parts, which is also (-8, -8).&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1001-1016 for TIM and 1001-1021 for TEMIM.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move (e.g. walls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that move (e.g. balls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_in_partsbin1&#039;&#039;&#039;: The number of parts that are placed into the parts bin. (The player needs to position them in order to solve the puzzle.)&lt;br /&gt;
&lt;br /&gt;
=== In TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM 2 and 3:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE unknown_4;&lt;br /&gt;
  UINT16LE unknown_6;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE unknown_14;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1000-1023.&lt;br /&gt;
* &#039;&#039;&#039;unknown_4&#039;&#039;&#039;, &#039;&#039;&#039;unknown_6&#039;&#039;&#039;: Meaning is unknown, always 0.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move, regardless of whether they are placed initially into the parts bin or not.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that can move.&lt;br /&gt;
* &#039;&#039;&#039;unknown_14&#039;&#039;&#039;: Value is always 0. Likely this member corresponds to num_parts_in_partsbin in TIM/TEMIM puzzle header. However, parts found in the parts bin are not a separate section in TIM 2 / 3, &lt;br /&gt;
&lt;br /&gt;
== Puzzle part data ==&lt;br /&gt;
&lt;br /&gt;
As already discussed in the With the exception of TIM demo version (see below), the size of a part entry for the majority of puzzle parts is 48 bytes. However, there are exceptions, which are discussed in separate sub-sections. The format of the &amp;quot;default&amp;quot; part entry:&lt;br /&gt;
&lt;br /&gt;
  UINT16LE part_type_num;&lt;br /&gt;
  UINT16LE flags_1;&lt;br /&gt;
  UINT16LE flags_2;&lt;br /&gt;
  UINT16LE flags_3;&lt;br /&gt;
  UINT16LE appearance;&lt;br /&gt;
  UINT16LE unknown_10;&lt;br /&gt;
  UINT16LE width_1;&lt;br /&gt;
  UINT16LE height_1;&lt;br /&gt;
  UINT16LE width_2;&lt;br /&gt;
  UINT16LE height_2;&lt;br /&gt;
  INT16LE pos_x;&lt;br /&gt;
  INT16LE pos_y;&lt;br /&gt;
  UINT16LE behavior;&lt;br /&gt;
  UINT16LE unknown_26;&lt;br /&gt;
  [[BYTE]] belt_connect_pos_x;&lt;br /&gt;
  BYTE belt_connect_pos_y;&lt;br /&gt;
  UINT16LE belt_line_distance;&lt;br /&gt;
  UINT16LE unknown_32;&lt;br /&gt;
  BYTE rope_1_connect_pos_x;&lt;br /&gt;
  BYTE rope_1_connect_pos_y;&lt;br /&gt;
  UINT16LE unknown_36;&lt;br /&gt;
  BYTE rope_2_connect_pos_x;&lt;br /&gt;
  BYTE rope_2_connect_pos_y;&lt;br /&gt;
  INT16LE connected_1;&lt;br /&gt;
  INT16LE connected_2;&lt;br /&gt;
  INT16LE outlet_plugged_1;&lt;br /&gt;
  INT16LE outlet_plugged_2;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;part_type_num&#039;&#039;&#039;: A number associated with the type of the part (e.g. 0 - bowling ball). Required for identifying parts with an entry size different from the default. &lt;br /&gt;
* &#039;&#039;&#039;flags_1&#039;&#039;&#039;: A combination of flag bits.&lt;br /&gt;
** &#039;&#039;&#039;TIM&#039;&#039;&#039; / &#039;&#039;&#039;TEMIM&#039;&#039;&#039; uses the following flag bits:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: Unknown meaning, used for a few &amp;quot;moving&amp;quot; parts (bucket, candle)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Set if the part is a wall.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x800&amp;lt;/code&amp;gt;: Part is placed initially into the parts bin (see num_parts_in_partsbin in part information data structure)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position, not placed into the pars bin initially ({{TODO|further testing needed}})&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x4000&amp;lt;/code&amp;gt;: Part cannot move, in fixed position (see &#039;&#039;num_parts_fixed&#039;&#039;)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: Set when 0x800 is not set ({{TODO|further testing needed}})&lt;br /&gt;
** In &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;, the bits have a known meaning:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Meaning unclear, used for &amp;quot;moving&amp;quot; parts only, but not always set, even for a single type of part.***&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x200&amp;lt;/code&amp;gt;: Part can be flipped vertically&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: Part can be flipped horizontally.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: &amp;quot;Moving&amp;quot; part, affected by gravity.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;, 0x4000: Used in combination for parts that do not move and are not affected by gravity.&lt;br /&gt;
* &#039;&#039;&#039;flags_2&#039;&#039;&#039;: Another word containing flag bits. The meaning of most flags is the same in all game versions.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: A belt can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: A belt is connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: A rope can be connected to the part.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: A second rope can be connected to the part (teeter-totter)&lt;br /&gt;
** &amp;lt;code&amp;gt;0x10&amp;lt;/code&amp;gt;: The part sprite is drawn horizontally flipped.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x20&amp;lt;/code&amp;gt;: The part sprite is drawn vertically flipped. Note on flip flags: Flipping a part in the game does not necessarily mean that one of the flip flags will be changed. For several parts, especially in TIM 2 / 3, flipping will affect the value of the &#039;&#039;appearance&#039;&#039; member.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Probably unused&lt;br /&gt;
** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Part can be stretched in at least one direction: inclines, conveyor belt, walls.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: Parts that can be stretched both horizontally and vertically, the walls.&lt;br /&gt;
* &#039;&#039;&#039;flags_3&#039;&#039;&#039;: Some flags are only present in TIM 2 / 3. This member of the part data structure is missing in the demo version of TIM.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x1&amp;lt;/code&amp;gt;: The part can be plugged into an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x2&amp;lt;/code&amp;gt;: The part is an electric outlet.&lt;br /&gt;
** &amp;lt;code&amp;gt;0x4&amp;lt;/code&amp;gt;: The part can burn (e.g. candle) or has a fuse that can be lit (e.g. dynamite, cannon). Usually in combination with flag 0x8. &lt;br /&gt;
** &amp;lt;code&amp;gt;0x8&amp;lt;/code&amp;gt;: Meaning of this flag is unclear. Used for several part types, but changing it has no apparent consequence (?) &lt;br /&gt;
** Flags present only in &#039;&#039;&#039;TIM 2 / 3&#039;&#039;&#039;:&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x40&amp;lt;/code&amp;gt;: Part is &amp;quot;locked&amp;quot;, i.e not placed into the part bin.&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x80&amp;lt;/code&amp;gt;: Sizable scenery part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x100&amp;lt;/code&amp;gt;: {{TODO|unknown meaning}}&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x400&amp;lt;/code&amp;gt;: A &amp;quot;program&amp;quot; icon is shown for the part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x1000&amp;lt;/code&amp;gt;: Scenery part&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x2000&amp;lt;/code&amp;gt;: Wall part (?)&lt;br /&gt;
*** &amp;lt;code&amp;gt;0x8000&amp;lt;/code&amp;gt;: A &amp;quot;Puzzle solution&amp;quot; icon is shown for the part (?)&lt;br /&gt;
* &#039;&#039;&#039;appearance&#039;&#039;&#039;: An identifier for the sprite that is shown for a part before the machine is started. (Once the machine is started, the state of the part can change and so can the sprite shown.) The meaning is different between TIM and TIM 2. In TIM, the sprite of some parts consists of only one image, in this case, this is often the number of the sub-image in the image resource file. ({{TODO|For other parts, this is probably an internal identifier for the sprite (?)}}). In TIM 2 and 3, the meaning of the appearance is an index in the A section of the animation file for the part, or if this is absent, an index in the B section. &amp;quot;Programming&amp;quot; a part in TIM 2 and 3 often results in the change of this field.&lt;br /&gt;
* &#039;&#039;&#039;unknown_10&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;width_1&#039;&#039;&#039;, &#039;&#039;&#039;height_1&#039;&#039;&#039;: The width and height of the selectable area of the part (TODO, confirm this)&lt;br /&gt;
* &#039;&#039;&#039;width_2&#039;&#039;&#039;, &#039;&#039;&#039;height_2&#039;&#039;&#039;: At least in TIM 2, witdh_2 is used for calculating the position of part sprite when the part is flipped because of the horizontal flip bit is set in flags_2.&lt;br /&gt;
* &#039;&#039;&#039;pos_x&#039;&#039;&#039;, &#039;&#039;&#039;pos_y&#039;&#039;&#039;: The position of the part, usually the top left corner of the bounding rectangle.&lt;br /&gt;
* &#039;&#039;&#039;behavior&#039;&#039;&#039;: In TIM 2 and 3, a programmed behavior of the part. (However, for many parts, &amp;quot;programming&amp;quot; modifies the &#039;&#039;appearance&#039;&#039; member.) For example the number of shots of the phazer gun or character shown by the message computer.  Meaning is different for rope parts, see below. Unused in TIM and TEMIM (except for ropes).&lt;br /&gt;
* &#039;&#039;&#039;unknown_26&#039;&#039;&#039;: Probably unused, usually 0. Note that belt parts have a value of 1 in this position.&lt;br /&gt;
* &#039;&#039;&#039;belt_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;belt_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Always positive or 0, because &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039; are the coordinates of the top left corner where the sprite starts. Note that the formulas required for calculating the exact position of the belt are slightly different between TIM and TIM 2. Parts for which connection of a belt is allowed have a distinct circular area in their sprite, corresponding to the location where the belt is connected. In TIM / TEMIM, &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; is approximately the top left corner of its bounding rectangle, while in TIM 2 /3 it is close to the center of the circle.&lt;br /&gt;
* &#039;&#039;&#039;unknown_36&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;belt_line_distance&#039;&#039;&#039;: The belts in the game appear as two, usually not perfectly parallel black (TIM / TEMIM) or gray (TIM 2 / 3) lines. This parameter determines the distance between the two segments, More precisely, it is either approximately the diameter of the circular area mentioned at &#039;&#039;belt_connect_pos_x&#039;&#039; and &#039;&#039;belt_connect_pos_y&#039;&#039; (TIM / TEMIM) or its radius (TIM 2 / 3).&lt;br /&gt;
* &#039;&#039;&#039;unknown_32&#039;&#039;&#039;: Probably unused, usually 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_1_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_1_connect_pos_y&#039;&#039;&#039;: The coordinates of the point where a rope is connected to the part, relative to &#039;&#039;pos_x&#039;&#039; and &#039;&#039;pos_y&#039;&#039;. Similarly to belt_connect_pos_x/y, always positive or 0.&lt;br /&gt;
* &#039;&#039;&#039;rope_2_connect_pos_x&#039;&#039;&#039;, &#039;&#039;&#039;rope_2_connect_pos_y&#039;&#039;&#039;: The same as &#039;&#039;rope_1_connect_pos_x&#039;&#039;, &#039;&#039;rope_1_connect_pos_y&#039;&#039;, bit for another connected rope part.&lt;br /&gt;
* &#039;&#039;&#039;connected_1&#039;&#039;&#039;, &#039;&#039;&#039;connected_2&#039;&#039;&#039;: The index of one or two parts in the puzzle that are connected to this part with a rope. If the rope runs through pulleys, this is the part index of the first pulley. If no rope is connected or this is not possible for the part, the value of both structure members are -1. (Of course, if one rope is connected, the value of one structure member (usually connected_rope_1) is the index of the rope part and the other is -1) )In TIM 2 and 3, the &amp;quot;remote bomb&amp;quot; part actually corresponds to two entries in the puzzle file. The connected_rope_2 field contains the index of the another &amp;quot;element&amp;quot; of the bomb, in both entries.&lt;br /&gt;
* &#039;&#039;&#039;outlet_plugged_1&#039;&#039;&#039;, &#039;&#039;&#039;outlet_plugged_2&#039;&#039;&#039;: These structure members are only meaningful for electric outlet parts. Electric outlets always have 2 &amp;quot;sockets&amp;quot; for parts requiring electricity. It contains the index/indices of the part/parts plugged into the electric outlet, or -1 if the &amp;quot;socket&amp;quot; is free. If the part does not support this, both values are -1.&lt;br /&gt;
&lt;br /&gt;
{{TODO| This is a work in progress.}}&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10580</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10580"/>
		<updated>2022-07-21T13:55:29Z</updated>

		<summary type="html">&lt;p&gt;Knt47: puzzle information structure, TIM 2 / 3 hints&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;ED AC 00 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;ED AC 02 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;EE AC 05 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;EF AC 11 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;EF AC 12 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;EF AC 13 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;EF AC 14 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;tt&amp;gt;ED AC 02 01&amp;lt;/tt&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;tt&amp;gt;EE AC 05 01&amp;lt;/tt&amp;gt;). An empty string in .GKC files with magic number &amp;lt;tt&amp;gt;EE AC 05 01&amp;lt;/tt&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;tt&amp;gt;EE AC 05 01&amp;lt;/tt&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;tt&amp;gt;EF AC 13 01&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;EF AC 14 01&amp;lt;/tt&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
Hints are supported only in TIM 2 and 3 puzzles. The first two bytes of the hint data contain the number of the hints in 16-bit little endian format. This is followed by 8 hint entries, some of them may be unused. A size of an unused entry is 7 bytes. One entry consists of three 16-bit integers and a null-terminated string containing the hint text. The three integer members are (all have a 16-bit little endian format):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;position_x&#039;&#039;&#039;: The X position of the hand icon for the hint.&lt;br /&gt;
* &#039;&#039;&#039;position_y&#039;&#039;&#039;: The Y position.&lt;br /&gt;
* &#039;&#039;&#039;hint_icon_flip&#039;&#039;&#039;: The hand icon of a hint can be flipped and can have four different orientations. Possible values are 0-3.&lt;br /&gt;
&lt;br /&gt;
In TIM 2, there are 3 (?) puzzles with magic number EF AC 11 01. Neither of these files contain hints. However, the size of the empty hints section is 42 bytes in them instead of the expected 58.&lt;br /&gt;
&lt;br /&gt;
== Puzzle information data structure ==&lt;br /&gt;
&lt;br /&gt;
=== In TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
In TIM and TEMIM, there are two different puzzle header information data structures, one is used by the puzzles, and the another is found in saved &amp;quot;freeform&amp;quot; machines and the GKC files.&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM / TEMIM puzzles:&lt;br /&gt;
&lt;br /&gt;
  [[UINT16LE]] bonus_1;&lt;br /&gt;
  UINT16LE bonus_2;&lt;br /&gt;
  [[INT16LE]] pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  INT16LE unknown_8;&lt;br /&gt;
  INT16LE unknown_10;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
The information structure format in saved &amp;quot;freeform&amp;quot; machines and GKC files:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE num_parts_in_partsbin;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;bonus_1&#039;&#039;&#039;: The value of &amp;quot;Bonus 1&amp;quot; immediately after the puzzle is loaded (its value is constantly decreasing while the player is solving the puzzle).&lt;br /&gt;
* &#039;&#039;&#039;bonus_2&#039;&#039;&#039;: The value of &amp;quot;Bonus 2&amp;quot; for the puzzle.&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;unknown_8&#039;&#039;&#039;, &#039;&#039;unknown_10&#039;&#039;: The value of these two members is always -8. Perhaps the top left corner of the screen in the coordinate system used for puzzle parts, which is also (-8, -8).&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1001-1016 for TIM and 1001-1021 for TEMIM.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move (e.g. walls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that move (e.g. balls), not in the &amp;quot;parts bin&amp;quot;.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_in_partsbin1&#039;&#039;&#039;: The number of parts that are placed into the parts bin. (The player needs to position them in order to solve the puzzle.)&lt;br /&gt;
&lt;br /&gt;
=== In TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
The information structure format in TIM 2 and 3:&lt;br /&gt;
&lt;br /&gt;
  INT16LE pressure;&lt;br /&gt;
  INT16LE gravity;&lt;br /&gt;
  UINT16LE unknown_4;&lt;br /&gt;
  UINT16LE unknown_6;&lt;br /&gt;
  UINT16LE music;&lt;br /&gt;
  UINT16LE num_parts_fixed;&lt;br /&gt;
  UINT16LE num_parts_moving;&lt;br /&gt;
  UINT16LE unknown_14;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;pressure&#039;&#039;&#039;: The pressure set for the puzzle, the default value is 67.&lt;br /&gt;
* &#039;&#039;&#039;gravity&#039;&#039;&#039;: Gravity set for the puzzle, the default value is 272.&lt;br /&gt;
* &#039;&#039;&#039;music&#039;&#039;&#039;: ID of music track played. Valid values are 1000-1023.&lt;br /&gt;
* &#039;&#039;&#039;unknown_4&#039;&#039;&#039;, &#039;&#039;&#039;unknown_6&#039;&#039;&#039;: Meaning is unknown, always 0.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_fixed&#039;&#039;&#039;: Number of parts in the puzzles that cannot move, regardless of whether they are placed initially into the parts bin or not.&lt;br /&gt;
* &#039;&#039;&#039;num_parts_moving&#039;&#039;&#039;: Number of parts in the puzzles that can move.&lt;br /&gt;
* &#039;&#039;&#039;unknown_14&#039;&#039;&#039;: Value is always 0. Likely this member corresponds to num_parts_in_partsbin in TIM/TEMIM puzzle header. However, parts found in the parts bin are not a separate section in TIM 2 / 3, &lt;br /&gt;
&lt;br /&gt;
{{TODO| This is a work in progress.}}&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10579</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10579"/>
		<updated>2022-07-21T13:45:20Z</updated>

		<summary type="html">&lt;p&gt;Knt47: TIM level file structure&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM))&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;ED AC 00 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;ED AC 02 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;EE AC 05 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;EF AC 11 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;EF AC 12 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;EF AC 13 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;EF AC 14 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Structure of puzzle and GKC files ==&lt;br /&gt;
&lt;br /&gt;
The level/puzzle/saved machine files consist of multiple sections. An overview of the file structure is provided below, separately for TIM / TEMIM and TIM 2 / TIM 3.&lt;br /&gt;
&lt;br /&gt;
=== TIM and TEMIM ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Puzzle title, null-terminated string. missing in .GKC files and &amp;quot;freeform machines&amp;quot; saved by the player.&lt;br /&gt;
* Goal description, null-terminated string. Absent from .GKC files and &amp;quot;saved freeform machines&amp;quot; with magic number of &amp;lt;tt&amp;gt;ED AC 02 01&amp;lt;/tt&amp;gt;. Present in TEMIM &amp;quot;saved freeform machines&amp;quot; (magic number &amp;lt;tt&amp;gt;EE AC 05 01&amp;lt;/tt&amp;gt;). An empty string in .GKC files with magic number &amp;lt;tt&amp;gt;EE AC 05 01&amp;lt;/tt&amp;gt;.&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move (&amp;quot;fixed&amp;quot;, e.g. walls) and are not found initially to the parts bin.&lt;br /&gt;
* List of part entry structures for parts that can move (e.g. balls), not in the parts bin.&lt;br /&gt;
* An additional 16-bit, little endian integer value in puzzles with magic number of &amp;lt;tt&amp;gt;EE AC 05 01&amp;lt;/tt&amp;gt;. The meaning of this value is unclear. 0 in puzzles from the game archive file. In saved freeform machines, 1 if there are parts placed into the parts bin, 0 otherwise.&lt;br /&gt;
* List of part entry structures for parts initially placed into the parts bin.&lt;br /&gt;
&lt;br /&gt;
=== TIM 2 and 3 ===&lt;br /&gt;
&lt;br /&gt;
* Magic number, see above&lt;br /&gt;
* Two additional &amp;quot;header&amp;quot; bytes in files with magic number &amp;lt;tt&amp;gt;EF AC 13 01&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;EF AC 14 01&amp;lt;/tt&amp;gt;. First byte is always 0, second is the background color from the 16-color palette.&lt;br /&gt;
* Puzzle title, null-terminated string&lt;br /&gt;
* Goal description, null-terminated string&lt;br /&gt;
* Hints, see below&lt;br /&gt;
* Puzzle information data structure, see below&lt;br /&gt;
* List of part entry structures for parts that cannot move&lt;br /&gt;
* List of part entry structures for parts that can move&lt;br /&gt;
* Solution information, see below&lt;br /&gt;
&lt;br /&gt;
{{TODO| This is a work in progress.}}&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10578</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10578"/>
		<updated>2022-07-21T13:35:56Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Magic number */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM)&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;ED AC 00 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;ED AC 02 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;EE AC 05 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines in TEMIM.&lt;br /&gt;
* &amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;EF AC 11 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;EF AC 12 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;EF AC 13 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;EF AC 14 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{TODO| This is a work in progress.}}&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10577</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10577"/>
		<updated>2022-07-21T13:34:16Z</updated>

		<summary type="html">&lt;p&gt;Knt47: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM)&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
== Magic number ==&lt;br /&gt;
 &lt;br /&gt;
TIM-TIM 3 level and GKC files always start with a 4-byte magic number. The following table summarizes the magic numbers found in various versions of the game.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
 ! Magic number (hex) !! Usage in game versions&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;ED AC 00 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM demo version.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;ED AC 02 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* Puzzles in TIM.&lt;br /&gt;
* Saved freeform machines in TIM.&lt;br /&gt;
* GKC files in TIM.&lt;br /&gt;
* CREDITS.GKC in TEMIM.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;EE AC 05 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* New puzzles in TEMIM not found in TIM.&lt;br /&gt;
* Saved freeform machines i TEMIM.&lt;br /&gt;
* TITLE.GKC in TEMIM.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;EF AC 11 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;tt&amp;gt;EF AC 12 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 2 and 3.&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;tt&amp;gt;EF AC 13 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* The large majority of puzzles in TIM 2 and 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 2.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;EF AC 14 01&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
* A small number of puzzles in TIM 3.&lt;br /&gt;
* Puzzles saved from the built-in editor of TIM 3.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{TODO| This is a work in progress.}}&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10576</id>
		<title>The Incredible Machine Level Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Level_Format&amp;diff=10576"/>
		<updated>2022-07-21T13:24:17Z</updated>

		<summary type="html">&lt;p&gt;Knt47: Created page with &amp;quot;{{Map Infobox  | Type =  | Layers =  | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts  | Viewport =  &amp;#039;&amp;#039;&amp;#039;576&amp;amp;times;368&amp;#039;&amp;#039;&amp;#039; (Levels...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Map Infobox&lt;br /&gt;
 | Type =&lt;br /&gt;
 | Layers =&lt;br /&gt;
 | Tile size = Not tile based, the game uses a 16x16 grid for walls and a few other puzzle parts&lt;br /&gt;
 | Viewport = &lt;br /&gt;
&#039;&#039;&#039;576&amp;amp;times;368&#039;&#039;&#039; (Levels in [[The Incredible Machine]] (TIM) and [[The Even More Incredible Machine]] (TEMIM)&lt;br /&gt;
&#039;&#039;&#039;640&amp;amp;times;400&#039;&#039;&#039; (.GKC files in TIM and TEMIM)&lt;br /&gt;
&#039;&#039;&#039;560&amp;amp;times;377&#039;&#039;&#039; (Levels in [[The Incredible Machine 2]] and 3)&lt;br /&gt;
 | Games = &lt;br /&gt;
{{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
{{Game|The Incredible Machine 3}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
This page discusses the &#039;&#039;&#039;level format&#039;&#039;&#039; of [[The Incredible Machine]], from the first DOS version (abbreviated as TIM 1) to [[The Incredible Machine 3|TIM 3]] (which is a 32-bit Windows game). Even if the format of some sections of the file  vary significantly between the versions, the way how the parts are stored is highly similar.&lt;br /&gt;
&lt;br /&gt;
The machines/puzzles saved from the &amp;quot;freeform machine&amp;quot; mode or the built-in level editor are also discussed here. The format of files saved from built-in editor may be identical to or slightly different from the levels, depending on the game version. The animated &#039;&#039;&#039;&amp;quot;title screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;&amp;quot;credits screen&amp;quot;&#039;&#039;&#039; (&amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;) files (inside the archive file) in TIM 1 and [[The Even More Incredible Machine]] (TEMIM) use a variant of the level file format, even if these are not playable levels.&lt;br /&gt;
&lt;br /&gt;
{{TODO| This is a work in progress.}}&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=TIM_Resource_Format&amp;diff=9393</id>
		<title>TIM Resource Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=TIM_Resource_Format&amp;diff=9393"/>
		<updated>2021-01-24T23:09:44Z</updated>

		<summary type="html">&lt;p&gt;Knt47: /* Bitmap Subfiles */ add link to new page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedMoreInfo}}&lt;br /&gt;
{{Archive Infobox&lt;br /&gt;
 | MaxFiles = 65,535&lt;br /&gt;
 | FAT = External + embedded&lt;br /&gt;
 | Names = Yes, 8.3&lt;br /&gt;
 | Metadata = None&lt;br /&gt;
 | Subdirectories = N&lt;br /&gt;
 | Compressed = N&lt;br /&gt;
 | Encrypted = N&lt;br /&gt;
 | Hidden = N&lt;br /&gt;
 | Games = &lt;br /&gt;
   {{Game|The Incredible Machine}}&lt;br /&gt;
}}&lt;br /&gt;
The &#039;&#039;&#039;TIM Resource Format&#039;&#039;&#039; is used by [[The Incredible Machine]] to store much of the game data.&lt;br /&gt;
&lt;br /&gt;
== File format ==&lt;br /&gt;
&lt;br /&gt;
The format comprised of multiple files.  The index file is a &amp;lt;tt&amp;gt;.MAP&amp;lt;/tt&amp;gt; file which stores the offsets of each subfile.  The subfile data is split between a number of real files, and the &amp;lt;tt&amp;gt;.MAP&amp;lt;/tt&amp;gt; file also provides the filenames of these real files.  In [[The Incredible Machine]], the index file is called &amp;lt;tt&amp;gt;RESOURCE.MAP&amp;lt;/tt&amp;gt; and the data files are &amp;lt;tt&amp;gt;RESOURCE.001&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;RESOURCE.004&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In theory data can be read from the data files alone (without the &amp;lt;tt&amp;gt;.MAP&amp;lt;/tt&amp;gt; file) however if the data is to be modified then the &amp;lt;tt&amp;gt;.MAP&amp;lt;/tt&amp;gt; file will have to be updated with the new offsets.&lt;br /&gt;
&lt;br /&gt;
=== Signature ===&lt;br /&gt;
&lt;br /&gt;
There is no known signature, other than carefully reading the file structure and verifying it seems correct (e.g. offsets don&#039;t go past the end of the file.)  The data filenames can also be read from the &amp;lt;tt&amp;gt;.MAP&amp;lt;/tt&amp;gt; file and checked to see whether they exist in the current directory.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;.MAP&amp;lt;/tt&amp;gt; file begins with a header:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[BYTE]][4] || hash_idx || Hash string indexes&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] || fileCount || Number of data files&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that hash indexes are hardcoded in the game execuatable file as sequences &amp;lt;tt&amp;gt;0, 1, &#039;&#039;&#039;6&#039;&#039;&#039;, 7&amp;lt;/tt&amp;gt;, but the actual .MAP file uses &amp;lt;tt&amp;gt;0, 1, &#039;&#039;&#039;5&#039;&#039;&#039;, 7&amp;lt;/tt&amp;gt; so the internal table will be overwritten with these new values.&lt;br /&gt;
&lt;br /&gt;
This is then followed by a file structure, repeated &amp;lt;tt&amp;gt;fileCount&amp;lt;/tt&amp;gt; times:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[char]][13] || filename || Filename of real data file (DOS 8.3, null terminated)&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT16LE]] || count || Number of file entries&lt;br /&gt;
|-&lt;br /&gt;
| FILE_ENTRY[count] || entry || Actual file entries&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A single &amp;lt;tt&amp;gt;FILE_ENTRY&amp;lt;/tt&amp;gt; is defined as:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[INT32LE]] || hash || Filename hash (see below)&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT32LE]] || offset || Offset of file from start of data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To read the subfile data, the filename must be read from the &amp;lt;tt&amp;gt;.MAP&amp;lt;/tt&amp;gt; file (the &amp;lt;tt&amp;gt;filename&amp;lt;/tt&amp;gt; field above) along with the &amp;lt;tt&amp;gt;offset&amp;lt;/tt&amp;gt;.  The file identified by &amp;lt;tt&amp;gt;filename&amp;lt;/tt&amp;gt; must then be opened.  It should&lt;br /&gt;
be in the same directory as the &amp;lt;tt&amp;gt;.MAP&amp;lt;/tt&amp;gt; file.  Seeking to &amp;lt;tt&amp;gt;offset&amp;lt;/tt&amp;gt; in this newly opened file will result in the file pointer being at the start of the subfile header:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Data type !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [[char]][13] || filename || Filename of subfile (DOS 8.3, null terminated)&lt;br /&gt;
|-&lt;br /&gt;
| [[UINT32LE]] || len || Length of subfile data, in bytes&lt;br /&gt;
|-&lt;br /&gt;
| [[BYTE]][len] || content || Subfile content&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;tt&amp;gt;.MAP&amp;lt;/tt&amp;gt; file is not being used, the data files simply consist of the above subfile header and data concatenated one after the other.  Subfiles aren&#039;t split between real files, so each data file can be considered independent (with the exception that the &amp;lt;tt&amp;gt;.MAP&amp;lt;/tt&amp;gt; file contains the offsets for all the subfiles across all the data files.)&lt;br /&gt;
&lt;br /&gt;
The game search for required file (like &amp;lt;tt&amp;gt;VM.OVL&amp;lt;/tt&amp;gt;) in the current folder and if it didn&#039;t there then it calc a hash from filename (&amp;lt;tt&amp;gt;0x564CF4C0&amp;lt;/tt&amp;gt; in this example) and search inside the &amp;lt;tt&amp;gt;.MAP&amp;lt;/tt&amp;gt; file index.&lt;br /&gt;
&lt;br /&gt;
Here is a hash routine for the filenames:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
  input:&lt;br /&gt;
    s - pointer to ASCIIZ filename string&lt;br /&gt;
    idx - pointer to an array of 4 bytes (hash indexes)&lt;br /&gt;
  return:&lt;br /&gt;
    hash - filename hash&lt;br /&gt;
*/&lt;br /&gt;
int32_t tim_hash(char *s, uint8_t *idx) {&lt;br /&gt;
int32_t i, c;&lt;br /&gt;
int16_t isum, ixor;&lt;br /&gt;
  isum = 0;&lt;br /&gt;
  ixor = 0;&lt;br /&gt;
  for (i = 0; s[i]; i++) {&lt;br /&gt;
    c = toupper(s[i]);&lt;br /&gt;
    isum += c;&lt;br /&gt;
    ixor ^= c;&lt;br /&gt;
  }&lt;br /&gt;
  /* both types here MUST be int16_t */&lt;br /&gt;
  isum *= ixor;&lt;br /&gt;
  c = 0;&lt;br /&gt;
  for (ixor = 0; ixor &amp;lt; 4; ixor++) {&lt;br /&gt;
    c &amp;lt;&amp;lt;= 8;&lt;br /&gt;
    /* can use only existing characters&lt;br /&gt;
      (&amp;quot;i&amp;quot; holds the string length now) */&lt;br /&gt;
    if (i &amp;gt; idx[ixor]) {&lt;br /&gt;
      c |= toupper(s[idx[ixor]]);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  c += isum;&lt;br /&gt;
  return(c);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
// this MUST be overwritten with the correct one from the .MAP file!&lt;br /&gt;
uint8_t idx[4] = {0, 1, 6, 7}; // 0, 1, 5, 7&lt;br /&gt;
// example of usage&lt;br /&gt;
printf(&amp;quot;%08X\n&amp;quot;, tim_hash(&amp;quot;vm.ovl&amp;quot;, idx));&lt;br /&gt;
*/&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Bitmap Subfiles ==&lt;br /&gt;
&lt;br /&gt;
See [[The Incredible Machine image format]].&lt;br /&gt;
&lt;br /&gt;
This is an example of PART23.BMP which is the smalles of the bitmap files. It contains one sprite which is 16x16 pixels in size.&lt;br /&gt;
&lt;br /&gt;
If anyone knows the compression used in the SCN section, please let me know. The length of the compressed data is 127:&lt;br /&gt;
https://cloud.githubusercontent.com/assets/1974959/25874475/03651bf0-3513-11e7-98bb-b3640c20fb6f.png&lt;br /&gt;
&lt;br /&gt;
PART28.BMP, the second largest bitmap and only 16x15 px in size, contains 137 compressed bytes:&lt;br /&gt;
https://cloud.githubusercontent.com/assets/1974959/25874624/9f622b10-3513-11e7-8f24-d66877c0ad84.png&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
{{BeginFileFormatTools|Type=group}}&lt;br /&gt;
{{FileFormatTool&lt;br /&gt;
| Name = [[Camoto]]&lt;br /&gt;
| Platform = Linux/Windows&lt;br /&gt;
| canExtract = Yes&lt;br /&gt;
| canDecompress = N/A&lt;br /&gt;
| canCreate = Yes&lt;br /&gt;
| canModify = Yes&lt;br /&gt;
| canCompress = N/A&lt;br /&gt;
| editHidden = N/A&lt;br /&gt;
| editMetadata = N/A&lt;br /&gt;
}}&lt;br /&gt;
{{EndFileFormatTools}}&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This file format was reverse engineered by [[User:Malvineous|Malvineous]].  If you find this information helpful in a project you&#039;re working on, please give credit where credit is due.  (A link back to this wiki would be nice too!)&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Image_Format&amp;diff=9392</id>
		<title>The Incredible Machine Image Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Image_Format&amp;diff=9392"/>
		<updated>2021-01-24T23:01:56Z</updated>

		<summary type="html">&lt;p&gt;Knt47: add category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Image Infobox&lt;br /&gt;
 | Hardware1 = VGA&lt;br /&gt;
 | Depth = 4-bit&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 | MinSize =&lt;br /&gt;
 | MaxSize =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
 | Palette = Shared&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 | NumPlanes =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
 | HasTransparency = Yes&lt;br /&gt;
 | HasHitmap = No&lt;br /&gt;
 | Games = {{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The Incredible Machine&#039;&#039;&#039; (TIM) &#039;&#039;&#039;bitmap images&#039;&#039;&#039; are stored in the &amp;lt;tt&amp;gt;RESOURCE.00?&amp;lt;/tt&amp;gt; [[TIM Resource Format|resource files]] as sub-files. They have the extension &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(For full-screen images (&amp;lt;tt&amp;gt;*.SCR&amp;lt;/tt&amp;gt;), see [[RES Format (Stellar 7)#SCR: Fullscreen image|Stellar 7 RES Format]].)&lt;br /&gt;
&lt;br /&gt;
== Chunk format ==&lt;br /&gt;
&lt;br /&gt;
The files have a small header (8 bytes long): &amp;quot;&amp;lt;tt&amp;gt;BMP:&amp;lt;/tt&amp;gt;&amp;quot; followed by a 32-bit integer number stored in little-endian format. The more significant 16 bits of the number are always 0x8000.&lt;br /&gt;
&lt;br /&gt;
The first chunk after the header is the &amp;quot;&amp;lt;tt&amp;gt;INF:&amp;lt;/tt&amp;gt;&amp;quot; chunk. It has a typical Dynamix chunk format: The chunk name is followed by the chunk size (unsigned 32-bit integer in little-endian format). It contains the number of &amp;quot;sub-images&amp;quot;, and two arrays containing the width and height of each (all values are encoded in a 16-bit little-endian format). This chunk format is documented here: [[RES Format (Stellar 7)#BMP: images]]. Based on the chunk type that contains the image data, there are two &amp;quot;types&amp;quot; of images:&lt;br /&gt;
&lt;br /&gt;
* The majority of the image files in TIM, including the graphics for puzzle parts, contain an &amp;quot;&amp;lt;tt&amp;gt;SCN:&amp;lt;/tt&amp;gt;&amp;quot; and an &amp;quot;&amp;lt;tt&amp;gt;OFS:&amp;lt;/tt&amp;gt;&amp;quot; chunk. The image data is stored in the &amp;quot;&amp;lt;tt&amp;gt;SCN:&amp;lt;/tt&amp;gt;&amp;quot; chunk while the &amp;quot;&amp;lt;tt&amp;gt;OFS:&amp;lt;/tt&amp;gt;&amp;quot; contains the 32-bit offsets for each sub image. The &amp;quot;&amp;lt;tt&amp;gt;SCN:&amp;lt;/tt&amp;gt;&amp;quot; chunk type has its own compression format, described in the next section.&lt;br /&gt;
* The remaining files contain a &amp;quot;BIN:&amp;quot; chunk (e.g. &amp;lt;tt&amp;gt;MOUSE.BMP&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;PARTBIN.BMP&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
(Note: All chunks mentioned above start with the chunk size (32-bit unsigned integer), similarly to &amp;quot;&amp;lt;tt&amp;gt;INF:&amp;lt;/tt&amp;gt;&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
== Images containing an &amp;quot;SCN:&amp;quot; and an &amp;quot;OFS:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
=== The &amp;quot;SCN:&amp;quot; chunk ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;&amp;quot;SCN:&amp;quot;&amp;lt;/tt&amp;gt; chunk contains the pixel data for each sub-image. Basically, it has a run-length encoded format, with a special treatment of transparency. The data for each sub-image starts with a byte that has a special meaning: its value is added to all pixel values. Typical values are 1-5. The value of this byte is 0xFF in some &amp;quot;empty&amp;quot; images containing only a few transparent pixels. The next byte is the first &amp;quot;control&amp;quot; byte. A control byte can encode four &amp;quot;commands&amp;quot; depending on its most significant two bits.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;tt&amp;gt;00......&amp;lt;/tt&amp;gt;: Start a new line in the image, and move the current &amp;quot;x&amp;quot; position to the left with a number of pixels stored in the least significant 6 bits. The file may contain two consecutive bytes where the most significant 2 bits are zero. The meaning of such a sequence depends on the width of the sub-image. If the image is at least 64 pixels wide, it is interpreted as a single jump with a 12-bit size. {{TODO|This may need additional testing, but the result seems to be pixel-exact for a large number of images.}} Otherwise, the two bytes are treated as two separate command bytes. The remaining pixels in current line, as well as the first &amp;quot;new x position&amp;quot; bytes in the next one will be transparent.&lt;br /&gt;
 &lt;br /&gt;
*&amp;lt;tt&amp;gt;01......&amp;lt;/tt&amp;gt;: Add transparent pixels, the number is determined by the least significant 6 bits. Numbers greater than 63 can be encoded as e.g. 0x7F 0x47. A control byte of 0x40 is (part of a) terminator (see below).&lt;br /&gt;
    &lt;br /&gt;
*&amp;lt;tt&amp;gt;10......&amp;lt;/tt&amp;gt;: A sequence of pixels of the same color. The repeat count is specified by the least significant 6 bits of the control byte. A single byte follows the control byte, containing the pixel color. As the game uses a 16-color palette, the most significant 4 bits of this byte are always zero.&lt;br /&gt;
 &lt;br /&gt;
*&amp;lt;tt&amp;gt;11......&amp;lt;/tt&amp;gt;: A sequence of pixel values with a specified length. The length (in pixels, not bytes) is determined by the least significant 6 bits of the &amp;quot;control&amp;quot; byte. The number of the &amp;quot;data&amp;quot; bytes after the &amp;quot;control&amp;quot; byte can be calculated as: &amp;lt;code&amp;gt;(length_in_pixels + 1) &amp;gt;&amp;gt; 1&amp;lt;/code&amp;gt;. Each byte encodes two pixels, the color of leftmost pixel is stored in the most significant nibble. If the number of pixels is odd, the most significant 4 bits of the last byte contains the color of the last pixel, and the less significant nibble is zero.&lt;br /&gt;
&lt;br /&gt;
Nearly all sub-images are &amp;quot;terminated&amp;quot; by the byte sequence 0x00 0x40, however there are a few exceptions (0x40 alone.)&lt;br /&gt;
&lt;br /&gt;
=== The &amp;quot;OFS:&amp;quot; chunk ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;OFS:&amp;lt;/tt&amp;gt;&amp;quot; chunk contains the offsets for each sub-image in the &amp;quot;SCN:&amp;quot; chunk (each offset is a 32-bit integer). The first is always zero.&lt;br /&gt;
&lt;br /&gt;
== Images containing a &amp;quot;BIN:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;BIN:&amp;quot; chunk has a small header containing the compression algorithm (1 byte) and uncompressed size (4 bytes, unsigned, little-endian). It supports the same compression algorithms as [[Dynamix Font Format v4-v5#Compression|Dynamix fonts]]. The header is followed by the compressed 4BPP pixel data. (Note: This format is related to the [[RES Format (Stellar 7)#BMP: Image|BMP images in Stellar 7]]).&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
* A viewer and converter program has been uploaded to the VOGONS forum: [https://www.vogons.org/viewtopic.php?f=5&amp;amp;t=76910]&lt;br /&gt;
* [[Engie File Converter]] can open files that contain a &amp;lt;tt&amp;gt;&amp;quot;BIN:&amp;quot;&amp;lt;/tt&amp;gt; chunk. However, it does not support the &amp;lt;tt&amp;gt;&amp;quot;SCN:&amp;quot;&amp;lt;/tt&amp;gt; data format.&lt;br /&gt;
&lt;br /&gt;
[[Category:Sierra/Dynamix File Formats]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Image_Format&amp;diff=9391</id>
		<title>The Incredible Machine Image Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Image_Format&amp;diff=9391"/>
		<updated>2021-01-24T22:58:51Z</updated>

		<summary type="html">&lt;p&gt;Knt47: Add content #2&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Image Infobox&lt;br /&gt;
 | Hardware1 = VGA&lt;br /&gt;
 | Depth = 4-bit&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 | MinSize =&lt;br /&gt;
 | MaxSize =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
 | Palette = Shared&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 | NumPlanes =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
 | HasTransparency = Yes&lt;br /&gt;
 | HasHitmap = No&lt;br /&gt;
 | Games = {{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The Incredible Machine&#039;&#039;&#039; (TIM) &#039;&#039;&#039;bitmap images&#039;&#039;&#039; are stored in the &amp;lt;tt&amp;gt;RESOURCE.00?&amp;lt;/tt&amp;gt; [[TIM Resource Format|resource files]] as sub-files. They have the extension &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(For full-screen images (&amp;lt;tt&amp;gt;*.SCR&amp;lt;/tt&amp;gt;), see [[RES Format (Stellar 7)#SCR: Fullscreen image|Stellar 7 RES Format]].)&lt;br /&gt;
&lt;br /&gt;
== Chunk format ==&lt;br /&gt;
&lt;br /&gt;
The files have a small header (8 bytes long): &amp;quot;&amp;lt;tt&amp;gt;BMP:&amp;lt;/tt&amp;gt;&amp;quot; followed by a 32-bit integer number stored in little-endian format. The more significant 16 bits of the number are always 0x8000.&lt;br /&gt;
&lt;br /&gt;
The first chunk after the header is the &amp;quot;&amp;lt;tt&amp;gt;INF:&amp;lt;/tt&amp;gt;&amp;quot; chunk. It has a typical Dynamix chunk format: The chunk name is followed by the chunk size (unsigned 32-bit integer in little-endian format). It contains the number of &amp;quot;sub-images&amp;quot;, and two arrays containing the width and height of each (all values are encoded in a 16-bit little-endian format). This chunk format is documented here: [[RES Format (Stellar 7)#BMP: images]]. Based on the chunk type that contains the image data, there are two &amp;quot;types&amp;quot; of images:&lt;br /&gt;
&lt;br /&gt;
* The majority of the image files in TIM, including the graphics for puzzle parts, contain an &amp;quot;&amp;lt;tt&amp;gt;SCN:&amp;lt;/tt&amp;gt;&amp;quot; and an &amp;quot;&amp;lt;tt&amp;gt;OFS:&amp;lt;/tt&amp;gt;&amp;quot; chunk. The image data is stored in the &amp;quot;&amp;lt;tt&amp;gt;SCN:&amp;lt;/tt&amp;gt;&amp;quot; chunk while the &amp;quot;&amp;lt;tt&amp;gt;OFS:&amp;lt;/tt&amp;gt;&amp;quot; contains the 32-bit offsets for each sub image. The &amp;quot;&amp;lt;tt&amp;gt;SCN:&amp;lt;/tt&amp;gt;&amp;quot; chunk type has its own compression format, described in the next section.&lt;br /&gt;
* The remaining files contain a &amp;quot;BIN:&amp;quot; chunk (e.g. &amp;lt;tt&amp;gt;MOUSE.BMP&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;PARTBIN.BMP&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
(Note: All chunks mentioned above start with the chunk size (32-bit unsigned integer), similarly to &amp;quot;&amp;lt;tt&amp;gt;INF:&amp;lt;/tt&amp;gt;&amp;quot;.)&lt;br /&gt;
&lt;br /&gt;
== Images containing an &amp;quot;SCN:&amp;quot; and an &amp;quot;OFS:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
=== The &amp;quot;SCN:&amp;quot; chunk ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;&amp;quot;SCN:&amp;quot;&amp;lt;/tt&amp;gt; chunk contains the pixel data for each sub-image. Basically, it has a run-length encoded format, with a special treatment of transparency. The data for each sub-image starts with a byte that has a special meaning: its value is added to all pixel values. Typical values are 1-5. The value of this byte is 0xFF in some &amp;quot;empty&amp;quot; images containing only a few transparent pixels. The next byte is the first &amp;quot;control&amp;quot; byte. A control byte can encode four &amp;quot;commands&amp;quot; depending on its most significant two bits.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;tt&amp;gt;00......&amp;lt;/tt&amp;gt;: Start a new line in the image, and move the current &amp;quot;x&amp;quot; position to the left with a number of pixels stored in the least significant 6 bits. The file may contain two consecutive bytes where the most significant 2 bits are zero. The meaning of such a sequence depends on the width of the sub-image. If the image is at least 64 pixels wide, it is interpreted as a single jump with a 12-bit size. {{TODO|This may need additional testing, but the result seems to be pixel-exact for a large number of images.}} Otherwise, the two bytes are treated as two separate command bytes. The remaining pixels in current line, as well as the first &amp;quot;new x position&amp;quot; bytes in the next one will be transparent.&lt;br /&gt;
 &lt;br /&gt;
*&amp;lt;tt&amp;gt;01......&amp;lt;/tt&amp;gt;: Add transparent pixels, the number is determined by the least significant 6 bits. Numbers greater than 63 can be encoded as e.g. 0x7F 0x47. A control byte of 0x40 is (part of a) terminator (see below).&lt;br /&gt;
    &lt;br /&gt;
*&amp;lt;tt&amp;gt;10......&amp;lt;/tt&amp;gt;: A sequence of pixels of the same color. The repeat count is specified by the least significant 6 bits of the control byte. A single byte follows the control byte, containing the pixel color. As the game uses a 16-color palette, the most significant 4 bits of this byte are always zero.&lt;br /&gt;
 &lt;br /&gt;
*&amp;lt;tt&amp;gt;11......&amp;lt;/tt&amp;gt;: A sequence of pixel values with a specified length. The length (in pixels, not bytes) is determined by the least significant 6 bits of the &amp;quot;control&amp;quot; byte. The number of the &amp;quot;data&amp;quot; bytes after the &amp;quot;control&amp;quot; byte can be calculated as: &amp;lt;code&amp;gt;(length_in_pixels + 1) &amp;gt;&amp;gt; 1&amp;lt;/code&amp;gt;. Each byte encodes two pixels, the color of leftmost pixel is stored in the most significant nibble. If the number of pixels is odd, the most significant 4 bits of the last byte contains the color of the last pixel, and the less significant nibble is zero.&lt;br /&gt;
&lt;br /&gt;
Nearly all sub-images are &amp;quot;terminated&amp;quot; by the byte sequence 0x00 0x40, however there are a few exceptions (0x40 alone.)&lt;br /&gt;
&lt;br /&gt;
=== The &amp;quot;OFS:&amp;quot; chunk ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;&amp;lt;tt&amp;gt;OFS:&amp;lt;/tt&amp;gt;&amp;quot; chunk contains the offsets for each sub-image in the &amp;quot;SCN:&amp;quot; chunk (each offset is a 32-bit integer). The first is always zero.&lt;br /&gt;
&lt;br /&gt;
== Images containing a &amp;quot;BIN:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;BIN:&amp;quot; chunk has a small header containing the compression algorithm (1 byte) and uncompressed size (4 bytes, unsigned, little-endian). It supports the same compression algorithms as [[Dynamix Font Format v4-v5#Compression|Dynamix fonts]]. The header is followed by the compressed 4BPP pixel data. (Note: This format is related to the [[RES Format (Stellar 7)#BMP: Image|BMP images in Stellar 7]]).&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
* A viewer and converter program has been uploaded to the VOGONS forum: [https://www.vogons.org/viewtopic.php?f=5&amp;amp;t=76910]&lt;br /&gt;
* [[Engie File Converter]] can open files that contain a &amp;lt;tt&amp;gt;&amp;quot;BIN:&amp;quot;&amp;lt;/tt&amp;gt; chunk. However, it does not support the &amp;lt;tt&amp;gt;&amp;quot;SCN:&amp;quot;&amp;lt;/tt&amp;gt; data format.&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=User:Knt47&amp;diff=9390</id>
		<title>User:Knt47</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=User:Knt47&amp;diff=9390"/>
		<updated>2021-01-24T22:08:51Z</updated>

		<summary type="html">&lt;p&gt;Knt47: fix link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I&#039;m working on the reverse engineering of some file formats found in the The Incredible Machine game series. I have already reverse engineered the &amp;quot;SCN:&amp;quot; chunk format found in many image resources in TIM, TEMIM and TIM2. This format is mentioned on the page [[TIM_Resource_Format]], but no reverse engineering tool I&#039;m aware of seems to support it. I&#039;m also interested in other file formats in these games, especially the level/puzzle files.&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine&amp;diff=9389</id>
		<title>The Incredible Machine</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine&amp;diff=9389"/>
		<updated>2021-01-24T22:05:07Z</updated>

		<summary type="html">&lt;p&gt;Knt47: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Game Infobox&lt;br /&gt;
 | Levels = No&lt;br /&gt;
 | Tiles = No&lt;br /&gt;
 | Sprites = No&lt;br /&gt;
 | Fullscreen = No&lt;br /&gt;
 | Sound = No&lt;br /&gt;
 | Music = No&lt;br /&gt;
 | Text = No&lt;br /&gt;
 | Story = No&lt;br /&gt;
 | Interface = No&lt;br /&gt;
}}&lt;br /&gt;
{{NoModdingInfo}}&lt;br /&gt;
== File formats ==&lt;br /&gt;
&lt;br /&gt;
This section lists the file formats used in the game.&lt;br /&gt;
&lt;br /&gt;
=== Resource file format ===&lt;br /&gt;
See [[TIM Resource Format]]. Resource sub-files are stored in files named &amp;lt;tt&amp;gt;RESOURCE.00?&amp;lt;/tt&amp;gt;. The Incredible Machine has four such files: &amp;lt;tt&amp;gt;RESOURCE.001&amp;lt;/tt&amp;gt;-&amp;lt;tt&amp;gt;.004&amp;lt;/tt&amp;gt;. (However, the demo versions of both The Incredible Machine and The Even More Incredible Machine has only one. {{TODO|Add information for The Even More Incredible Machine.}}) The &amp;lt;tt&amp;gt;RESOURCE.MAP&amp;lt;/tt&amp;gt; file contains the offsets for the sub-files.&lt;br /&gt;
&lt;br /&gt;
=== Files inside the RESOURCE.00? archive files ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! File name or extension !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;*.BMP&amp;lt;/tt&amp;gt; || 16-color images. See [[The Incredible Machine image format]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;MEMOFNT8.FNT&amp;lt;/tt&amp;gt; || 1BPP font, [[Dynamix Font Format v4-v5|Dynamix Font Format v4]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; || Title screen and credits animation. File format seems to be related to the levels.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SX.OVL&amp;lt;/tt&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;tt&amp;gt;VM.OVL&amp;lt;/tt&amp;gt; || {{TODO|TODO: Add information}} &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;*.PAL&amp;lt;/tt&amp;gt; || VGA palettes. Similar to the palette format of [[RES Format (Stellar 7)#PAL: Palette|Stellar 7]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;*.SCR&amp;lt;/tt&amp;gt; || Full-screen image (640x480x16 color). See [[RES Format (Stellar 7)#SCR: Fullscreen image|RES Format (Stellar 7)]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;TIM.SX&amp;lt;/tt&amp;gt; || Sound and music. {{TODO|TODO: Add information}} &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;L*.TIM&amp;lt;/tt&amp;gt; || Level/puzzle files. &amp;lt;!-- [[The Incredible Machine level format|Level/puzzle files]] --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;PASSWORD.TXT&amp;lt;/tt&amp;gt; || Plain text file. Contains passwords for each level.&lt;br /&gt;
|- &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[RES Format (Stellar 7)]] - Contains the documentation for several identical or related file formats.&lt;br /&gt;
&lt;br /&gt;
[[Category:Sierra/Dynamix]]&lt;br /&gt;
[[Category:Puzzle]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Image_Format&amp;diff=9388</id>
		<title>The Incredible Machine Image Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Image_Format&amp;diff=9388"/>
		<updated>2021-01-24T21:57:55Z</updated>

		<summary type="html">&lt;p&gt;Knt47: Add content&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Image Infobox&lt;br /&gt;
 | Hardware1 = VGA&lt;br /&gt;
 | Depth = 4-bit&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 | MinSize =&lt;br /&gt;
 | MaxSize =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
 | Palette = Shared&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 | NumPlanes =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
 | HasTransparency = Yes&lt;br /&gt;
 | HasHitmap = No&lt;br /&gt;
 | Games = {{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The Incredible Machine&#039;&#039;&#039; (TIM) &#039;&#039;&#039;bitmap images&#039;&#039;&#039; are stored in the &amp;lt;tt&amp;gt;RESOURCE.00?&amp;lt;/tt&amp;gt; [[TIM Resource Format|resource files]] as sub-files. They have the extension &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(For full-screen images (&amp;lt;tt&amp;gt;*.SCR&amp;lt;/tt&amp;gt;), see [[RES Format (Stellar 7)#SCR: Fullscreen image|Stellar 7 RES Format]])&lt;br /&gt;
&lt;br /&gt;
== Chunk format ==&lt;br /&gt;
&lt;br /&gt;
The files have a small header (8 bytes long): &amp;quot;&amp;lt;tt&amp;gt;BMP:&amp;lt;/tt&amp;gt;&amp;quot; followed by a 32-bit integer number stored in little-endian format. The more significant 16 bits of the number are always 0x8000.&lt;br /&gt;
&lt;br /&gt;
The first chunk after the header is the &amp;quot;&amp;lt;tt&amp;gt;INF:&amp;lt;/tt&amp;gt;&amp;quot; chunk. It has a typical Dynamix chunk format: The chunk name is followed by the chunk size (unsigned 32-bit integer in little-endian format). It contains the number of &amp;quot;sub-images&amp;quot;, and two arrays containing the width and height of each (all values are encoded in a 16-bit little-endian format). This chunk format is documented here: [[RES Format (Stellar 7)#BMP: images]]. Based on the chunk type that contains the image data, there are two &amp;quot;types&amp;quot; of images:&lt;br /&gt;
&lt;br /&gt;
* The majority of the image files in TIM, including the graphics for puzzle parts, contain an &amp;quot;&amp;lt;tt&amp;gt;SCN:&amp;lt;/tt&amp;gt;&amp;quot; and an &amp;quot;&amp;lt;tt&amp;gt;OFS:&amp;lt;/tt&amp;gt;&amp;quot; chunk. The image data is stored in the &amp;quot;&amp;lt;tt&amp;gt;SCN:&amp;lt;/tt&amp;gt;&amp;quot; chunk while the &amp;quot;&amp;lt;tt&amp;gt;OFS:&amp;lt;/tt&amp;gt;&amp;quot; contains the 32-bit offsets for each sub image. The &amp;quot;&amp;lt;tt&amp;gt;SCN:&amp;lt;/tt&amp;gt;&amp;quot; chunk type has its own compression format, described in the next section,&lt;br /&gt;
* The remaining files contain a &amp;quot;BIN:&amp;quot; chunk (e.g. &amp;lt;tt&amp;gt;MOUSE.BMP&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;PARTBIN.BMP&amp;lt;/tt&amp;gt;). The &amp;quot;BIN:&amp;quot; chunk has a small header containing the compression algorithm (1 byte) and uncompressed size (4 bytes).&lt;br /&gt;
&lt;br /&gt;
(Note: All chunks mentioned above start with the chunk size, (32-bit unsigned integer) similarly to &amp;quot;&amp;lt;tt&amp;gt;INF:&amp;lt;/tt&amp;gt;&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
== Images containing an &amp;quot;SCN:&amp;quot; and an &amp;quot;OFS:&amp;quot; chunk ==&lt;br /&gt;
&lt;br /&gt;
=== The &amp;quot;SCN:&amp;quot; chunk ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;&amp;quot;SCN:&amp;quot;&amp;lt;/tt&amp;gt; chunk contains the pixel data for each sub-image. Basically, it has a run-length encoded format, with a special treatment of transparency. The data for each sub-image starts with a byte that has a special meaning: its value is added to all pixel values. Typical values are 1-5. The value of this byte is 0xFF in some &amp;quot;empty&amp;quot; images containing only a few transparent pixels. The next byte is the first &amp;quot;control&amp;quot; byte. A control byte can encode four &amp;quot;commands&amp;quot; depending on its most significant two bits.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;tt&amp;gt;00......&amp;lt;/tt&amp;gt;: Start a new line in the image, and move the current &amp;quot;x&amp;quot; position to the left with a number of pixels stored in the least significant 6 bits. The file may contain two consecutive bytes where the most significant 2 bits are zero. The meaning of such a sequence depends on the width of the sub-image. If the image is at least 64 pixels wide, it is interpreted as a single jump with a 12-bit size. {{TODO|This may need additional testing, but the result seems to be pixel-exact for a large number of images.}} Otherwise, the two bytes are treated as two separate command bytes. The remaining pixels in current line, as well as the first &amp;quot;new x position&amp;quot; bytes in the next one will be transparent.&lt;br /&gt;
 &lt;br /&gt;
*&amp;lt;tt&amp;gt;01......&amp;lt;/tt&amp;gt;: Add transparent pixels, the number is determined by the least significant 6 bits. Numbers greater than 63 can be encoded as e.g. 0x7F 0x47. A control byte of 0x40 is (part of a) terminator (see below).&lt;br /&gt;
    &lt;br /&gt;
*&amp;lt;tt&amp;gt;10......&amp;lt;/tt&amp;gt;: A sequence of pixels of the same color. The repeat count is specified by the least significant 6 bits of the control byte. A single byte follows the control byte, containing the pixel color. As the game uses a 16-color palette, the most significant 4 bits of this byte are always zero.&lt;br /&gt;
 &lt;br /&gt;
*&amp;lt;tt&amp;gt;11......&amp;lt;/tt&amp;gt;: A sequence of pixel values with a specified length. The length (in pixels, not bytes) is determined by the least significant 6 bits of the &amp;quot;control&amp;quot; byte. The number of the &amp;quot;data&amp;quot; bytes after the &amp;quot;control&amp;quot; byte can be calculated as: &amp;lt;code&amp;gt;(length_in_pixels + 1) &amp;gt;&amp;gt; 1&amp;lt;/code&amp;gt;. Each byte encodes two pixels, the color of leftmost pixel is stored in the most significant nibble. If the number of pixels is odd, the most significant 4 bits of the last byte contains the color of the last pixel, and the less significant nibble is zero.&lt;br /&gt;
&lt;br /&gt;
Nearly all sub-images are &amp;quot;terminated&amp;quot; by the byte sequence 0x00 0x40, however there are a few exceptions (0x40 alone.)&lt;br /&gt;
&lt;br /&gt;
=== The &amp;quot;OFS:&amp;quot; chunk ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;OFS:&amp;quot; chunk contains the offsets for each sub-image in the &amp;quot;SCN:&amp;quot; chunk (each offset is a 32-bit integer). The first is always zero.&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Image_Format&amp;diff=9387</id>
		<title>The Incredible Machine Image Format</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine_Image_Format&amp;diff=9387"/>
		<updated>2021-01-24T21:13:35Z</updated>

		<summary type="html">&lt;p&gt;Knt47: First version, will be expanded soon&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Image Infobox&lt;br /&gt;
 | Hardware1 = VGA&lt;br /&gt;
 | Depth = 4-bit&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 | MinSize =&lt;br /&gt;
 | MaxSize =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
 | Palette = Shared&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
 | NumPlanes =&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
 | HasTransparency = Yes&lt;br /&gt;
 | HasHitmap = No&lt;br /&gt;
 | Games = {{Game|The Incredible Machine}}&lt;br /&gt;
{{Game|The Even More Incredible Machine}}&lt;br /&gt;
{{Game|The Incredible Machine 2}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The Incredible Machine&#039;&#039;&#039; (TIM) &#039;&#039;&#039;bitmap images&#039;&#039;&#039; are stored in the &amp;lt;tt&amp;gt;RESOURCE.00?&amp;lt;/tt&amp;gt; [[TIM Resource Format|resource files]] as sub-files. They have the extension &amp;lt;tt&amp;gt;.BMP&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(For full-screen images (&amp;lt;tt&amp;gt;*.SCR&amp;lt;/tt&amp;gt;), see [[RES Format (Stellar 7)#SCR: Fullscreen image|Stellar 7 RES Format]])&lt;br /&gt;
&lt;br /&gt;
== Chunk format ==&lt;br /&gt;
&lt;br /&gt;
The files have a small header (8 bytes long): &amp;quot;&amp;lt;tt&amp;gt;BMP:&amp;lt;/tt&amp;gt;&amp;quot; followed by a 32-bit integer number stored in little-endian format. The more significant 16 bits of the number are always 0x8000.&lt;br /&gt;
&lt;br /&gt;
The first chunk after the header is the &amp;lt;tt&amp;gt;INF:&amp;lt;/tt&amp;gt; chunk. It has a typical Dynamix chunk format: The chunk name is followed by the chunk size (unsigned 32-bit integer in little-endian format). It contains the number of &amp;quot;sub-images&amp;quot;, and two arrays containing the width and height of each (all values are encoded in a 16-bit little-endian format). This chunk format is documented here: [[RES Format (Stellar 7)#BMP: images]]. Based on the chunk type that contains the image data, there are two &amp;quot;types&amp;quot; of images:&lt;br /&gt;
&lt;br /&gt;
* The majority of the image files in TIM, including the graphics for puzzle parts, contain an &amp;quot;&amp;lt;tt&amp;gt;SCN:&amp;lt;/tt&amp;gt;&amp;quot; and an &amp;quot;&amp;lt;tt&amp;gt;OFS:&amp;lt;/tt&amp;gt;&amp;quot; chunk. The image data is stored in the &amp;quot;&amp;lt;tt&amp;gt;SCN:&amp;lt;/tt&amp;gt;&amp;quot; chunk while the &amp;quot;&amp;lt;tt&amp;gt;OFS:&amp;lt;/tt&amp;gt;&amp;quot; contains the 32-bit offsets for each sub image. The &amp;quot;&amp;lt;tt&amp;gt;SCN:&amp;lt;/tt&amp;gt;&amp;quot; chunk type has its own compression format, described in the next section,&lt;br /&gt;
* The remaining files contain a &amp;quot;BIN:&amp;quot; chunk (e.g. &amp;lt;tt&amp;gt;MOUSE.BMP&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;PARTBIN.BMP&amp;lt;/tt&amp;gt;). The &amp;quot;BIN:&amp;quot; chunk has a small header containing the compression algorithm (1 byte) and uncompressed size (4 bytes).&lt;br /&gt;
&lt;br /&gt;
== Images containing an &amp;quot;SCN:&amp;quot; and an &amp;quot;OFS:&amp;quot; chunk ==&lt;br /&gt;
{{TODO|WIP}}&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
	<entry>
		<id>https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine&amp;diff=9386</id>
		<title>The Incredible Machine</title>
		<link rel="alternate" type="text/html" href="https://moddingwiki.shikadi.net/w/index.php?title=The_Incredible_Machine&amp;diff=9386"/>
		<updated>2021-01-24T19:32:44Z</updated>

		<summary type="html">&lt;p&gt;Knt47: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Game Infobox&lt;br /&gt;
 | Levels = No&lt;br /&gt;
 | Tiles = No&lt;br /&gt;
 | Sprites = No&lt;br /&gt;
 | Fullscreen = No&lt;br /&gt;
 | Sound = No&lt;br /&gt;
 | Music = No&lt;br /&gt;
 | Text = No&lt;br /&gt;
 | Story = No&lt;br /&gt;
 | Interface = No&lt;br /&gt;
}}&lt;br /&gt;
{{NoModdingInfo}}&lt;br /&gt;
== File formats ==&lt;br /&gt;
&lt;br /&gt;
This section lists the file formats used in the game.&lt;br /&gt;
&lt;br /&gt;
=== Resource file format ===&lt;br /&gt;
See [[TIM Resource Format]]. Resource sub-files are stored in files named &amp;lt;tt&amp;gt;RESOURCE.00?&amp;lt;/tt&amp;gt;. The Incredible Machine has four such files: &amp;lt;tt&amp;gt;RESOURCE.001&amp;lt;/tt&amp;gt;-&amp;lt;tt&amp;gt;.004&amp;lt;/tt&amp;gt;. (However, the demo versions of both The Incredible Machine and The Even More Incredible Machine has only one. {{TODO|Add information for The Even More Incredible Machine.}}) The &amp;lt;tt&amp;gt;RESOURCE.MAP&amp;lt;/tt&amp;gt; file contains the offsets for the sub-files.&lt;br /&gt;
&lt;br /&gt;
=== Files inside the RESOURCE.00? archive files ===&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! File name or extension !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;*.BMP&amp;lt;/tt&amp;gt; || 16-color images. See [[The Incredible Machine image format]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;MEMOFNT8.FNT&amp;lt;/tt&amp;gt; || 1BPP font, [[Dynamix Font Format v4-v5|Dynamix Font Format v4]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;CREDITS.GKC&amp;lt;/tt&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;tt&amp;gt;TITLE.GKC&amp;lt;/tt&amp;gt; || Title screen and credits animation. File format seems to be related to the levels.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;SX.OVL&amp;lt;/tt&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;tt&amp;gt;VM.OVL&amp;lt;/tt&amp;gt; || {{TODO|Add documentation}} &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;*.PAL&amp;lt;/tt&amp;gt; || VGA palettes. Similar to the palette format of [[RES Format (Stellar 7)#PAL: Palette|Stellar 7]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;*.SCR&amp;lt;/tt&amp;gt; || Full-screen image (640x480x16 color). See [[RES Format (Stellar 7)#SCR: Fullscreen image|RES Format (Stellar 7)]].&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;TIM.SX&amp;lt;/tt&amp;gt; || Sound and music. {{TODO|Add documentation}} &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;L*.TIM&amp;lt;/tt&amp;gt; || Level/puzzle files. &amp;lt;!-- [[The Incredible Machine level format|Level/puzzle files]] --&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;tt&amp;gt;PASSWORD.TXT&amp;lt;/tt&amp;gt; || Plain text file. Contains passwords for each level.&lt;br /&gt;
|- &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[RES Format (Stellar 7)]] - Contains the documentation for several identical or related file formats.&lt;br /&gt;
&lt;br /&gt;
[[Category:Sierra/Dynamix]]&lt;br /&gt;
[[Category:Puzzle]]&lt;/div&gt;</summary>
		<author><name>Knt47</name></author>
	</entry>
</feed>