Skip to content

Instantly share code, notes, and snippets.

@bgK
Last active April 21, 2024 20:52
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgK/4889543f687a2dfc21992ea0c1615bac to your computer and use it in GitHub Desktop.
Save bgK/4889543f687a2dfc21992ea0c1615bac to your computer and use it in GitHub Desktop.
Myst III HD modding guide

Introduction

ResidualVM is gaining the ability to create mods for Myst III. It is possible to replace the original game assets with hi-resolution versions. This combined with the emergence of machine learning image upscaling tools enables the creation of a hi-resolution mod for Myst III.

I am releasing here a version of ResidualVM usable to create and play such a mod. However, graphics processing is not my forte. I need help from the community to figure out how to upscale the original assets to produce the best visuals and to put together a mod.

A HD mod has already been successfully completed for The Longuest Journey, another game supported by ResidualVM: https://tljhd.github.io/. Hopefully the the same feat can be replicated with the same quality for Myst III.

Example mod

I am providing here a proof of concept mod I've used to test the programming changes. This example mod is not meant to be pretty, nor to be used by regular players. It is not representative of the visual quality the final mod might have. It contains an upscaled version of most of the exterior of the J'nanin age and the English journals. It is meant to be used with the DVD version of the game.

Screenshots:

Downloads:

To try the mod, set ResidualVM up to play Myst III (https://github.com/residualvm/residualvm#4-running-myst-iii). Then uncompress the mod archive in the game folder, so the mods directory is at the same level as the Data and M3Data directories. Then run the game using the ResidualVM version from this post.

Modding guide

In this section I will succinctly explain how to create a simple mod. You can contact me for more details (by private message here or on the #myst IRC channel on libera.chat).

The first step is to configure ResidualVM for modding. Open the residualvm.ini file and perform the following changes (https://github.com/residualvm/residualvm#61-location-of-configuration-file):

  • Add enable_external_assets=true in your existing myst3 target section. This will cause ResidualVM to prefer loading files outside of the game archives.
  • Add debugflags=modding in the [residualvm] section. This will make ResidualVM to print the names of the external files it tries to open.

Next, extract the game archives to access the assets. To do so, open Myst III in ResidualVM, open the debug console using the ctrl-d keyboard shortcut and enter the dumpArchive LEISnodes.m3a command. This will create a dump folder containing the assets for the J'nanin exterior in the ResidualVM folder. There are a lot of files. You can use the log output of ResidualVM to match the files to their in-game use.

ResidualVM will now load the files from the dump directory instead of from the game archives if it can find them. It will look for files with the following extension in that order: .dds, .png, .jpg. This means it's possible to experiment very quickly. Modify the extracted files, go to the corresponding location in game and observe the changes.

Next the modded assets need to be prepared for packing. PNG files are fine to experiment with but are not suitable for distribution as they are bulky and slow to load. ResidualVM expects the images to be in DDS format to prepare the mod for distribution. It accepts uncompressed, BC1, BC2, BC3 and BC7 compressed DDS files.

For the example mod, I've used the following process:

Next the prepared assets can be packed into a mod archive. Open Myst III in ResidualVM and enter the modArchive LEISnodes.m3a command. This will pack the modified files from the dump directory into a LEISnodes.m3a.patch file created in the ResidualVM folder. This command takes a long time to run as it compresses some of the files. You can disable the compression to experiment quickly using the modArchive LEISnodes.m3a false command.

Finally, the mod is ready to be tested and distributed. Place the mod archive in a directory corresponding to the mod name in the mods directory in the game directory. Set enable_external_assets to false in residualvm.ini so the files are loaded from the mod archive instead of the dump folder.

The same process can be used to mod the following asset types:

  • Bink videos (The example mod replaces two of the Squee videos)
  • Cursors (Bitmap files in RSRC.m3r)
  • Inventory and font used in the load and save menus (.data files in RSRC.m3r, open as raw with The Gimp)

Note that there are some limitations:

  • The mod archives are limited to 4 GB. Generate multiple archives to work around the limitation.
  • Some of the videos will not display at the correct scale when they are loaded from the dump directory. They should play correctly once packed.
  • I have probably left behind a number of bugs :) Report them to me so I can fix them.
@MsSepeteus
Copy link

MsSepeteus commented Aug 20, 2023

hi, @bgK

I got the whole game tested with mods and didn't notice any issues. I woul'd say it's fully playable with mods.
Playlist: https://www.youtube.com/playlist?list=PL_VkzB24mavMDveb2hg8Iuyhrla6brOyD

Link to the mod if anyone is interested:
https://drive.google.com/drive/folders/19IyRy1E42udUgCAFYSvxGM0l-MOkuC7g?usp=sharing

The mod contains two sets of images and two sets of videos, all in separate contents if editing is needed.

Voltaic images: RealESRGAN_x4plus by pytorch
Tomahna J'nanin Amateria Edanna Narayan images: RealSR-ncnn-vulkan DF2K_JPEG

@tomdodd4598
Copy link

Amazing stuff @MsSepeteus :)

@MsSepeteus
Copy link

Thanks, @tomdodd4598

Did you test the mod, did you notice any bugs ?

@tomdodd4598
Copy link

@MsSepeteus haven't noticed any so far!

@Amarok87
Copy link

Amarok87 commented Apr 4, 2024

@MsSepeteus tremendous work!! Just finished playing it from start to finish and noted no issues, excerpt for a little one: when you first enter J'nanin main tusk and go at the nodes where the pages of the notebook are, two of the three visors in the room are open, not closed. I checked on the o.v. and the visors are closed.
Also I'm working on an Italian version of it, but I haven't found a way to extract videos from the mods to swap the audio. Any idea?
Thanks!

@MsSepeteus
Copy link

Thanks, @Amarok87

I didn't notice the whole visors thing, even though it was in my video too.
However, I compared the jpg dump and dds content inside LEOS.nodes, and they were identical.

I don't know proper way how to extract videos from patch nodes, but just copy that node to data dir and dump it.
eg. TOHOnodes.m3a to TOHOnodes.m3a.bak and TOHOnodes.m3a.patch to TOHOnodes.m3a
Restore Data dir before playing.

@Amarok87
Copy link

Amarok87 commented Apr 5, 2024

Thanks @MsSepeteus, it worked!

I noticed another thing: in TOHOnodes there's a video file named TOHO-11002 which isn't present in your mod files, so the game shows the low res version of it.

Working now on the italian audio files. I was wondering if adding all the audio streams to the files will work with the localization. I'll let you know.

@MsSepeteus
Copy link

Hi, @Amarok87

Thank you for pointing out that missing video. Can you inform me if you find more?
I'll update that mod archive later.

The main thing is @bgK's excellent HD-build, which makes things easy.

May I ask, are you going to use RAD tools for multitrack audio or do you have better muxer for bink files?

@Amarok87
Copy link

Amarok87 commented Apr 7, 2024

Hi @MsSepeteus

unfortunately I didn't find any other muxer for Bink videos, so I'm going through RAD tools. Good thing is that there are only 20-something videos to modify.
Adding all of the other languages to the video files is pretty easy, but I'm having an issue putting them in the dump folder: ResidualVM seems to ignore these Bink files. I also swapped the english audio with another language without doing multiaudio files but the issue persists. Modded images works fine instead. Did you encountered the same problem?

Thanks

@MsSepeteus
Copy link

Hi @bgK

Could you please check sometime when you have time that visors thing. It's present only in nodes leos 6 and leos 7.

Thank you in advance.

@MsSepeteus
Copy link

Hi @Amarok87

According to the tutorial residual engine loads only images not .bik files from dump dir. I never tried load anything from dump dir.
So rename dump dir and create new one with modded nodes and run "modarchive ####nodes.m3a false".(false disables packer)
Residual engine complains if there is mixed nodes or name errors.
Maby it's better to rename mods dir and create new one for testing.

I got gfpgan working with pytorch rocm, so now realesrgan can run with --face_enhance.
gfpgan can restore faces if you can recognize whose face are in picture but most of footage is totally out of quality.
Anyway, gfpgan looks promising and I'll remake some videos and update mods archive later.

@Amarok87
Copy link

Finally I managed to merge all the localized audio to the upscaled videos, everything seems to work smoothly. I updated the related *.patch files both in bink_1080p and bink_overlays.
I also upscaled italian journal entries and the rolling credits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment