-
-
Notifications
You must be signed in to change notification settings - Fork 376
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic Station Economies #5474
Dynamic Station Economies #5474
Conversation
The price-list widget will remain hidden for developer-only purposes this patch, but I've added an economy sidebar mode to the System Map to allow inspecting station economies (following similar rules as the system-level economy sidebar, including providing extra data with a trade computer). With that, I believe there are no major changes needed for this PR to be accepted into the upcoming release. I'll rebase tomorrow, and would appreciate as many testers as I can possibly get on this short notice! |
What's the read icon? That market is saturated/depleted? For future: I can imagine we want the player to start "isolated/trapped" in a system, start interplanetary trading and missions, buy a Trade computer MkI, that only gives in-system info, then buys hyperdrive, then buys Trade Computer Mk II, that gives both in-system and inter-stellar trade info. |
Out of stock / demand work properly, disallowing you from purchase or sell: note - out of demand has no notification similar to out of stock recommend adding one for that as well |
I haven't tried this branch yet, but shouldn't "out of demand" simply be reflected in the price? E.g. Radioactives are really out of demand, so have negative price. Only reason I can see for station out right refusing to buy, is out of space for the commodity. |
The commodity market is broken:
resulting in low stocks on game load, especially hydrogen may run out. Buy/Sell has no effect on stock and demand in fuel stations. They also have got low stock. The money is calculated correctly. fresh compiled c949363 Version |
This is intentional - when you sell a commodity it is not immediately available in the market again, and takes up to a week to circulate through the station's economy. Similarly, buying a commodity does not increase demand, as you're buying from the 'surplus stock' of commodities that are too expensive for the local market. I'm slightly concerned about your finding of running out of hydrogen, as all stations should start with several thousand tons at the very minimum, and restock over time if you spend a bit of time jumping to other systems.
I'm not sure what you mean here.
If you mean the 'red' icon, that indicates an unprofitable trade between the docked station and the target station (or in general, a profitable trade if you were to fly a return journey).
Good catch, thank you! I've realized there's one final piece of the puzzle missing - I need to adjust the difference between buy and sell prices for a commodity, as there's an exploit right now for high-value commodities where you can make money by buying commodities from the market and immediately reselling them. |
I wonder if the player will think this is a bug? Not sure I see why it needs to lag? I've seen other games where price instantly updates up/down for each unit you buy/sell. I'm sure there's something I'm not getting here. |
c949363
to
977ad1c
Compare
The price updates instantly. However, the commodity item itself is not immediately available to re-buy after you've sold it to the market, and vice-versa. This prevents another exploit, where buying most of a station's stock of a commodity massively increases its sell price (by increasing demand) and you can infinitely resell the commodities you just bought for a 1-3% profit. |
Alright, now this should be ready to go. I've added trade price fees so that selling commodities back to the station you bought them at is always a net loss (and increased profits slightly to balance the fees), fixed a major determinism issue that resulted in different stock numbers between game starts, and added a lot more variance to commodity affinity at different stations. In-system trading should be more interesting, but also more difficult as you'll have to trade a number of different commodities rather than the same 2-4 every time. I also fixed a bug in the station economy comparison tool which resulted in displaying incorrect trade data, so it should now be safe to trust the trade computer! |
This one: ...and here are the same prices shown as in the commodity market, not the half as promised and indeed accounted when trading. Maybe we cannot use the same layout as in the commodity market because these marketplaces now work differently, independent from each other? adapt texts:
weak, but not urgent to have Observed behaviour: for hydrogen, High security prison serenity is a major exporter, OPLI Contemplation is not an exporter. Expected behaviour: OPLI Contemplation with a gas giant nearby where it can be scooped is a major exporter, while a distant space station or a ground station on a rocky planet should be an importer. Introducing fuel cells as a commodity would be a key for an interesting economy model:
...but are fighters interested in the search for cheap fuel or even scooping it? |
This is well beyond out of scope for this PR. I will not be making any efforts to produce more "realistic" commodity stock numbers until several other prerequisite changes are made. I'll take a quick look at the fuel foundation market, but I'm not entirely sure what the best way to handle that will be. Depends on what the existing code is trying to do. The other graphical issues with the trade tool will be getting deferred to next update. |
I'm not sure if this is related to this PR, but happened when testing it. Info: Game::LoadGame('_autosave5') Thread 1 "pioneer" received signal SIGSEGV, Segmentation fault. Crash to terminal (gdb) |
90e4530
to
6a3a044
Compare
- Expose system body's star system and agricultural scalar to Lua
- Adjust ratio of specific input commodities to output commodities to avoid creating galactic 'dependence' on the commodity - Now systems can export computers instead of constantly being starved of them!
- Separate all economic simulation code out into its own Lua module - Give each station its own balance of economy types based on a limited set of parameters - Commodity stock and demand are now tracked separately, based on 'flow' and 'affinity' controlling parameters driven by the station's economic type - Commodity prices are determined on a per-station basis and dynamically update as the player buys and sells from the station - This ties into the restocking mechanic to further increase the impact of making multiple round-trips between the same stations - In-system trading is also now possible, with interstellar trading providing a higher profit margin for canny pilots
- Now all persistent commodities are fully handed inside of economy - Haulaway commodities and hydrogen are treated separately, with a blind-random-walk update method
- Display list of nearby system prices for selected commodity - Display list of prices for current system's stations for selected commodity - Available via alt-click of existing button for development purposes
- Display local import/export status of a trade good - Limit in-market display of a good's interstellar import/export status to trade computer only - Additional column for commodity demand - Limit sale of goods to only that station's available demand
- Move drawing the sidebar title into the main SystemOverviewWidget class
- Compares two station markets to each other, similar to comparing two system economies - Displays import/export prices relative to the system's economic data
- Use sidebar for system overview and economy widgets - Move current system name to center of map view - Remove old system overview implementation
- Adds a 2% trade fee applied to both sides of a commodity transaction relative to the commodity price - Update trade tool to take trade fees into account - Increase commodity stock-based price variance to retain economic balance
- Use system view's system instead of current system when displaying overview title - Add "no available data" string for inspecting economy in other systems - Change debug commodity finder's "load data" mechanism - General tweaks and cleanups
- Fix determinism issue due to iterating economy types by transient sort order - Add random variance to commodity affinity on a per-station basis (reduces incidence of all stations in a system having the same import/export distribution) - Adjust commodity flow based on affinity; "minimal trade" in a commodity results in lower supply and demand
f81e019
to
869b7f3
Compare
Been messing around with the new economy today, just have a couple of questions to get a better understanding of what might be issues, and what might be features, don't wish to open an issue if it is really just my ignorance. On the left, metal alloys is shown to be a minor export, on the right it says intersteller trade: major import, major import where exactly? no other system is selected as a destination. It is not clear why buying one item of metal alloys is going to cost more than the listed price, is there an unstated sales tax or profit margin here? Feels a bit like I am being ripped off, I can understand the price increasing after buying the item due to reduced supply, surely the price stated should be the price charged? While playing around with the new economy today, thought it would be a good idea to buy some precious metals after finding them at a good price, problem was as I traveled around various systems running missions, demand was relatively low, so when a good price was encountered, I could only offload a few tonnes here and there, and ended up having to carry them around for months taking up valuable space. Not clear why demand is a limiting factor here, offloading a large supply of precious metals at any one station should be enough to discourage over exploiting that station as the relatively large increase in supply should have a relatively large reduction in the price? |
I was a bit puzzled too at first, so maybe a tooltip would be useful for the icons on the list. |
In the left hand columns, the import/export is shown relative to the local market. On the description pane on the right, the "interstellar trade" indicates the profitability of this commodity relative to the interstellar average price of the commodity. It does not function relative to a target system, or it would display the target system's name and export/import status.
Both buying and selling are subject to a small (~2%) fee both directions, to avoid being able to immediately resell the commodity to the station for a 2-5% profit. Unfortunately, there was no room to split the "price" column into separate buy/sell prices, and I did not make any mention of the fee in any other text due to lack of time. The price column is the average price of the item at the station.
Supply and demand are intended to be symmetric to each other relative to import/export - a station that primarily exports precious metals is not going to have a large demand to sell them to the local market (the market is already saturated with low-cost goods purchased directly from the factories / mines for a cheaper price than the player can get going through the export market), and a station that exports a very small amount and has little need for precious metals will not have a high demand no matter what you price your goods at. Thus, you should look for stations that need precious metals as a Major Import, as they will have high enough demand to handle the volume of goods you're trying to trade. Outside of the economy simulation, this is entirely on purpose - precious metals are intended to be very low-volume trade items (10-20t max) to allow other goods to retain a level of relative profitability. For example, in a Pumpkinseed with 10t of cargo (at best...) you'll make the most total cash trading Precious metals, but if you buy a Mola Mola, you'll make more cash on a full hold with a 500-800cr good, rather than fully buying out a station's stock of precious metals and leaving the rest of the hold empty. Once you get to a Storeria, you'll be able to fully fill a hold with only 50-60cr goods, but will make more total cash from a run than if you bought out a station's entire stock of robots or precious metals. This still isn't quite perfect, as the curve for how much money you make per run doesn't follow the curve for fuel costs, but you can load multiple commodities into your hold and sell them at different stations to maximize your profits if you don't mind paying extra for fuel. This is the intended game loop for bulk trading, where making more money requires more planning from the player and isn't as simple as "buy bigger ship, trade same commodities". |
And additionally - selling goods to a market does not instantaneously increase the supply available at that market. This is intentional to avoid economic exploits (buy a bunch, lowering supply to increase sell price, sell back for a profit), and also approximates real life - you're selling via a broker to a real entity, which means when you sell goods you only consume market demand. Pioneer's markets do not model speculative arbitrage, where a broker would take commodities off your hands for a much lower price and store them in hopes of being able to sell them later to other travellers for a higher price. This is something that would be implemented for later work, if ever, and most likely only be viable at certain high-traffic stations used as trade hubs. |
Had my doubts about limiting sales based on the demand, now it makes a lot more sense, It keeps all the commodities relevant throughout the game rather than the gradual drift towards high end products as is so often the case in gameplay. I think the commodity market would benefit from having a separate buy price and sell price column, with the price displayed being the explicit price you pay or receive, narrowing the right side panel. 2 very trivial observations, buy 1 unit for, rather than buy 1 units for, and the precious metals description, should that be silver rather than silicon? |
...Feature freeze can't catch me if I type fast enough!
In all seriousness, this is a down-to-the-wire PR delayed by a round of sickness and a PC rebuild, but one that may prove to be one of the bigger features of the patch. This PR completely rebalances the economic system of Pioneer, providing a (perhaps too generous) 40-50% profit margin for savvy pilots who can sniff out the perfect pair of systems and stations to trade between - but punishes traders who get too complacent with seriously diminishing returns for running the same route too often.
The headlining feature of this PR is of course the "dynamic" economy for stations - we now have a proper supply-and-demand economic system where each station has its own set of commodities produced and consumed (and associated quantities for each), though the system is not quite as well-rounded as I'd like due to the paucity of good input data - I've shoehorned this all in to the existing three major economic archetypes, when I'd really like to split our commodities between 6-8 economic subtypes with more sane production and consumption rates... something for another PR.
Of note: the economic simulation is not "dynamic" in that prices change over time naturally. The existing behavior of station stocking is preserved in that stations will restock / increase demand back to an "equilibrium" value but once reaching that will remain in steady-state until the player takes an action. This is also a subject for another PR.
A secondary feature is an improved trade calculator tool (still WIP as of this writing) that provides extremely "cheaty" information on exactly which system/station has the best trade prices for a commodity (available for developers via alt-click) as well as providing more reasonable information about a station's economic flow for all commodities, similar to the existing system trade tool.
2023-01-16.01-59-43.mp4
The commodity market (the video shows an outdated version) now displays the station's local import/export disposition of a commodity, and if the player has a trade computer mounted additionally displays the interstellar import/export nature of a commodity.
I've also included a slightly-opinionated change to increase the easy/medium start's amount of available credits - as in-system missions don't pay much more than fuel cost and immediately running to an interstellar mission to make money isn't the greatest new-player introduction. On a meta level, this also balances removing the Sinonatrix from the easy start with a bit of extra cash instead 😄
TESTING REQUIRED
This branch was written hurriedly and not thoroughly tested, so I'd really appreciate everyone reading this PR description downloading a build from the Checks section and testing the economic behavior specifically - you can cheat in money with the Ctrl+I menu (as well as give yourself a better ship for bulk trading) and get setup for trading that way.
I've prepared a short list of scenarios that should be tested (independently) while I'm working on finishing the UI elements: