Page 1 of 3

Ship Comparison (Release)

Posted: Thu Dec 10, 2015 4:20 am
by phkb
Ship Comparison gives you the ability to view the specifications of up to 3 different ships at the same time. Perfect for players in the market for a new ship but find it hard to remember all those numbers.

Image

Download via the download manager in the game. Alternate download from Box.com

Re: Ship Comparison (Release)

Posted: Thu Dec 10, 2015 11:28 pm
by phkb
Version 1.1 is up.
- Fixed issue where some ship definitions were incorrectly showing with "0" missiles.
- Fixed issue where some ship definitions were showing a blank in the cargo capacity field.
- Added code to hide specifications of some ships (classified data and such).

Re: Ship Comparison (Release)

Posted: Fri Dec 11, 2015 12:07 am
by ffutures
It might be useful if you could say if the ships can be fitted with an expanded hold. Capacity is usually very important in buying a ship. Maybe put the expanded size in brackets after the usual size?

Re: Ship Comparison (Release)

Posted: Fri Dec 11, 2015 12:12 am
by phkb
ffutures wrote:
It might be useful if you could say if the ships can be fitted with an expanded hold.
Great idea! Thanks!

Re: Ship Comparison (Release)

Posted: Fri Dec 11, 2015 5:31 am
by phkb
Hmm. While I can read the extra_cargo property from shipdata.plist using the built in commands, this isn't always accurate. The doco says the default value is 15 if the entry isn't specified. But it isn't specified for a lot of ships, particularly those that can't have the extra cargo at all. So, I can either make an assumption that no definition means no extra cargo, which goes against the doco, or I maintain a long list of exceptions.

Unless there's a way to read shipyard.plist without having a real ship to deal with. I couldn't see any obvious method of doing this. Then I could look up a ship and read the optional equipment value to see if EQ_CARGO_BAY is listed.

Re: Ship Comparison (Release)

Posted: Fri Dec 11, 2015 11:47 am
by Norby
phkb wrote:
an assumption that no definition means no extra cargo
The exception list will be shorter if you assume no extra cargo for ships with less than 10t (or so) cargo space, and make another short list for real 1t+15t ships if there is any.

An ugly but exact workaround: if no extra_cargo given in shipdata then spawn a similar ship, award a bay, check if it is successful or not and remove the ship.

Re: Ship Comparison (Release)

Posted: Sat Dec 12, 2015 1:11 am
by phkb
Here's something strange: I went down the path of creating ships, then checking if I could award "EQ_CARGO_BAY" to them. Here's what I have:

Code: Select all

	var shipKey = "griff_anaconda-PLAYER";
	var temppos = system.sun.position.cross(system.mainPlanet.position).direction().multiply(4E9).subtract(system.mainPlanet.position);
	var tempship = system.addShips("[" + shipKey + "]", 1, temppos, 0);
	if (tempship != null) {
		tempship[0].switchAI("nullAI.plist");
		var init_c = tempship[0].cargoSpaceCapacity;
		log(this.name, "max cargo " + init_c);
		var result = tempship[0].canAwardEquipment("EQ_CARGO_BAY");
		log(this.name, "canAward " + result);
		tempship[0].awardEquipment("EQ_CARGO_BAY");
		var extra_c = tempship[0].cargoSpaceCapacity - init_c;
		log(this.name, "new max cargo " + tempship[0].cargoSpaceCapacity);
		tempship[0].remove(true);
	}
So, theoretically, from this code, the Anaconda should report back that it's maximum cargo is 750, and that it can't award the cargo bay. Attempting to add the extra cargo space should fail and the difference between the cargo space before and after the attempt should be zero.
Instead this is what I see in the log file:

Code: Select all

11:48:35.143 [ShipComparison]: max cargo 750
11:48:35.143 [ShipComparison]: canAward true
11:48:35.143 [ShipComparison]: new max cargo 765
Therefore I must be doing something wrong here. Any pointers, anyone? :)

Re: Ship Comparison (Release)

Posted: Sat Dec 12, 2015 2:05 am
by Norby
Looks like spawned ships are NPCs where player-only shipyard changes are not applied, so this is not a way, sorry. The player.replaceShip should work, but using Ship Storage Helper just for this is too extreme imho.

Re: Ship Comparison (Release)

Posted: Sat Dec 12, 2015 3:12 am
by phkb
Norby wrote:
The player.replaceShip should work, but using Ship Storage Helper just for this is too extreme imho.
Yeah, quite a bit of overhead to get one or two parameters. I might just have to create an override matrix. *sighs* This was supposed to be a really simple project. Oh well. First rule of computing - nothing is ever as easy as it seems.

Re: Ship Comparison (Release)

Posted: Sat Dec 12, 2015 10:59 pm
by phkb
OK, version 1.2 is up. I've gone down the "lets maintain a long list of exceptions" route, so if you find ships that report incorrect details in the "Weapon positions" or "cargo expansion" column (or any of the details, really!) just let me know and I'll update the list.

Also in this release is the ability to switch from descending (A-Z) to ascending (Z-A) scrolling, so if you go past the ship you want to compare you don't have to go all the way 'round the Horn to get back to the item you want.

As always, comments, suggestions and bug reports welcome!

Re: Ship Comparison (Release)

Posted: Sat Dec 12, 2015 11:27 pm
by Fritz
I found a wrong cargo capacity, but I knew that I would find it because you don't know my ship. :lol:

In the more serious side - but you probably can't do anything about it - my list is missing the standard Python, only showing my modified version. Probably the list is based on names and not on shipdata keys. This problem doesn't only affect your list but also the normal shopping list of available ships. It occurs if there are two different versions of a ship available to the player, in my case a "python_player" and "python_gunship_player". Both have the display name "Python", and this is intentional in my case because the player shouldn't see from a distance what version he is attacking or what is attacking him (there is no significant external difference, so he couldn't see it in reality too). What is missing here is a separate name for the shipyard in shipdata.plist.

Re: Ship Comparison (Release)

Posted: Sat Dec 12, 2015 11:53 pm
by Norby
Fritz wrote:
Both have the display name "Python"
This is frequent so in [wiki]Gallery[/wiki] I added numbers after the name in this case.

I think better if the extra cargo contain a + sign to prevent read "2 (3)" as the extra space is +1t only. If show "2 (+3)" then surely clear.

I got some NaN from ships defined in [wiki]EscortDeck[/wiki]:
Image
The inherited thrust and roll is not returned by a simple shipdata query. Try access in the ship mentioned in like_ship.

Re: Ship Comparison (Release)

Posted: Sun Dec 13, 2015 12:19 am
by phkb
Thanks for the bug reports Norby! I'll get on to them shortly.

Re: Ship Comparison (Release)

Posted: Sun Dec 13, 2015 12:25 am
by phkb
Fritz wrote:
probably the list is based on names and not on shipdata keys.
Thanks correct. I could do it on data keys, but then there would be about 30 odd Cobra Mark III's, all the same, if you have Amah's variety pack installed. If you've got some details I can add in a override list for special ships so that they get an entry on their own.

Re: Ship Comparison (Release)

Posted: Sun Dec 13, 2015 7:52 am
by Amah
Fritz wrote:
... Both have the display name "Python", and this is intentional in my case because the player shouldn't see from a distance what version he is attacking or what is attacking him
Hmmh, you can set what's shown in the scanner by alterning the scanner description, iirc. Just put something into the respective shipdata.plist.

scan_description = "my special Python, without any external difference";