Page 1 of 2

Shipyard monotony

Posted: Mon Mar 28, 2022 3:02 pm
by Old Murgh
I find that the shipyard markets on stations are often dominated by just a few different ship-types for sale, but with great variation in terms of pre-installed equipment –as much as a page and a half of the same model can be available, and the feeling is that this suppresses a potential for variation in ships.

Does anyone know of some bit of code in the open that can be tweaked to say, limit any given model to one or two appearances?

Re: Shipyard monotony

Posted: Mon Mar 28, 2022 8:22 pm
by Cody
Dumb pilot's suggestion: could a condition script be adapted?

Re: Shipyard monotony

Posted: Mon Mar 28, 2022 10:35 pm
by Old Murgh
Cody wrote: Mon Mar 28, 2022 8:22 pm
Dumb pilot's suggestion: could a condition script be adapted?
You may well be right, I hope it could be done with the world's smallest OXP. I just have no idea how to dictate such a restriction through the javascript engine. I have this feeling that it's either a very small matter or it can't be done, but no clue as to which.

Re: Shipyard monotony

Posted: Tue Mar 29, 2022 1:32 am
by montana05
Old Murgh wrote: Mon Mar 28, 2022 10:35 pm
Cody wrote: Mon Mar 28, 2022 8:22 pm
Dumb pilot's suggestion: could a condition script be adapted?
You may well be right, I hope it could be done with the world's smallest OXP. I just have no idea how to dictate such a restriction through the javascript engine. I have this feeling that it's either a very small matter or it can't be done, but no clue as to which.
It probably could be done but, the first idea of mine, would require a modification of the shipyard or a lot of overrides.

Re: Shipyard monotony

Posted: Tue Mar 29, 2022 2:11 am
by phkb
montana05 wrote: Tue Mar 29, 2022 1:32 am
It probably could be done but, the first idea of mine, would require a modification of the shipyard or a lot of overrides.
Agreed. It can be done, as the shipyard is fully accessible to JS now, but it would require a considerable effort. The alternative is to create a large shipyard-overrides.plist file. The benefit here is that you could do it in stages, one ship type at a time, rather than doing some sort of global-every-oxp-ship sort of thing.

Re: Shipyard monotony

Posted: Tue Mar 29, 2022 7:07 am
by Old Murgh
phkb wrote: Tue Mar 29, 2022 2:11 am
montana05 wrote: Tue Mar 29, 2022 1:32 am
It probably could be done but, the first idea of mine, would require a modification of the shipyard or a lot of overrides.
Agreed. It can be done, as the shipyard is fully accessible to JS now, but it would require a considerable effort. The alternative is to create a large shipyard-overrides.plist file. The benefit here is that you could do it in stages, one ship type at a time, rather than doing some sort of global-every-oxp-ship sort of thing.
Do you mean large as in it would require a copy/paste/adjust line per every potential ship, or the other kind of large?

So, a global offerShip equal or less than 2-script is more complicated..?

Re: Shipyard monotony

Posted: Tue Mar 29, 2022 2:14 pm
by Cholmondely
Does anybody know why this monotony prevails? One would presume that the ships appearing would be a random selection. Either the selection is not random, or else the selection of the popular models with widgets is so immense as to drown out everything else.

I've found that Maaarcooose's Odyssey is immensely popular in the shipyards when loaded, zillions appearing with lots of different ooptions.

On the other hand, Killer Wolf's Venom seems never to appear at all!

Shipyard.plists:

Code: Select all

{
	"u31_odyssey-player" =
	{
		chance = 1;
		"optional_equipment" =
		(
			"EQ_ECM",
			"EQ_FUEL_SCOOPS",
			"EQ_ESCAPE_POD",
			"EQ_ENERGY_BOMB",
			"EQ_ENERGY_UNIT",
			"EQ_NAVAL_ENERGY_UNIT",
			"EQ_DOCK_COMP",
			"EQ_WEAPON_PULSE_LASER",
			"EQ_WEAPON_BEAM_LASER",
			"EQ_WEAPON_MILITARY_LASER",
			"EQ_FUEL_INJECTION",
			"EQ_MULTI_TARGET",
			"EQ_SCANNER_SHOW_MISSILE_TARGET",
			"EQ_GAL_DRIVE",
			"EQ_ADVANCED_COMPASS",
			"EQ_SHIELD_BOOSTER",
			"EQ_NAVAL_SHIELD_BOOSTER",
			"EQ_HEAT_SHIELD"
		);
		price = 10000;
		"standard_equipment" =
		{
			extras =
			(
		"EQ_PASSENGER_BERTH",
			);
			"forward_weapon_type" = "EQ_WEAPON_PULSE_LASER";
			missiles = 3;
		};
		techlevel = 1;
		"weapon_facings" = 3;
	};
}

Code: Select all

{
/* Venom*/
	"venomplayer" = {
		"chance" = 1;
		"optional_equipment" = (
			"EQ_ECM",
			"EQ_ESCAPE_POD",
			"EQ_ENERGY_UNIT",
			"EQ_DOCK_COMP",
			"EQ_FUEL_INJECTION",
			"EQ_SCANNER_SHOW_MISSILE_TARGET",
		);
		price = 200500;
		standard_equipment = 
		{
			extras = 
				(
				"EQ_FUEL_SCOOPS",
				"EQ_HEAT_SHIELD"
				);
			forward_weapon_type = "EQ_WEAPON_BEAM_LASER";
			missiles = 1;
		};
		techlevel = 4;
		weapon_facings = 15;
	};
	

}

Re: Shipyard monotony

Posted: Tue Mar 29, 2022 4:43 pm
by Old Murgh
Cholmondely wrote: Tue Mar 29, 2022 2:14 pm
Does anybody know why..
In this case the ship has given itself a 1 (100% chance) of being included in a yard's selection. Most ships are in the .375 to .05 range and will get dominated out of the pickings.
[edit]
–But so has the other. Then I don''t understand that either.

But a nice script to reduce bullies to only one or two spots would be nice.

Re: Shipyard monotony

Posted: Tue Mar 29, 2022 5:34 pm
by Cholmondely
Old Murgh wrote: Tue Mar 29, 2022 4:43 pm
Cholmondely wrote: Tue Mar 29, 2022 2:14 pm
Does anybody know why..
In this case the ship has given itself a 1 (100% chance) of being included in a yard's selection. Most ships are in the .375 to .05 range and will get dominated out of the pickings.
[edit]
–But so has the other. Then I don''t understand that either.

But a nice script to reduce bullies to only one or two spots would be nice.
Umm... I changed the Venom percentage to make it appear. Maaarcooose's bizarre little ship was never quite finished, so I presume he left the percentage high to make it more available to himself. The ship seems to be unique in what I read about the original cartoon strip.

And the Venom finally appeared once I got rid of the Werewolf.oxp! Quite strange!!

Re: Shipyard monotony

Posted: Tue Mar 29, 2022 8:47 pm
by phkb
Old Murgh wrote: Tue Mar 29, 2022 7:07 am
Do you mean large as in it would require a copy/paste/adjust line per every potential ship, or the other kind of large?
Yes, and yes. The shipyard-overrides file would have an entry per player ship, with whatever tweaks to the percentages and limits as you deem necessary. But it would also ultimately become quite large, given the number of OXP ships out there.

Additional thoughts: If the goal is to make the shipyard more interesting, in a guaranteed kind of way (ie, not relying too much on RNG), then you probably would just override all player ships with a "chance" of 1 (to make sure they are always available), but then have a condition script that kicks it to become the final arbiter of whether a ship appears or not.

Re: Shipyard monotony

Posted: Tue Mar 29, 2022 8:51 pm
by phkb
Old Murgh wrote: Tue Mar 29, 2022 7:07 am
So, a global offerShip equal or less than 2-script is more complicated..?
You would still need to use shipyard-overrides.plist to change the condition script of each and every player ship to get it to trigger. I don't believe the shipyard condition scripts can be engaged in a global way like you suggest.

Re: Shipyard monotony

Posted: Tue Mar 29, 2022 9:20 pm
by Old Murgh
phkb wrote: Tue Mar 29, 2022 8:47 pm
If the goal is to make the shipyard more interesting, in a guaranteed kind of way (ie, not relying too much on RNG), then you probably would just override all player ships with a "chance" of 1 (to make sure they are always available), but then have a condition script that kicks it to become the final arbiter of whether a ship appears or not.
I like the chance element, and think that some yards should be sparse, and others bountiful. It's only the way it currently gets dominated by a few mass-repeaters that' I'd like to have the power to change
phkb wrote: Tue Mar 29, 2022 8:51 pm
You would still need to use shipyard-overrides.plist to change the condition script of each and every player ship to get it to trigger. I don't believe the shipyard condition scripts can be engaged in a global way like you suggest.
I think I grasp the outline of what you're saying. The prospect of wrangling 30-40 ships isn't as daunting as 300-400.

Re: Shipyard monotony

Posted: Tue Mar 29, 2022 11:27 pm
by tsoj
In Oolite 1.91 there is the possibility to edit the shipdata.plist of all loaded ships (and thus also edit the shipyard data):

Code: Select all

var shipdata = Ship.shipDataForKey("adder-player");
if(shipdata._oo_shipyard){
    shipdata._oo_shipyard.chance = 0.1;
}
Ship.setShipDataForKey("adder-player", shipdata);
This would set the chance (from originally 0.25) to 0.1.
To make this into a real OXP you could make up some rules, like ships that cost more than 1 000 000 have at most a chance of 0.1, all ships have at most a chance of 0.5 and at least a chance of 0.02, adding hard-coded chances for some ships, ... and then apply these rules to all ships, e.g.:

Code: Select all

this.startUp = function()
{
	var dataKeysArray = Ship.keys();
	for(let i in dataKeysArray)
	{
		let shipdata = Ship.shipDataForKey(dataKeysArray[i]);
		let newShipData = myRuleFunction(shipdata);
		Ship.setShipDataForKey(dataKeysArray[i], newShipData);		
	}
}
But again, this works only in the development version, because the function setShipDataForKey is quite new.

Re: Shipyard monotony

Posted: Wed Mar 30, 2022 1:08 am
by Cholmondely
tsoj wrote: Tue Mar 29, 2022 11:27 pm
But again, this works only in the development version, because the function setShipDataForKey is quite new.
So not for Murgh's AppleMac or mine, then. Development version does exist (thanks, Hiran!) but is currently windows only...

Edited in light of a_c's post on the next page! Hurrah!

Re: Shipyard monotony

Posted: Wed Mar 30, 2022 1:50 am
by Old Murgh
tsoj wrote: Tue Mar 29, 2022 11:27 pm
In Oolite 1.91 there is the possibility to edit the shipdata.plist of all loaded ships (and thus also edit the shipyard data):
..
But again, this works only in the development version, because the function setShipDataForKey is quite new.
Cholmondely wrote: Wed Mar 30, 2022 1:08 am
So not for Murgh's AppleMac or mine, then. Development version does exist (thanks, Hiran!) but is currently windows only...
Yes this does look smart, but the future feels uncertain for us with a Mac.