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: 438
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.
EDIT: From October 17 unofficial mods can be downloaded from the Multiverse website. (This will replace the xelerus.de website which is no longer maintained but still works.) These mods are in .tdb format and will decompile the same way as other .tdb files. Just make sure you have Transdata.exe and Decompile.bat in the same folder as the mod(s).

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: .
EDIT: And sjf found another topic with decompiling info. http://forums.kronosaur.com/viewtopic.p ... 546#p72546
Also the .bat file has been updated, thanks to Ferdinand's helpful suggestion in the post further down, to avoid a possible glitch.
Attachments
Decompile.zip
(180 Bytes) Downloaded 7 times
Last edited by relanat on Sun Oct 08, 2017 2:05 pm, edited 2 times in total.

Norgath
Anarchist
Anarchist
Posts: 5
Joined: Mon Oct 02, 2017 8:00 am

Wed Oct 04, 2017 1:51 pm

Thank you and bless you for this post that shows you how to decompile tdb files.

shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1405
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska

Fri Oct 06, 2017 9:06 am

Oddly enough there is a difference here between the code I got from the forum & what has been posted in the "Decompile" file offered here.

Code I use was obtained : http://forums.kronosaur.com/viewtopic.p ... 546#p72546

Code: Select all

FOR %%A IN (*.tdb) DO TransData /decompile /dataFile:%%A
Code in file offered by the relanat

Code: Select all

FOR %%C IN (SET *.tdb) DO TransData.exe /decompile /datafile:%%C
I have not used the file offered here, the one I have already did the work I wanted.

However, I am sure, since it is Relanat, it's a good file.
I was just pointing out something I noticed.

which-ever code works best for you using the instructions and advisories in the forums for these .bat file uses ,
I do hope your Imagination and Inspiration runs wild and vents itself into creative additions to our universe.
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..

relanat
Militia Commander
Militia Commander
Posts: 438
Joined: Tue Nov 05, 2013 9:56 am

Sun Oct 08, 2017 1:26 am

No thanks necessary, Norgath. I was frustrated at trying to find the decompiling info scattered over the forum every time I wanted to decompile a file. When I found that Decompile.bat file I wanted to make sure everyone could find it. It is sooo much easier using it than using command line code. So I did a topic which included everything I could find on decompiling to reduce the frustration of others.

Well spotted, sjf. Both lots of code work. But I have absolutely no idea about the code itself. Its in a language I don't understand. I've added your link to the OP. Thanks.

Ferdinand
Militia Lieutenant
Militia Lieutenant
Posts: 125
Joined: Mon Feb 23, 2015 2:35 pm
Location: Dancing in the universe
Contact:

Sun Oct 08, 2017 9:50 am

Both codes are essentially the same. However Relanat's code will behave different when a file named SET is also available. It will probably fail unless that file can be decoded.

Windows treats everything between the ( ) in the FOR command as a file specification. If the file is not there it is ignored, if the file exists the command after DO will be executed, I think the SET in Relanat's code should be removed.

Post Reply