{"action":"created","issue":{"url":"https://api.github.com/repos/endless-sky/endless-sky/issues/330","labels_url":"https://api.github.com/repos/endless-sky/endless-sky/issues/330/labels{/name}","comments_url":"https://api.github.com/repos/endless-sky/endless-sky/issues/330/comments","events_url":"https://api.github.com/repos/endless-sky/endless-sky/issues/330/events","html_url":"https://github.com/endless-sky/endless-sky/pull/330","id":119408806,"number":330,"title":"Dynamic trade implementation","user":{"login":"guillochon","id":4998058,"avatar_url":"https://avatars.githubusercontent.com/u/4998058?v=3","gravatar_id":"","url":"https://api.github.com/users/guillochon","html_url":"https://github.com/guillochon","followers_url":"https://api.github.com/users/guillochon/followers","following_url":"https://api.github.com/users/guillochon/following{/other_user}","gists_url":"https://api.github.com/users/guillochon/gists{/gist_id}","starred_url":"https://api.github.com/users/guillochon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guillochon/subscriptions","organizations_url":"https://api.github.com/users/guillochon/orgs","repos_url":"https://api.github.com/users/guillochon/repos","events_url":"https://api.github.com/users/guillochon/events{/privacy}","received_events_url":"https://api.github.com/users/guillochon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":36,"created_at":"2015-11-30T02:36:32Z","updated_at":"2015-12-06T05:05:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/endless-sky/endless-sky/pulls/330","html_url":"https://github.com/endless-sky/endless-sky/pull/330","diff_url":"https://github.com/endless-sky/endless-sky/pull/330.diff","patch_url":"https://github.com/endless-sky/endless-sky/pull/330.patch"},"body":"**Updated to the latest version, 12/2/2015:** I have implemented a system of dynamic trade into Endless Sky with this pull request. This system adds a finite reserve of commodities in each system, which is initially calculated using the price set for each commodity in each system. Here is what the updated trading tab looks like:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/4998058/11551122/5e92bff8-9944-11e5-9523-92131a28243c.png)\r\n\r\nFeatures:\r\n* While the exact numbers calculated for the initial commodity reserves on each system still likely needs balancing, the total amount of each commodity on each system starts anywhere from a few ten thousands tons to several hundred thousand tons. This limits the maximum amount of profit between two systems to be a few tens of millions.\r\n* Systems produce, consume, and trade goods with neighboring systems (those connected via hyperjumps). The rate of production and consumption are currently set based on how the commodity price compares to the highest and lowest possible prices, whereas the amount of trade is set proportional to the price differential between neighboring systems. All three scale with the \"habitability\" value of each system (or the sum of the origin and destination habitabilities in the case of trade), which is used as a proxy for population. The total rate of change is displayed beneath the \"(+/-)\" in the image above.\r\n* As resources deplete or accumulate in a given system, the price adjusts up or down dynamically. When a player buys/sells goods, the prices change in such a way that it is impossible to make a profit by buying/selling repeatedly in the same location.\r\n* All planets in a system share the same pool of resources, this was done partially because the commodity values are defined system-wide, but it makes sense given how easily goods are transportable within a system.\r\n* When first starting the game the player is completely incapable of affecting the economy, but with a convoy of 10+ heavy freighters, it is possible to drain a system of its resources, requiring constant strategizing to find the best routes.\r\n* Because systems trade with one another via hyperjumps (and to a lesser extent jump drives), the economic landscape will react naturally to events in the game (such as when the Pug cut off the Syndicate worlds in the Free Worlds storyline). This adds I think a very nice flavor!\r\n* The reserves of commodities on each world are saved and loaded along with the pilot information, so the dynamic economy is persistent throughout play sessions.\r\n\r\nThis is a large update and I tried to keep as closely to the coding style as possible (the new \"Reserves\" class that handles much of the functionality was based on the \"Politics\" class), and I also realize it's a big change to the game that not everyone may like. However, I've already found that this makes conducting trade a lot more fun! No longer can one run hundreds of times between two systems to wrack up billions of dollars, now there's constant pressure to always be looking for the best available trade deal."},"comment":{"url":"https://api.github.com/repos/endless-sky/endless-sky/issues/comments/162271337","html_url":"https://github.com/endless-sky/endless-sky/pull/330#issuecomment-162271337","issue_url":"https://api.github.com/repos/endless-sky/endless-sky/issues/330","id":162271337,"user":{"login":"dplepage","id":107468,"avatar_url":"https://avatars.githubusercontent.com/u/107468?v=3","gravatar_id":"","url":"https://api.github.com/users/dplepage","html_url":"https://github.com/dplepage","followers_url":"https://api.github.com/users/dplepage/followers","following_url":"https://api.github.com/users/dplepage/following{/other_user}","gists_url":"https://api.github.com/users/dplepage/gists{/gist_id}","starred_url":"https://api.github.com/users/dplepage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dplepage/subscriptions","organizations_url":"https://api.github.com/users/dplepage/orgs","repos_url":"https://api.github.com/users/dplepage/repos","events_url":"https://api.github.com/users/dplepage/events{/privacy}","received_events_url":"https://api.github.com/users/dplepage/received_events","type":"User","site_admin":false},"created_at":"2015-12-06T05:05:37Z","updated_at":"2015-12-06T05:05:37Z","body":"Out of curiosity, how does this react to non-disaster changes in the systems? E.g. if a mission event involves a mining colony being shut down, it might specify that the system now consumes much less food and produces much less metal - will that change propagate much to the surrounding systems?"}}