Basic playership mod

Freeform discussion about anything related to modding Transcendence.
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

Does anyone know of a simple mod that re-creates the three vanilla playerships using the existing resources (that is, without adding a new Resources folder)? I've been checking my code against the Transcendence xml and against other playership mods, but I want to make sure I've gotten everything right.

Thanks if you can help - and to everyone who's worked so hard on these great mods!

[Note: I originally posted this on the wrong forum category, so I deleted and re-posted here.]
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

 If there is such a mod on Xelerus, it probably hasn’t been updated recently enough to be entirely useful. While the source code for 1.6b5 is available on Xelerus and the playership files are easy enough to find, the trick is that George splits the playership code up into two separate files. This isn’t, strictly speaking, necessary, and most playership mods won’t do it.
 Instead, let me just post the code for a Sapphire-class yacht playership. It’s been very slightly streamlined from the vanilla Sapphire for clarity, but it has all of the essential elements you’ll need.

Code: Select all

	<ShipClass UNID="&scModdedSapphirePlayerShip;"
			manufacturer=		"Zubrin Systems"
			class=				"Sapphire"
			type=				"yacht"

			attributes=			"00200000_PlayerShip"
			characterClass=		"&unidPilgrimClass;"
			   
			size=				"31"
			mass=				"30"
			thrustRatio=		"6.6"
			maxSpeed=			"20"
			cargoSpace=			"50"

			reactorPower=		"150"
			fuelCapacity=		"37500"
			maxArmor=			"6000"
			maxCargoSpace=		"150"
			maxDevices=			"8"
			>

		<!-- Configuration -->
		
		<Armor
			armorID=			"&itReactiveArmor;"
			count=				"4"
			/>
		
		<Devices>
			<DeviceSlot criteria="w" posAngle="0" posRadius="20"/>
			
			<Device deviceID="&itRecoillessCannon;"/>
			<Device deviceID="&itClass1Deflector;"/>
			<Device deviceID="&it15MWReactor;"/>
		</Devices>
		
		<Maneuver
			maxRotationRate=	"9.0"
			rotationAccel=		"1.5"
			rotationStopAccel=	"9.0"
			/>

		<Items>
			<Item count="4d6" item="&itHelium3FuelRod;"/>
		</Items>

		<!-- Image and Effects -->
		
		<Image imageID="&rsSapphireYachtHD;" imageX="0" imageY="0" imageWidth="48" imageHeight="48"	rotationCount="120"/>
		
		<Effects>
			<Effect type="thrustMain"		posAngle="160"	posRadius="7"	posZ="0"	rotation="180"	bringToFront="*"/>
			<Effect type="thrustMain"		posAngle="-160"	posRadius="7"	posZ="0"	rotation="180"	bringToFront="*"/>
		</Effects>
	
		<!-- AI and Behavior -->
		
		<AISettings
			fireRateAdj=		"30"
			fireAccuracy=		"90"
			perception=			"4"
			/>
		
		<!-- Player Settings -->
		
		<PlayerSettings
			desc=				"The versatile Sapphire yacht strikes a good balance between a gunship and a freighter."
			largeImage=			"&rsZubrinLarge;"
			initialClass=		"true"
			startingCredits=	"10d100+1500"
			>

			<ArmorDisplay>
				<ShipImage imageID="&rsArmorHUDShip_Sapphire;" imageWidth="136" imageHeight="136"/>
				
				<ArmorSection name="forward"
						segment="0"
						imageID="&rsZubrinArmor;" 
						imageX="0" imageY="0" imageWidth="52" imageHeight="29"
						destX="42" destY="15" hpX="55" hpY="14"
						nameY="8" nameBreakWidth="200" nameDestX="0" nameDestY="10" />

				<ArmorSection name="starboard"
						segment="3"
						imageID="&rsZubrinArmor;" 
						imageX="52" imageY="0" imageWidth="22" imageHeight="59"
						destX="92" destY="45" hpX="95" hpY="60"
						nameY="30" nameBreakWidth="360" nameDestX="12" nameDestY="0" />

				<ArmorSection name="port"
						segment="1"
						imageID="&rsZubrinArmor;" 
						imageX="142" imageY="0" imageWidth="22" imageHeight="59"
						destX="22" destY="45" hpX="15" hpY="60"
						nameY="52" nameBreakWidth="200" nameDestX="0" nameDestY="8" />

				<ArmorSection name="aft"
						segment="2"
						imageID="&rsZubrinArmor;" 
						imageX="74" imageY="0" imageWidth="68" imageHeight="14"
						destX="34" destY="103" hpX="55" hpY="105"
						nameY="74" nameBreakWidth="360" nameDestX="12" nameDestY="0" />
			</ArmorDisplay>

			<ShieldDisplay shieldLevelEffect="&efShieldHUDDefault;">
			</ShieldDisplay>

			<ReactorDisplay>
				<Image imageID="&rsZubrinReactor;" 
						imageX="0" imageY="0" imageWidth="256" imageHeight="60"/>

				<PowerLevelImage imageID="&rsZubrinReactor;"
						imageX="0" imageY="60" imageWidth="202" imageHeight="14"
						destX="54" destY="9"/>

				<FuelLevelImage imageID="&rsZubrinReactor;"
						imageX="0" imageY="74" imageWidth="194" imageHeight="14"
						destX="54" destY="37"/>

				<FuelLowLevelImage imageID="&rsZubrinReactor;"
						imageX="0" imageY="88" imageWidth="194" imageHeight="14"/>

				<ReactorText x="62" y="22" width="154" height="14"/>
				<PowerLevelText x="62" y="0" width="154" height="9"/>
				<FuelLevelText x="62" y="51" width="154" height="9"/>
			</ReactorDisplay>
			
			<WeaponDisplay>
				<Image imageID="&rsZubrinTargeting;" imageX="0" imageY="0" imageWidth="360" imageHeight="120"/>
			</WeaponDisplay>
		</PlayerSettings>
	</ShipClass>
 I hope this is helpful. ^.^
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
User avatar
Xephyr
Militia Captain
Militia Captain
Posts: 857
Joined: Fri Dec 14, 2007 1:52 am
Location: Orion Arm, Milky Way
Contact:

My mod "D&O ships" does this, but it needs to be updated to use the new dockscreen GUI.

http://xelerus.de/index.php?s=mod&id=1462
Project Renegade (Beta) : "The Poor Man's Corporate Command!"
Real programmers count from 0. And sometimes I do, too.
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

AssumedPseudonym wrote:While the source code for 1.6b5 is available on Xelerus and the playership files are easy enough to find, the trick is that George splits the playership code up into two separate files. This isn’t, strictly speaking, necessary, and most playership mods won’t do it.
 Instead, let me just post the code for a Sapphire-class yacht playership.
Thanks for posting the code! It had taken me hours to figure out on my own that I had to look at both StdPlayerShips.xml and PlayerShips.xml, so I probably should have just posted and asked. But using this code pulls up the old dockscreens, which is curious. How does the game know to use the new dockscreens? I tried using the new XML from 1.6.1 using TransData and got the same results.

I downloaded and tried one of the newer ship mods, the Sapphire/X (http://xelerus.de/index.php?s=mod&id=1433), which does use the new dockscreens. It seems to specify the new dockscreens here:

Code: Select all

		<PlayerSettings
			desc=				"A Sapphire-class with some special modifications. This ship gets  high performance at the cost of one deviceslot."
			largeImage=			"&rsSapphireXLarge;"
			initialClass=		"true"
			startingCredits=	"10d100+1500"
			dockServicesScreen=	"&dsRPGDockServices;"
			shipConfigScreen=	"&dsRPGDockServices;"
			>
Unfortunately, adding that code to the XML from TransData pulls up the new dockscreens, but the armor segments are in the wrong order. That is, clicking on the top segment in the dockscreen does not replace the top armor segment on the shields/armor display in the bottom right-hand corner of the main screen. It replaces a different armor segment.

I think the problem may be in the TransData XML here:

Code: Select all

      <Armor
         armorID=         "&itReactiveArmor;"
         count=            "4"
         />
There are four segments of reactive armor, but this code doesn't specify where each segment is located on the ship. Replacing the code above with the code from the Sapphire/X mod solves the problem:

Code: Select all

		<Armor>
			<ArmorSection start="315" span="90" armorID="&itReactiveArmor;" areaSet="0,2" />
			<ArmorSection start="225" span="90" armorID="&itReactiveArmor;" areaSet="3,4" />
			<ArmorSection start="45"  span="90" armorID="&itReactiveArmor;" areaSet="7,13" />
			<ArmorSection start="135" span="90" armorID="&itReactiveArmor;" areaSet="1,6" />
		</Armor>
The problem for me is that I don't know exactly _how_ it solves the problem. Do all the graphical displays of armor in the game, including the dockscreen, look at the start and span angles to figure out how to treat each segment? If so, how come the game doesn't do this correctly automatically when the code from the TransData XML is used? And somewhat more disturbingly to me, shouldn't the TransData XML work? Where is the game getting its information if not from the compiled version of the XML?

Thanks if you can help a clueless person with these questions. I appreciate everything this community is doing for new people like me!
Last edited by gunship256 on Tue Aug 04, 2015 5:47 am, edited 1 time in total.
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

Xephyr wrote:My mod "D&O ships" does this, but it needs to be updated to use the new dockscreen GUI.

http://xelerus.de/index.php?s=mod&id=1462
Thanks for posting a link to your mod, Xephyr. I've actually used it before but never thought (hard head!) to use it as example code for a playership.
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

gunship256 wrote:The problem for me is that I don't know exactly _how_ it solves the problem. Do all the graphical displays of armor in the game, including the dockscreen, look at the start and span angles to figure out how to treat each segment? If so, how come the game doesn't do this correctly automatically when the code from the TransData XML is used? And somewhat more disturbingly to me, shouldn't the TransData XML work? Where is the game getting its information if not from the compiled version of the XML?
 The long format allows you to specify which armor segment is where, whereas the condensed version of the armor code starts at the forward segment and works its way around the ship counterclockwise. It’s caused problems often enough that I actually use the long version of the code, myself. It was introduced in 1.2, and actually had the armor HUD showing hits on the wrong segment through at least 1.3, at which point I noticed and reported it (and it may or may not still be a problem; it’s been a while since I’ve checked on it). I should have thought to fix that in the code I posted. My bad.
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

AssumedPseudonym wrote:The long format allows you to specify which armor segment is where, whereas the condensed version of the armor code starts at the forward segment and works its way around the ship counterclockwise. It’s caused problems often enough that I actually use the long version of the code, myself. It was introduced in 1.2, and actually had the armor HUD showing hits on the wrong segment through at least 1.3, at which point I noticed and reported it (and it may or may not still be a problem; it’s been a while since I’ve checked on it). I should have thought to fix that in the code I posted. My bad.
Ah - that's very helpful to know. Thanks! The only reason I noticed it is that I did a full permadeath playthrough using the mod and had to install armor multiple times.

I'm still curious to know how the game knows to use the new dockscreens when the XML code isn't telling it to (and yet it doesn't default to the new dockscreens for mod playerships). The bug you mentioned also seems to be automatically fixed for the vanilla playerships, but not for mod playerships. Is there something obvious I'm missing?

Thanks again for all of your help!
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

gunship256 wrote:I'm still curious to know how the game knows to use the new dockscreens when the XML code isn't telling it to (and yet it doesn't default to the new dockscreens for mod playerships). The bug you mentioned also seems to be automatically fixed for the vanilla playerships, but not for mod playerships. Is there something obvious I'm missing?
 I’m kind of sketchy on specifics, but I think the game defaults to the new dockscreens if the mod’s API is above a certain version unless the mod expressly specifies otherwise.
 As for mod playerships and armor placement, I remember beating my head against a wall on that for a while and never finding an actually good solution. It’s why I reverted to the long format.
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
AdmiralZo
Militia Lieutenant
Militia Lieutenant
Posts: 228
Joined: Wed Feb 11, 2015 10:32 am
Location: Scouring Dantalion System for CSC Antarctica...

When modding a ship with 12 armour sections and with compartments, is there an advantage to specifying where each segment is? Or is it ok to use the shorter technique?
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

AssumedPseudonym wrote:I think the game defaults to the new dockscreens if the mod’s API is above a certain version unless the mod expressly specifies otherwise.
OK - that makes sense for backward compatility with older mods.

It sounds like I need to add an attribute to the TranscendenceExtension tag, like this?

Code: Select all

ApiVersion=	"27"
Is there a reference somewhere that describes the difference between different versions of the API that I can read?
User avatar
AssumedPseudonym
Fleet Officer
Fleet Officer
Posts: 1190
Joined: Thu Aug 29, 2013 5:18 am
Location: On the other side of the screen.

gunship256 wrote:Is there a reference somewhere that describes the difference between different versions of the API that I can read?
 I don’t think there’s a compiled list of them anywhere, no. George usually posts a link to the changes with each new release of the game. Your best bet is probably going to be to sift through the Announcements forum for his new version posts. Of course, if you’re feeling really ambitious, the Modding Reference forum would be a perfect place to put an API version changelog.
Image

Mod prefixes: 0xA010 (registered) and 0xDCC8 (miscellaneous)

My mods on Xelerus: Click here!

Of all the things I’ve lost in life, I miss my mind the least. (I’m having a lot more fun without it!)
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

Setting apiVersion = "25" seems to have eliminated the bug with the armor dockscreen UI. Thanks for helping me understand what to do!

For some reason, setting apiVersion = "27" causes a problem when Transcendence 1.6.1 loads the mod. Transcendence tells me that the entities from the code I pasted in from the XML are invalid. I'm not sure what the problem is exactly, since I didn't declare the entities myself, and the problem only exists if I set apiVersion to 26 or 27.

Other than that, I've finished putting the mod together for the three basic playerships, and the ships seem to function exactly like the originals. I've attached a copy of the mod here; hopefully, someone can point out if I've made any more mistakes. Eventually, I'd like to upload this to Xelerus to keep other people from having to figure out the same issues.

[Edit: fixed a bug with my entity declarations and am re-posting. It doesn't solve the problems described in the paragraph above, though.]
Attachments
Basic Playerships.xml
(16.36 KiB) Downloaded 160 times
gunship256
Militia Commander
Militia Commander
Posts: 451
Joined: Sat Jul 25, 2015 11:41 pm
Location: repairing armor

AdmiralZo wrote:When modding a ship with 12 armour sections and with compartments, is there an advantage to specifying where each segment is? Or is it ok to use the shorter technique?
It looks like setting apiVersion = "25" solved the UI problem for me, so I'm using the shorter version now.

I imagine that using the longer technique is important for ships that have unique angles for their armor plating, such as the Manticore. This tutorial goes into some detail about halfway down about how that works, although I haven't tried it myself.

https://transcendence.kronosaur.com/gui ... exm?id=938
AdmiralZo
Militia Lieutenant
Militia Lieutenant
Posts: 228
Joined: Wed Feb 11, 2015 10:32 am
Location: Scouring Dantalion System for CSC Antarctica...

I imagine that using the longer technique is important for ships that have unique angles for their armor plating, such as the Manticore.
Yeah, I guess that is when you would use it. Thanks for the tutorial! :D
User avatar
pixelfck
Militia Captain
Militia Captain
Posts: 571
Joined: Tue Aug 11, 2009 8:47 pm
Location: Travelling around in Europe

Of interest:

Transcendence 1.5 Beta specs
pay attention to the: Dock Services Screen -> Modding Considerations for info on the new/old dockscreen behaviour.

~Pixelfck
Image
Download the Black Market Expansion from Xelerus.de today!
My other mods at xelerus.de
Post Reply