basic overwriting mod

Freeform discussion about anything related to modding Transcendence.
Post Reply
Militia Captain
Militia Captain
Posts: 546
Joined: Tue Nov 05, 2013 9:56 am

Wed May 30, 2018 3:00 am

A tutorial containing really basic info on how to create a mod so you can change simple things in the game. You will need game version 1.8a4a, 1.8b1 or higher. Check the forum for a download link.

Here's how!

Open the Transcendence game folder. This is the folder that contains Transcendence.exe and Transcendence.tdb. Create a new folder and rename it as "Extensions" (without the quotes).

Download the file BasicModOutline.xml which is attached to the end of this post. Copy this file into the Extensions folder.

Next you will need a text editing program. You can use Notepad but I would recommend you try NotePad++, jEdit or Sublime Text. These are upgraded text editing programs that make modding easier.

Open the BasicModOutline.xml file with the text editing program.
The image below shows what will appear.

The first line

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
is computer stuff that we don't have to worry about. It is in every xml file, sometimes without the encoding part.

The next 4 lines

Code: Select all

<!DOCTYPE TranscendenceExtension
<!ENTITY unidShortModDescription	"0xD7890000">
tells the game that we want to alter something in the game. In this tutorial we will change the name of a station in Part 1:Stars Of The Pilgrim.

'unidShortModDescription' is called a UNID, which I think is a short form of UNique IDentifier. The game uses UNIDs for pretty much everything. When the game sees this it will remember the code in this mod by using this UNID.
The number part "0xD7890000" is the same UNID as 'unidShortModDescription' but in a hexadecimal format. The game sees both of these as exactly the same.
Numbers starting with '0xD789' have been allocated to me for creating mods. All my mod UNIDs are prefixed with '0xD789' but I'm not using this one so we'll use it here. If you want to create more mods go to the forum and you can ask for a number to be allocated to you.

The next section sets out basic information for the mod.
The first line is the 'UNID'. This is exactly the same as the UNID in the ENTITY section above and it must be the same or we will get an error. Note that in this section it has '&' before it and ';' after it. All UNIDs in this section of the mod must have these as we will see later.
'apiVersion' determines a couple of things but mainly which versions of Transcendence the mod will work in. API 39 means this mod will work in all game versions from 1.8a4a and higher. The Centauri station code changed in version 1.8a4a so this mod won't work in version 1.8a3 or lower.
'name' is fairly obvious. It is the name of the mod which appears in the game start screen.
'version' can be used as you update your mods to keep up with changes in the game or when you add more features. It helps players know when to redownload your mod because it has been improved.
'release' isn't important here and it can be left as '1.00' in all of your mods.
'credits' let's everyone know who created the mod. Put your username in here.

Note that all of these values start and end with double quotes. This is necessary and if a quote is missing we will probably get an error.

Also notice that this block of code starts with '<TranscendenceExtension' and ends with '>'. This is the opening section of the mod.
The last line of code is '</TranscendenceExtension>'. Note the backslash '/' second in the line of code. This makes it the closing line of the mod and this must be the bottom line of code in the mod or we will get an error.

That is the basics of a mod. We can start a game and we will be able to select the mod called "Mod Name" and play a game. But the mod doesn't do anything yet so now we'll add some code to change something.
ModOutlineText.JPG (67.17 KiB) Viewed 68 times
(349 Bytes) Downloaded 5 times
Last edited by relanat on Sat Jun 02, 2018 1:17 am, edited 1 time in total.

Militia Captain
Militia Captain
Posts: 546
Joined: Tue Nov 05, 2013 9:56 am

Wed May 30, 2018 3:04 am

In this section we will change the name of the Centauri Warlord camps in Stars Of The Pilgrim to 'Evil bad guy station'. Not very creative, I know, but we will be able to see the change quickly and easily in Eridani.

Firstly we will change the UNID to give a better idea of what we are doing.
Delete 'ShortModDescription' from the ENTITY UNID. Replace it with 'CentauriCampRename' so it ends up as 'unidCentauriCampRename'.

Now do the same to the UNID line in the opening section of the mod. Remember that both of these must be identical and the second one must have '&' and ';' before and after it. Also make sure that the second one still has double quotes at the beginning and end.

A name change would also be good so we change 'Mod Name' to 'Centauri Camp Name Change'.

Next, because we are changing something in Stars Of ThePilgrim we need to add a library. The reasons for this are beyond the scope of this tutorial but if we don't add this we can't modify the Centauri Stations.
So we add the line of code

Code: Select all

<Library UNID="&unidHumanSpaceLibrary;"/>
As a general rule, include this line of code in all your mods which are intended for Stars Of The Pilgrim.

Next we will add the standard game code that creates the Centauri camps. This can be found in the game files but they need to be decompiled first. Go to this topic, and follow the instructions. The end result will be a folder called 'Transcendence_Source' in the Transcendence game folder where your Extensions folder is.

Inside the 'Transcendence_Source' folder is a file called CentauriWarlords.xml.
This file contains the code for the Centauri camps. In game version 1.8b1 it starts on line 781 and finishes on line 827. We copy and paste the entire UNID from '<StationType UNID="&stCentauriCamp;"' down to '</StationType>' into our mod file. This code must be placed under the 'Library UNID' but above the closing line '</TranscendenceExtension>'.

I've included the code here to make it easier.

Code: Select all

	<StationType UNID="&stCentauriCamp;"
			name=				"Centauri warlord camp"
			sovereign=			"&svCentauriWarlords;"
			abandonedScreen=	"&dsAbandonedStation;"
			dockingPorts=		"8"
			canAttack=			"true"

			armorID=			"&itLightPlasteelPlate;"
			hitPoints=			"50"
			fireRateAdj=		"80"
			explosionType=		"&vtKineticExplosion1;"
			ejectaType=			"&vtWreckEjecta;"

			attributes=			"centauriWarlords, enemy, envWater, envAvoidsEarth, generic, human, populated, warlords"
			levelFrequency=		"crv-- ----- ----- ----- -----"
			locationCriteria=	"+outerSystem, +planetary"

		<Image			imageID="&rsCentauriStationsImage;" imageX="24" imageY="0" imageWidth="80" imageHeight="128"/>

			<Device deviceID="&itCentauriRecoilless;" posAngle="90" posRadius="50" omnidirectional="true"/>

				<Ship chance="30"	count="1d4+1"	class="&scCentauriRaider;"			orders="guard"/>
				<Ship chance="60"	count="1d3+2"	class="&scCentauriRaider;"			orders="guard"/>
				<Group chance="10">
					<Ship			count="1d4"	class="&scCentauriRaider;"			orders="guard"/>
					<Ship			count="1"	class="&scCentauriHeavyRaider;"		orders="guard"/>

			<Group	value="standard:level=1:x=0.8">
				<Item	chance="80" count="1d6" item="&itCentauriRice;"/>
				<Lookup	chance="50"				table="&trStdTreasure;"/>

		<Encounters frequency="uncommon">
			<Lookup table="&tbCentauriEncounters;"/>

Now we change the name.
The second line of code in the Centauri StationType UNID is

Code: Select all

name=		"Centauri warlord camp"
We change this to

Code: Select all

name=		"Evil bad guy station"
and save the file. Note that we must save the file or we won't see any changes in the game.

That's it. We can start a game now and as we fly around and find a Centauri camp we see it now has a different name.
Well done, you are now a modder!

This is called modding by overwriting because of the order in which the game loads code. It loads all standard game code and then checks all mods. Because we have used the same UNID as the standard game, '&stCentauriCamp;' the game will use our code, which includes the name change, and overwrite the standard game UNID with our modified UNID.

I've also attached a version of the new file called CentauriNameChange.xml to show what the final mod looks like.
(1.91 KiB) Downloaded 4 times
NewStationName.JPG (45.85 KiB) Viewed 67 times

Post Reply