VOGONS


First post, by knt47

User metadata
Rank Newbie
Rank
Newbie

Note: I have edited this post to update the title of this topic.
A permanent link for the most recent version of the program:
Re: The Incredible Machine image resource reader
The original post:

I have recently developed a small program that can convert the images from the resource files of the DOS game The Incredible Machine to .PNG format. It currently supports (the DOS versions of) The Incredible Machine, The Even More Incredible Machine and The Incredible Machine 2.

In other words, my code does the following:

  • Reads the .BMP sub-files from the game's resource file (REOSURCE.001, ...) (Note: The resource files from the game are uncompressed and their format is documented here: http://www.shikadi.net/moddingwiki/RES_ ... Stellar_7))
  • Converts (almost) all "sub-images" from the .BMP files with a supported format (i.e. the data is stored in an "SCN:" chunk) to PNG
  • Writes all converted "sub-images" into a single .ZIP file

If anyone is interested, I'll post the source code.

Last edited by knt47 on 2022-07-22, 21:00. Edited 1 time in total.

Reply 1 of 8, by knt47

User metadata
Rank Newbie
Rank
Newbie

I would like to announce the first version of my TIM-TIM3 image resource reader/converter program that comes with a Graphical User Interface. The program was written in Python and has a Tkinter (Tcl/TK) based GUI as well as a command line interface. It currently requires Python 3.6 or later to run. It requires no package other than Tkinter and the Python standard library. The tool should theoretically run on any platform where Python and Tkinter are available. (The program was tested on Microsoft Windows 10 and Ubuntu Linux, but not on other operating systems.) The "official" Python installers for Windows (from python.org) contain everything that is required for running the program. Linux users must install the "python3-tk" package using the package manager. (The name may vary between Linux distributions.)

The code is licensed under the Creative Commons Zero license (https://creativecommons.org/publicdomain/zero/1.0/). However there are two "extra" modules that are not included in the "main" package (these will be posted in this forum in a future post.).

Features:

  • It can open the resource files of the TIM games (RESOURCE.MAP, RESOURCE.00?, documented at http://www.shikadi.net/moddingwiki/TIM_Resource_Format), and read and extract files from it. Alternatively, it can read files with a supported format from a local directory on the computer.
  • Supports decoding bitmap resources (.BMP) that contain the coded pixel data in an "SCN:" chunk. The graphics for all puzzle parts in TIM, TEMIM (The Even More Incredible Machine) and TIM 2 has this format (and also several other image files). This format was "reverse engineered" by the author of the program and no existing DOS game reverse engineering tool/file converter seems to support it.
  • Supports the animation file format found in TIM 2 and (in at least the demo of) TIM 3.
  • Supports ".BMP" and ".SCN" images that contain a "BIN:" and optionally "VGA:" chunk. This format is documented at ModdingWiki (http://www.shikadi.net/moddingwiki/RES_ ... Stellar_7)) and is supported by other converter tools. It must be noted, however, that the required LZW decoder is currently provided only as an "extra" module.
  • Thanks to the documentation available at ModdingWiki (http://www.shikadi.net/moddingwiki/Dynamix_Font_Format_v4-v5), the program has limited support for the font files in the TIM games (displaying the graphics for individual characters)
  • Can read palette files and draw images for palettes.

I will post some screenshots later.

Reply 2 of 8, by knt47

User metadata
Rank Newbie
Rank
Newbie

The extra modules, added as an attachment to this post, are not present in the CC0 licensed Python package, but are distributed separately. The extra files must be copied into the "timgres/extra" sub-directory.

Features that depend on "extra" modules

  • Unlike TIM 2, TIM and TEMIM do not contain "animation" resource files. The information required for animations is likely stored in the executable file. (However, this has not been reverse engineered yet.) As an alternative solution, the animation frame data is provided as an "extra" Python file. The data was NOT extracted from the game, but manually "reconstructed" using a large number of screenshots.
  • In Dynamix games, several file types/chunk types can have one of our compression algorithms (see http://www.shikadi.net/moddingwiki/Dynamix_Font_Format_v4-v5). (Note: the "SCN:" chunk format mentioned above is not one of them.) Due to the "uncertain" copyright status of some source files used as an information source, the CC0 licensed package only includes the decoder for the Uncompressed format. Support for the RLE and the LZW formats is provided as an

I have also attached some screenshots of the program.

Reply 3 of 8, by Nyerguds2

User metadata
Rank Newbie
Rank
Newbie

Odd that you didn't actually link to the page where you put the research of this actual format...

https://moddingwiki.shikadi.net/wiki/The_Incr … ne_image_format

I dug deeper into it and identified some of the rules and quirks in the format, like the fact that at the start of a block of multiple empty lines, if the X coordinate after the skip is lower than before the skip, it first pre-aligns the pointer to the x-coordinate of the end position, so the remaining commands can all be full line skips.

Anyway, a huge thanks for figuring out the main compression scheme; it helped me with files from another Dynamix game (Heart of China) which uses this same format but in an 8-bit environment, by pushing the 4-bit content up to higher indices.

Support for this format was also added to my own game resource tool, Engie File Converter. Being a modding tool, it can also convert files to the TIM sprite format.

Expert on all things Command & Conquer 1 related, creator of the C&C95 v1.06 patch, contributor and tester on the official C&C Remastered project.
(Ignore the '2' in the name 😩)

Reply 4 of 8, by knt47

User metadata
Rank Newbie
Rank
Newbie

Thanks, Nyerguds for the additional reverse engineering work for the TIM image format. It helped me a lot to fix a bug in the image decoder code.
Sorry for the very late reply.

Reply 5 of 8, by knt47

User metadata
Rank Newbie
Rank
Newbie

I would like to announce the new version of my program, which is now a TIM Level viewer.
Of course, the most important new feature is that it can open the level files from
all DOS versions of the game, as well as from TIM 3 (which is a Windows game).
The full list of supported versions: TIM (including demo version), The Even More Incredible
Machine TEMIM (plus its demo), TIM 2 (plus demo version), TIM 3. It can also open
saved "freeform machines" and puzzles from all tested game versions.

Note that this is just a level viewer, not an engine re-implementation, the levels
are not playable. But at least, I now understand the structure of the level
file format of these games (as well as a few others). I have uploaded
the file format documentation to ModdingWiki:

https://moddingwiki.shikadi.net/wiki/The_Incr … ne_Level_Format

As this is basically en extended version of my previous image resource viewer,
it supports all file formats present in the old version.

The program was written in Python and supports versions 3.6 and newer. It was
designed to run on the default installation of Python for Windows (that is,
installers downloaded from python.org). It has no other dependencies (however, this
should not be confused with the extra modules/source files discussed in the following posts.)
It also runs on Linux after installation of the required Tk GUI package
(usually python3-tk, but the name of the package may vary between distributions)

The program is available under the Creative Commons Zero license (essentially, public domain).
However, the "extra" files (will be uploaded in a next post soon) are currently provided as "fair use" to avoid
potential copyright problems.

Note :The program can also show the "solution" of puzzles, especially in TIM 2 and 3. However the solutions are not shown by default
This feature must be enabled in the "Options" dialog ("Solution for puzzles"). See the readme.txt found in the uploaded ZIP archive.
file in the source code ZIP file for more information. I also recommend to read the comments there about the limitations of this feature for TIM and TEMIM levels.

The program has an another limitation related to the "knot" graphics at the ends of ropes in the "original" TIM. In this version, graphics file is not present in the archive file
of the game in any known file format, probably it is stored in the .EXE of the game. The program contains a simple workaround for this, namely to use the corresponding file form the demo version of TEMIM. This requires a simple "installation" process, see the readme.txt file.

Update: (13 Aug 2022):
The TIM level/image viewer is now hosted on Codeberg: https://codeberg.org/knt47/timgres. The 0.2C release there is identical to the 0.2 version, the only difference is the addition of a README.md file.
The "extra" files (mentianed above) are not part of the Codeberg release (due to potential copyright issues). These files are still available in the next post on this forum under a "fair use" license.

Last edited by knt47 on 2022-08-13, 07:12. Edited 1 time in total.

Reply 6 of 8, by knt47

User metadata
Rank Newbie
Rank
Newbie

Due to copyright reasons, I have decided to distribute two files required for the TIM Level Viewer separately, under a "fair use" like license. These Python module files are not present in the CC0 licensed Python package (precious post). See the attachment below. The files must be installed in the timgres/extra subdirectory.

Note 1: The data contained in these is not from disassembly or decompilation of any game versions, but from careful analysis of many screenshots and resource files (level, image, etc.) from the game.

Note 2: The new version of the program is not compatible with the "extra modules package" for the previous version of the program (found in a previous post in this topic).

Reply 7 of 8, by Nyerguds2

User metadata
Rank Newbie
Rank
Newbie
knt47 wrote on 2022-07-22, 20:51:

Thanks, Nyerguds for the additional reverse engineering work for the TIM image format. It helped me a lot to fix a bug in the image decoder code.
Sorry for the very late reply.

Happy to help. I'm glad to see you digging further into these games 😀

Expert on all things Command & Conquer 1 related, creator of the C&C95 v1.06 patch, contributor and tester on the official C&C Remastered project.
(Ignore the '2' in the name 😩)

Reply 8 of 8, by alberthamik

User metadata
Rank Newbie
Rank
Newbie

Is there by chance any plans to dig into the two Contraptions games? Seeing as they're "basically" the TIM 2/3 engine stuff with an overhauled frontend, I am making an assumption the only hurdle would be if they changed how graphical assets worked. I remember ages ago being able to play TIM 3 maps in Contraptions just fine, as an example. As far as I'm aware, the only past effort for extracting Contraptions stuff was the containers for music and audio.