How to decompile the Source code for modding

This is a moderated forum that collects tutorials, guides, and references for creating Transcendence extensions and scripts.
Post Reply
relanat
Militia Commander
Militia Commander
Posts: 385
Joined: Tue Nov 05, 2013 9:56 am

Tue Mar 14, 2017 2:29 am

OK, so you want to start modding. Great, it's good fun.

One of the things you'll need is called the source code. This is a whole heap of .xml files which contain the code that makes the game do stuff. (Note that there is also game engine code which is hardcoded into Transcendence and cannot be changed by modding. You'll learn more about this as you mod.)

If you go into your Transcendence game folder you will see a file called Transcendence.tdb

Any of the official Transcendence games or extensions will come in .tdb form. Mods that you download from xelerus.de will usually be in .xml format.

The .tdb file is just a condensed form of all the game .xml files. To get them into .xml format which we can modify when modding we do what is called decompiling.

Decompiling is done with a file called Transdata.exe. It is available here http://transcendence.kronosaur.com/guid ... =transData and comes as a .zip file. Note that there is a different version of Transdata for each game version. ATM there is no index that I know of that tells you which version of Transdata to use but if you are just starting modding download the current Transdata version to decompile the current game version 1.7.

There are a number of ways to use Transdata. By far the easiest IMO is to use a .bat file which was originally posted by PKodon (bless you, PK) and also reposted by AP and linked by NMS (bless you two, too). EDIT: Make that reposted by digdug, AP added the Linux version. (insert digdug blessing!)

The file, I call it Decompile.bat, is attached at the bottom of this post in a zip file. Download it and save it in a number of places because you'll be amazed how often you end up using it.

To use it, extract Decompile.bat into the Transcendence game folder or if you already have it extracted from the zip file just copy it into the folder.

Then extract Transdata.exe into the same folder (or just copy it into the folder if you already have it extracted from the .zip file). If you are extracting it you will probably get a message saying that there is already a Readme.htm file there and do you want to replace it. Click yes, it makes no difference to what we are doing. Now you will have Transdata.exe and TransCompiler.exe in the folder as well. We won't be using TransCompiler.exe but it can stay there without affecting the decompiling process.

So to get the game to decompile we need three files in the same folder. You must have the .tdb file, in this case Transcendence.tdb, Transdata.exe and Decompile.bat. Note that Transdata.exe and Decompile.bat must be in the same folder as the .tdb file you want to decompile.

All you do now is double-click on Decompile.bat. You will get a black command line window appear with a whole heap of file names whizzing down it faster than you can read them. Sit back and enjoy the show. It will only take a few seconds.

Eventually the black window will disappear and, possibly with a delay of another second or two, a folder called Transcendence_Source will appear in your game folder. This is the source code that is talked about by modders.

Opening the folder will show you a folder called Resources, which contains all the images and sounds used in the game, and over 100 .xml files which contain the XML and TLisp code that is used by modders. Enjoy. Let the fun begin!

=================================

OK. That is how you get the source code for Stars Of The Pilgrim (aka Part 1). Chances are you also have some of the official extensions (this is jargon for other additions to the game) like StarsOfThePilgrimHD and the Osaka playership These also come in .tdb format and are found in the Collections folder inside the Transcendence folder. To decompile these we do exactly the same thing.

Note that Decompile.bat will decompile every .tdb file that is in the same folder. So if you have, for example, the Osaka playership files OPS_ExtOsaka.tdb and OPS_LibResOsaka.tdb as well as StarsOfThePilgrimHD.tdb in your Collections folder all three will be decompiled. You don't have to run Decompile.bat three times. Just make sure you have both Decompile.bat and Transdata.exe in your Collections folder and double-click Decompile.bat. The same whizzing lines will scroll down the black window and after that finishes you will have three new folders in your Collections folder. One will be called OPS_ExtOsaka_Source, the next one OPS_LibResOsaka_Source and finally StarsOfThePilgrimHD_Source.

As a quick summary, any tdb file you want to decompile, just put Transdata.exe and Decompile.bat into the same folder as the .tdb file. Double-click Decompile.bat and a folder with a name ending in _Source will appear and have the files in .xml format (and any images).

There are a few other ways to get the source code. It can (sometimes) be found at xelerus.de. Doing a search for mods with the name Source will let you know if the current version has been uploaded there. But xelerus.de has a limit on the size of uploaded files so typically the Resources folder isn't included with the .xml files (although the Resources folder is sometimes linked at an off-site file storage somewhere).

You can also manually decompile Transcendence using command line code to run Transdata.exe. See this topic for how to do that. https://forums.kronosaur.com/viewtopic.php?f=8&t=1129
Note that this only works for Transcendence.tdb.

To manually decompile other .tdb files you will need to use the file name in command line code. See these topics for the format of how to do that.
https://forums.kronosaur.com/viewtopic.php?f=5&t=6677
https://forums.kronosaur.com/viewtopic.php?f=5&t=7899

Note that command line code is finicky, pedantic and very frustrating to use. It may take a couple of goes to get it working right. Spacing, format and syntax are very important, as is using the right 'slash'. (This is why I think sainthood is a fitting reward for PKodon for posting the .bat file!)

And finally the source code is also available on github. Here's the link https://github.com/kronosaur/Transcende ... /TransCore
Thanks to xephyr for that info (Yep, you get a bless you as well).

And could someone post the equivalent Linux file, please.

EDIT: It also helps if I attach the file :lol: .
Attachments
Decompile.zip
(184 Bytes) Downloaded 10 times

Post Reply