Question:Shipyard`s "ships to be bought"(Ahruman?)

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

Question:Shipyard`s "ships to be bought"(Ahruman?)

Post by Lestradae »

Greetings to whomever it may concern and who can answer some or all of my questions,

I am experimenting with an upgrade to my shipyards oxp and have experienced a few rather weird problems (with which`s details I don`t intend to bore you) - this led to questions popping up.

How exactly does the game choose which ships to offer in a shipyard, with respect to the chance of appearing and the tech level from the plist, and the amount of possibilities strict and oxp-wise?

I.e., if the chance of all ships (strict and all oxps installed) to appear was 1.0 and the minimum tech level for all of them was 0 (aka 1 in-game) would that mean that all buyable ships would appear in all shipyards all the time? And if yes, how often? Or not? And why?

If there is a formula that determines this or a short explanation for which you could find the time or some how-to or FAQ I could look into I would be very grateful.

The most noteable problem seems to be that there is an over-abundance of small crappy ships in the high-tech-level systems, while the really high-up ships (TL 14, 15) nearly never (sometimes actually never) appear. I have tested this X times in different constellations. No idea why that happens.

And something like:

Code: Select all

<key>conditions</key>
                <array>
                <string>systemTechLevel_number lessthan 3</string>
                <string>systemTechLevel_number lessthan 7</string>
                </array>
... doesn`t seem to work in the shipyard.plist.

Thanks in advance & for your time 8)

Lestradae
Last edited by Lestradae on Mon Mar 31, 2008 11:56 pm, edited 2 times in total.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

The way old style (plists) conditions work, all the conditions must be true at the same time.

Your example asks oolite to make that ship available only if systemTechLevel_number is less than 3 and it's less than 7. You can remove the second tech level check, since anything less than 3 will automatically be less than 7. Afaik, these conditions are only meant to be used inside shipdata.plist, though.

It's quite unlikely you'll see a tech level 1 ship for sale all the time. Like all markets, it's randomized. I haven't got the wiki page in front of me, but - if I remember correctly - you can set the likelihood of a ship appearing in the for sale section via a setting inside shipyard.plist.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Ace Garp
Dangerous
Dangerous
Posts: 86
Joined: Sun Mar 02, 2008 7:15 am
Location: Lancashire, UK
Contact:

Post by Ace Garp »

I think Lestradae may have meant to say 'Greater Than 3', and 'Less Than 7'?
At least that makes sense anyway.

Not that I'm any great authority as I'm still at the very basic stages of learning scripting.

Note - Oolite is the first thing to get me interested in coding again (unless you count HTML ;-), in about a decade.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Ace Garp wrote:
I think Lestradae may have meant to say 'Greater Than 3', and 'Less Than 7'?
At least that makes sense anyway.
True, but even if that's what he wanted, that's not what he asked oolite to do.
If the ship only shows up in systems with tech level less than (add the one) 4 - instead of tech levels 5,6 & 7 - then oolite is working as it should!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

Aw, cr*p

Post by Lestradae »

D*mn! I`m with stupid :oops:

Made a silly mistake when citing my own code. Must ... keep ... head ... on shoulders ... :(

OK, first, obviously the code should have been:

Code: Select all

<key>conditions</key> 
                <array> 
                <string>systemTechLevel_number greaterthan 3</string> 
                <string>systemTechLevel_number lessthan 7</string> 
                </array>
It was that way when testing ... sorry. Too fast typing while posting. :?
You can remove the second tech level check, since anything less than 3 will automatically be less than 7.
Yeah, well, sure, see above. :oops:
It's quite unlikely you'll see a tech level 1 ship for sale all the time, though. Like all markets, it's randomized. I haven't got the wiki page in front of me, but - if I remember correctly - you can set the likelihood of a ship appearing in the for sale section via a setting inside shipyard.plist.
Ahm, yes. I am influencing this with the Realistic Shipyards oxp. In the shipyard.plist it says, for example:

Code: Select all

<key>chance</key>
                <real>0.25</real>
... meaning that there is a 25% chance for that ship to appear. But at what Tech Level? I experimented with setting the value to 1.0 (aka 100%) but ships still don`t appear always - even if it is exactly the correct Tech Level according to ...

Code: Select all

<key>techlevel</key>
                <integer>5</integer>
... and even if I take all shipoxps except the one I`m testing out of the Add-Ons folder. (And yes, I did hold down the Shift key while loading every time)

The problem is, that very low-tech ships like, say, the Adder seem to apear in shipyards all the time from TL 1 to 15 (literally) while the high-end ships of TL 15 actually NEVER appear, even if I give them a chance to appear (see above) of 1.0.

I have speculated that maybe the chance to appear is cumulative (so a TL 5 ship has a chance to appear in TL 10 its original chance times 5 or something, while a TL 15 ship has only a vanishing chance therefore if a lot of ship oxps are in the AddOns folder) but someone must know this. How does the game make those choices :?: :?: :?:

What I want is a more balanced selling of ships, especially if many ship oxps are in. And I was thinking about not only a minimum TL but also a maximum - a ship that starts appearing in TL 6 will appear in TL up to 10 but not in TL 11+.

Hm, is there a way to make something like an "OR" command perhaps? Then I could write the following workaround:

Code: Select all

<key>conditions</key> 
                <array> 
                <string>systemTechLevel_number equals 3</string>
                OR
                <string>systemTechLevel_number equals 4</string>
                OR
                <string>systemTechLevel_number equals 5</string> 
                </array>
:?:

Feedback VERY welcome :idea:

Lestradae
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

OK, limited success with the Tech Levels ...

Post by Lestradae »

OK, limited success with the Tech Levels ... solved the Tech level problem - found a way to make ships appear in a SPAN of Tech Levels. I can now define a span for TL. Like, from 5 to 8 and 11 to 13. 8)

Problem still left: Why do the high-end ships not appear in the TL 14, 15 shipyards as they should :?:

It all comes back to the question how the game selects which ships it takes if the choice horizon is big, oxp-wise.

If anyone knows and can enlighten me :idea: I would be pleased.

Cheers :)

L
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Good to know you sorted that one out! :)

About the high end ships not appearing, I had a similar problem with falcons & kestrels for a while. I really thought there was something broken, but it was just a 'stuck' semi random number. Each ship's chance is calculated separately. Even if a ship has 100% chance (99% really) a bad roll might stop it from appearing, yet a ship with 5% chance might appear if it gets a lucky roll...
Try going to a different TL 15 place, or have a little 'walk' to a few neighbouring systems, just to change the random seed.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

.

Post by Lestradae »

Hi Kaks,
About the high end ships not appearing, I had a similar problem with falcons & kestrels for a while. I really thought there was something broken, but it was just a 'stuck' semi random number. Each ship's chance is calculated separately. Even if a ship has 100% chance (99% really) a bad roll might stop it from appearing, yet a ship with 5% chance might appear if it gets a lucky roll...
Yeah, but I tried a combination in which I put only TL 14 & 15 ships (~15 of them all in all) in the AddOns folder, made them all to appear at chance 1.0 and visited a TL 15 world afterwards :shock:

And guess what: One TL 14 ship, not a single TL 15 ship! :?

That`s not possible, is it? Chances are, even with 99%, what? 1 to a billion?
Try going to a different TL 15 place, or have a little 'walk' to a few neighbouring systems, just to change the random seed.
Well ... see above :(

Perhaps I`ll try nevertheless ... are one or two hyperjumps and then returning to the TL 15 world enough for resetting the seed, do you know that? Those worlds don`t exactly grow on trees :P

Thanks for your feedback so far :)

L
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

TechLevel has little effect on selection when chance = 1.0 As far I see it, Techlevel is only used to bend the chance factor with a formula similar to next one:

chance = chance ^ techLevel-difference

where techLevel-difference is the difference between ship techLevel and system techLevel.

With chance = 0 or chance is 1 raising to a power has no effect. With a chance of 0.5 negative or positive values of the techLevel-difference will bend the chance up- or downward depending on the system level. The actual formula is more sophisticated than in above example but the general idea is the same.

But chance is not the only selection criteria.
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

@Eric Walch

Post by Lestradae »

Thanks for your answer, the information helps!

8)

L
Post Reply