Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

A smarter ShipMarket in SpaceStation #3243

Merged

Conversation

impaktor
Copy link
Member

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

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

sol

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.

Spawn ShipMarket in equilibrium, and allow different equilibria for different
stations.
@fluffyfreak
Copy link
Contributor

I like the plots! :)

@impaktor
Copy link
Member Author

Thanks!

I think this is the first code that makes use of population of individual space bodies, and in that I suspect I expose some illogical or buggy behaviour:

The strangeness is that Moon has population 0, even though it has a space port. Mars with two space ports has 0.3 billion, while both its moons have 0.4 billion, with one port each.

Yesterday I started looking at the PopulateStarSystemGenerator::PopulateStage1 which seems to be "where the magic happens", but I decided eating ice cream and watching TV was more appealing to me.

@fluffyfreak
Copy link
Contributor

It's so true, the whole populating system is just horrible and very self involved.

Anyway I see nothing wrong with the code itself so unless anyone objects I'll merge this in tomorrow.

fluffyfreak added a commit that referenced this pull request Nov 13, 2014
@fluffyfreak fluffyfreak merged commit efc0c34 into pioneerspacesim:master Nov 13, 2014
@impaktor impaktor deleted the individual_shipmarket_sizes branch November 13, 2014 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ship market initialized far from equilibrium
3 participants