Some help with playerships please?

Freeform discussion about anything related to modding Transcendence.
Kaama
Anarchist
Anarchist
Posts: 19
Joined: Sat May 11, 2019 11:17 am

I knew how to make playerships in 99c but now many things changed and data is scattered in many places.(I.e. i couldnt find where is code that makes manticore shields weaker)
So could somebody make a mod that would add 1 of Eternity port ships to basic game and also make it available to buy at comonswealth shipyards?. AND make a txt file with detailed desription ,step by step,of what he did and from where he took data. And post it on xelerus. Pretty please. That would be realy helpfull for many people in the future.
User avatar
Xephyr
Militia Captain
Militia Captain
Posts: 857
Joined: Fri Dec 14, 2007 1:52 am
Location: Orion Arm, Milky Way
Contact:

There have been some API changes since, but here's the playership mod template from a mod jam a while back, but it should at least be functional. Copy and paste it into an IDE or an editor like Notepad ++ with the formatting set to XML to see what are comments and what is code.

If you need graphics, I have some extras in this thread. The engine now supports .PNG graphics, so if you make new graphics you don't need to include a mask.: https://forums.kronosaur.com/viewtopic. ... sed#p73970

One of the changes since I wrote this template are the new HUD elements: https://forums.kronosaur.com/viewtopic. ... nts#p74695

Code: Select all

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE TranscendenceExtension
	[
	
	<!ENTITY scYourPlayership			"0xEDCB0001">
	<!ENTITY rsPlayershipImage			"0xEDCB0002">
	<!ENTITY rsYourLargeImage			"0xEDCB0003">

	]>

<TranscendenceExtension UNID= "0xEDCB0000" apiVersion= "28" name= "February 2016 Mod Jam" >

<!-- The very first thing you need to define is the Human Space Library for any extension that extends the base game. You’ll always call this unless your extension is has its own libraries. -->

<Library UNID="&unidHumanSpaceLibrary;"/>

<!-- Resource UNIDs just define what image to use - they’re called later on. Use the exact filenames of the image and its mask.-->

<Image UNID="&rsPlayershipImage;" bitmap="PlayershipImage.jpg" bitmask="PlayershipImage_mask.bmp" 	loadOnUse="true"/>
<Image UNID="&rsYourLargeImage;" bitmap="PlayershipLarge.jpg" bitmask="PlayershipLarge_mask.bmp" 	loadOnUse="true"/>

<!--
These fields are what make playerships unique. I’ve filled in the fields with the Saphhire-class Yacht’s attributes.

manufacturer=		Who manufactured the ship. This doesn’t have any effect in-game.
class=				The ship’s class. Defining anything here will have the ship name come out as "x-class type" - eg. Wolfen-class gunship.
type=				The type of the ship - eg. "gunship". If "class" is left undefined, then using this field will result in the name of the ship using just this field. 

attributes=			
characterClass=		These two fields are used by adventures to tell which ships they can use. For vanilla, they’ll always be the same.

size=				Size of the ship, from head to tail, in meters. Doesn’t have an effect in-game.
mass=				The ship’s mass, in tonnes. Playerships are usually 30-150 tonnes. This has some effect on the ship’s inertia.
thrustRatio=		Thrust to mass ratio. Determines how fast the ship accelerates.
maxSpeed=			The ship’s starting max speed, in percent of light speed. This is usually between 15-25.
cargoSpace=			Ship’s base cargo space, in tonnes.

reactorPower=		Base reactor power. This is used if you don’t define a reactor in the <devices> section.
fuelCapacity=		Reactor fuel capacity. Same as above.
maxArmor=			The maximum mass of armour that can be installed on the ship - 1000 = 1 tonne.
maxCargoSpace=		Maximum cargo space after being expanded

maxDevices=			Maximum amount of devices that can be installed on the ship.
maxWeapons=			Define this to limit the amount of weapons that can be installed, like on the EI500 freighter.
maxNonWeapon=		Define this to limit the amount of non-weapon devicess that can be installed, like on the Wolfen gunship.

-->

	<ShipClass UNID="&scYourPlayership;"
			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"
			drivePowerUse=		"20"
			maxArmor=			"6000"
			maxCargoSpace=		"150"
			maxDevices=			"8"
			>

		
<!-- 
Armor
armorID			The type of armour the ship starts out with.
count			The number of armour segments - eg. the Manticore uses 6 segments, rather than 4.
-->
			
		<Armor
			armorID=			"&itReactiveArmor;"
			count=				"4"
			/>
<!-- 
Devices
The devices the ship starts out with.
-->		
		<Devices>
			<Device deviceID="&itRecoillessCannon;"/>
			<Device deviceID="&itClass1Deflector;"/>
			<Device deviceID="&it15MWReactor;"/>
		</Devices>

<!-- 
Manueverability stats:
 maxRotationRate is how fast your ship turns
 rotationAccel is how quickly your ship reaches its maxRotationRate
 rotationStopAccel is how quickly your ship stops turning
-->				
		
		<Maneuver
			maxRotationRate=	"12.0"
			rotationAccel=		"3.0"
			rotationStopAccel=	"12.0"
			/>

<!-- 
Items the ship starts out with in the cargo hold.
"4d6" is a dice roll stat - that means the game will roll a six-sided die four times and add those values to determine how much fuel rods you start out with, in this case. You can substitute that with an integer if you want.
-->					
			
		<Items>
			<Item count="4d6" item="&itHelium3FuelRod;"/>
		</Items>

<!--
Image and Effects
This is where you define the image the ship uses in-game.
imageWidth		The width of each frame, in pixels.
imageHeight		The height of each frame, in pixels.
rotationcount	The number of frames the ship image uses. This will pretty much always be 120.

If your ship image is not a filmstrip-style image, but rather uses several columns, then you need to define rotationcolumns here, too
rotationcolumns= "12"
-->	
		<Image imageID="&rsPlayershipImage;" imageWidth="72" imageHeight="72" rotationCount="120" rotationcolumns= "12"/>
		
<!--
Thrust Effects
This can be hard to do if your ship render uses a strange projection or has odd engine placement.

type			Type of thrust effect. Don’t worry too much about this one.
posangle		An angle measured from a forward-facing bearing that indicates how the engine effect faces.
posradius		A line, measured in pixels, drawn from the center of the ship, that places where the thrust effect is.
posZ			The "height" of the image effect. You don’t need to worry too much about this, but you can experiment with positive and negative integers here.
rotation		The rotation of the engine effect. 180 means it’s facing directly away from the back of the ship.

-->			
		
		<Effects>
			<Effect type="thrustMain"		posAngle="180"	posRadius="7"	posZ="0"	rotation="180"/>
		</Effects>

<!--
AI and Behavior

This effects how NPCs handle the ship, and how it appears on the intro screen. No need to worry too much about this.

-->
		
		<AISettings
			fireRateAdj=		"30"
			fireAccuracy=		"90"
			perception=			"4"
			/>

<!--
desc=				Description of the ship, for the ship select screen.
largeImage=			The large image, for ship select.
initialClass=		Don’t worry too much about this.
startingCredits=	The credits the ship starts out with. Works as a dice roll or integer.
-->	
			
		<PlayerSettings
			desc=				"The versatile Sapphire yacht strikes a good balance between a gunship and a freighter."
			largeImage=			"&rsYourLargeImage;"
			initialClass=		"true"
			startingCredits=	"10d100+1500"
			>
<!--
HUD Elements 

I won’t touch too much on these here.

-->
			
			<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>

</TranscendenceExtension>
Project Renegade (Beta) : "The Poor Man's Corporate Command!"
Real programmers count from 0. And sometimes I do, too.
relanat
Militia Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 am

Kaama wrote: data is scattered in many places
You are right. It can take a bit of work to find all the info in the current game version!


Easy answer for the Manticore shield penalty.
The code looks like this:

Code: Select all

<DeviceSlot criteria="s">
	<EnhancementAbilities>
		<Enhance type=		"manticoreShieldPenalty"
			criteria=		"s -nonEnergyShields;"
			enhancement=	"-hpBonus:-20"
			/>
	</EnhancementAbilities>
</DeviceSlot>
It is in <ShipClass UNID="&scManticore;"> in 'CommonwealthShips.xml' in 'Transcendence_Source'. Line 1311.
This makes any normal shield in the shield slot lose 20% of its power; the "-hpBonus:-20" code takes away 20%.
If you don't want this to happen you could delete the code above and all Manticores in the game would have normal 100% shields. (There are a couple of ways to do this, if you would like more info let me know and I'll start a new topic explaining how).

If you look at the code for the Manticore playership in Corporate Command (&scManticorePlayer;, line 109 of 'PlayerShips.xml' in 'CorporateCommand_Source' there is no mention of shields. But the ship still loses 20% of its shield hp if you remove the Novaya armor repairer and install a standard shield. This is because the Manticore playership uses the "inherit" feature. Check line 115. It reads:

Code: Select all

inherit="&scManticore"
This means the playership UNID will use all the code that is in &scManticore;, it "inherit"s the code. This includes the <DeviceSlot> code above which is how the shield is reduced even though there is no code there.
The same happens with any other Manticore ships that inherit this code.


I've written a mod which adds the Demir playership, which is available from ship brokers in EP, to SOTP. It can be modified to add whichever ship broker playerships you like. https://forums.kronosaur.com/viewtopic.php?f=25&t=8797
The Demir doesn't appear very often though. In many games it doesn't appear for sale at all. If you wanted to guarantee the ship appearing in every game then different code will be needed.

Adding the starting playerships will be a bit harder if that was what you wanted. They will need more complex code.

Ammo for EP weapons is hard to find because the stations where it is normally sold don't occur in SOTP.
The large destroyers and cruisers, etc from EP pop-up everywhere but don't do anything except tell you everything is restricted.
And there are Dreaming Nexus stations and Dreaming Horde swarms in the Outer Realm.
But hopefully the code has been explained well enough so you can add whichever playerships you like.
Stupid code. Do what I want, not what I typed in!
Kaama
Anarchist
Anarchist
Posts: 19
Joined: Sat May 11, 2019 11:17 am

Thank You, You guys answered my questions in unexpected way, but its helpfull and i can learn what i need. I didint realy needed exactly same ship from EP with same gear it has there. I just wanted to see clearly inheritance mechanics and what causes those ships to appear in shipyards. But moving Hercules (6 armor pieces instead of 4) and evren(9 device slots and it resembles my beloved molotok in all aspects- powerfull, versatile ,but bit clumsy ) to the core game shipyards is good idea. I guess i will just have to add them to shipyard with your mod and also either override existig ones to give them SotP gear or create new ones with Sotp gear. http://forums.kronosaur.com/viewtopic.php?f=8&t=8800
thats link to inheritance topic.
Last edited by Kaama on Wed May 29, 2019 12:45 pm, edited 1 time in total.
relanat
Militia Captain
Militia Captain
Posts: 941
Joined: Tue Nov 05, 2013 9:56 am

I think I have found a way to add the EP starting playerships to SOTP using inheritance. I'm fairly sure I can do this without revealing anything about them in the mod. I just need to test it a bit more and check with George that it is OK to do so (because EP is a paid expansion with restricted code). It should then be possible to just overwrite the ship code to add more device slots or different armor segments making it a lot easier for modders. I'll update as I know more.
Stupid code. Do what I want, not what I typed in!
Kaama
Anarchist
Anarchist
Posts: 19
Joined: Sat May 11, 2019 11:17 am

More starting playerships isnt especialy great, as u can download couple of realy cool ones as mods. But more ship in shipyards would be interesting , because there realy arent many choices. Especialy Asterion is realy good looking ship and it is in vanilia game so adding it to shipyard would be 100% legit ;p
Kaama
Anarchist
Anarchist
Posts: 19
Joined: Sat May 11, 2019 11:17 am

I tried to make a ship from Xephyr's graphics as an exercise , but i am failing with graphic display badly, tried difrent configs ,last one is copied from Taipan , nothing works :(
<?xml version="1.0" ?>
<!DOCTYPE TranscendenceExtension
[

<!ENTITY unidShip "0xDF401100">
<!ENTITY scShipClass "0xDF401101">
<!ENTITY rsShipImage "0xDF401102">
<!ENTITY rsShipLarge "0xDF401103">
]>

<TranscendenceExtension UNID="&unidShip;" version="1.0" name="Tinkers Freighter">

<Image UNID="&rsShipImage;" bitmap="freighter.jpg" bitmask="freighterMask.bmp" loadOnUse="true"/>
<Image UNID="&rsShipLarge;" bitmap="freighterLarge.jpg" bitmask="Freighterlargemask.bmp" loadOnUse="true"/>

<ShipClass UNID="&scShipClass;"
manufacturer= "Tinkers"
class= "F1"
type= "freighter"
attributes= "00200000_PlayerShip"
characterClass= "&unidPilgrimClass;"

inherit= "&baHumanTechShip;"
size= "54"
mass= "600"
cargoSpace= "500"
maxCargoSpace= "650"
reactorPower= "300"
fuelCapacity= "250000"
thrust= "1000"
maneuver= "2"
maxSpeed= "16"
maxArmor= "12000"
maxDevices= "10"
maxWeapons= "4"
>
<Armor
armorID= "&itPlasteelPlate;"
count= "6"
/>

<Image imageID="&rsShipImage;" imageWidth="80" imageHeight="80" rotationCount="120" viewportRatio="0.005625" />
<HeroImage imageID="&rsShipLarge;" imageWidth="320" imageHeight="320"/>

<Effects>
<Effect type="thrustMain" posAngle="170" posRadius="30" posZ="0" rotation="180"/>
<Effect type="thrustMain" posAngle="-170" posRadius="30" posZ="0" rotation="180"/>
</Effects>

<Devices>
<Device deviceID="&itMiningLaser;"/>
<Device deviceID="&itMinersCargoHold;"/>
<Device deviceID="&itClass1Deflector;"/>
</Devices>
<Items>
<Item count="40" item="&itHelium3FuelRod;"/>
</Items>
<PlayerSettings
desc= "Tinker's finest."
largeImage= "&rsShipLarge;"
initialClass= "true"
startingSystem= "SE"
startingPos= "Start"
startingCredits= "1000"
>
</PlayerSettings>
</ShipClass>
</TranscendenceExtension>
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.

 Could you add the ship graphic you’re trying to use as an attachment?
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!)
Kaama
Anarchist
Anarchist
Posts: 19
Joined: Sat May 11, 2019 11:17 am

https://drive.google.com/file/d/0B-MJUF ... sp=sharing

its xephyrs spare graphics, i used ship that looks like grenade.

This mod loads , just i cant see ship in armordisplay and in game only drive image and some very strange ship parts or nothing can be seen.
So i gave up , i have 0 graphical skills and completly do not understand whats happening.
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.

 Assuming you mean the one that’s simply called “freighter” in that collection, probably the biggest problem you’re running into is that you’re using an imageHeight and imageWidth of 80 for a 150x150 sprite. You’ll need to either resize the spritesheet and its mask to 80x9600 or change the imageHeight and imageWidth to use it as a larger ship.
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!)
Kaama
Anarchist
Anarchist
Posts: 19
Joined: Sat May 11, 2019 11:17 am

<Image imageID="&rsShipImage;" imageX="0" imageY="0" imageWidth="150" imageHeight="150" rotationCount="120" rotationColumns="12" />

<Effects>
<Effect type="thrustMain" posAngle="180" posRadius="15" posZ="12" rotation="180" />
</Effects>

With this setup I can see ship in vertical position, drive image is in the middle of the ship and like upper 60% of the ship shows up inside of armor hud , progress :lol:
and btw what is "heroimage" for?
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.

 I was going by the code you had posted up above. Try changing the imageHeight and imageWidth to 150 in that, then we can see what the HUD is doing.

 The hero image is the 320x320 upward-pointing facing the game shows when you’re picking out ships at the start of the game or in things like dock services dockscreens.
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!)
Kaama
Anarchist
Anarchist
Posts: 19
Joined: Sat May 11, 2019 11:17 am

<Image imageID="&rsShipImage;" imageWidth="150" imageHeight="150" rotationCount="120" viewportRatio="0.005625" />
<HeroImage imageID="&rsShipLarge;" imageWidth="320" imageHeight="320"/>

<Effects>
<Effect type="thrustMain" posAngle="170" posRadius="30" posZ="0" rotation="180"/>
<Effect type="thrustMain" posAngle="-170" posRadius="30" posZ="0" rotation="180"/>
</Effects>

With this setup ship shows in the game fine ,and in the hud ok( a bit of lowest part is hidden behind hud, but its not a big deal and probably cant be helped)

But there is still major problem with thrusters in the middle of the ship . And also ship has wrong center of gravity moved to the front a bit (maybe those 2 issues are corelated but i am not sure about it- i.e. Lindworm has terrible center of gravity and moves in the way that suggest it has engines at the wrong side.)
Kaama
Anarchist
Anarchist
Posts: 19
Joined: Sat May 11, 2019 11:17 am

So i figured out that pos radius should be bit less than half of image height and at 70 it looks maybe not superawesome, but is not bad. Still there is problem with center of gravity, exactly same as big Lindworm. If u dont activate engine and turn ship around, you would swear that this ship has its jaw and tail opposite, watching the movement. I would realy like to fix it . Posting ship on xelerus , if anybody wants to toy with it.

Maybe those : imageX="0" imageY="0" parameters could help if changed somehow, no idea what they are doing. Currently ship flies without them . And viewportRatio="0.005625" is there only because Taipan has such and its also Xephyrs graphic , but its black magic to me.
User avatar
Xephyr
Militia Captain
Militia Captain
Posts: 857
Joined: Fri Dec 14, 2007 1:52 am
Location: Orion Arm, Milky Way
Contact:

Kaama wrote:
Thu May 30, 2019 2:09 pm
If u dont activate engine and turn ship around, you would swear that this ship has its jaw and tail opposite, watching the movement. I would realy like to fix it .
Probably just a poorly centered model on my part. Being an unused graphic I wouldn't have noticed.

Can't really be fixed without a re-render unfortunately, but I do still have the blender file if you really want it fixed.
Project Renegade (Beta) : "The Poor Man's Corporate Command!"
Real programmers count from 0. And sometimes I do, too.
Post Reply