A smarter ShipMarket in SpaceStation #3243
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
"Moar" plots!
I know, I know, only I care about this, but I'd like to describe what I've done, and show how it works, and I find plots to be the best way to investigate overall behavior. This fixes #3221 (and makes use of Poisson numbers #3242, see @fluffyfreak, not merged in vain 馃槈.)
Old rules for ShipMarket size
The system currently in use works like so: Always add or remove one ship advert every hour. If 0 ships, then add 20 ships.
New rules for ShipMarket size
New system models each ship market on each station separately, allowing each to have its own dynamics. (Uses similar code to #3220)
Surface stations have 1.5 more ships in ship market, since there's more space to house all the ships, compared to an orbital station. I choose this "excuse" since I think there should be an incentive for the player to visit ground stations. They should be "bigger". More commodities in stock (something for another PR) and more ships in market (this PR).
Ship adverts have a half life of 7 days (i.e. after 7 days half of the adverts are gone, if no new have been created), for both orbital and surface stations.
ShipMarket size is determined by population of planet it belongs to. The minimum is 2 ships (E.g. Barnard's star, Tranquility base, or Gas giants), and then we get bigger ShipMarkets for more populated planets, but it is not linear, but according to plot below:
Marked above the levels for Earth Orbitals and Earth Surface ports, as Earth has 7.7 billion.
Worth knowing, is that population sizes (in billions) of some planets in Sol (x-axis): Earth 7.7, Moon: 0 (!?), Mars: 0.38, Phobos 0.47, Deimos 0.42, Europa 0.52.
Ship adverts are spawned in equilibrium
In plot below, straight dashed lines mark the theoretical equilibrium ("EQ"), which the market should fluctuate to/from for different stations.
"TOTAL" number of ships on sale in the system is shown by the gray line, and right hand side y-axis is used. Notice that the markets are spawned in equilibrium (plus some stochastic noise), and total number of ships is roughly constant. Nice.
London and Los Angeles are Surface earth ports, and have an equilibrium of 22 (red dashed line). Gates Spaceport is orbiting Earth, and has on average 15 ship adverts. Clarke's station orbits Europa which has 0.5 billion people. Mars high is a small stations, with only a few ships on sale.
Take home message: Each station shipMarket has its own basic number of ships for sale, determined by planet population and orbital/surface starport. Each station shipMarket is spawned close it its equilibrium.
Suggestions?
I'm open to suggestions for changing and tweaking this before merge. It's just a matter of tweaking the parameters that are already there.