-
-
Notifications
You must be signed in to change notification settings - Fork 385
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
Fix debug commodities tab #5861
Fix debug commodities tab #5861
Conversation
end | ||
|
||
|
||
local function station_economy(commodities, clicked, station) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Web-eWorks If you intend to review this PR, then this function is the one where I'm half stumbling around trying to understand the economy system.
Basically, what info is meaningful to display, are the ones I have correctly named?
For completeness, I'll add this uncommitted comment I have on my local copy, adapted from IRC conversation the other day:
-- GetCommodityStockFromFlow() returns "equilibrium" stock/demand,
-- and price of the commodity is stored as a "pricemod", a
-- percent-of-100 offset to the commodity's base price to compute
-- market price for e.g. oxygen (substitute any commodity ID),
-- you'd call
--
-- Economy.UpdateCommodityPriceMod(sBody, "oxygen", { stock, demand, pricemod }),
--
-- which stores the new pricemod in the table passed as the 3rd argument.
-- You can then call
--
-- Economy.GetMarketPrice(commodity.price, pricemod)
--
-- to get the credit cost of the commodity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good. Some of this information could be sourced from the commodity market datastore directly (station:GetCommodityMarket()
) rather than through GetCommodityStock()
et. al., though the only time that matters is in the case of a custom commodity price being set by a mission module.
Another thing to look at would potentially be to inspect the persistent market cache (stationMarket
in Economy.lua), though you'd need an accessor to retrive the variable outside of the Economy module.
If you wanted to get fancier, you could provide a button that simulates the effect of restocking ticks on the commodity market - possibly make a copy of the market datastore returned from GetCommodityMarket()
and call:
Economy.UpdateStationCommodityMarket(sBody, Engine.rand, marketCopy, comm.id_name, ticksToSimulate)
You could then display some sort of graph showing the commodity stock/demand levels over the simulate time - that could be a very useful tool when doing further work on the economy simulation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for suggestions. As my main driving motivation to work on this was when fixing #5859, I'll "call it a day" as for features, but keep your suggestions in mind for next time I'll want to dive into commodity balance.
end | ||
|
||
|
||
local function station_economy(commodities, clicked, station) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good. Some of this information could be sourced from the commodity market datastore directly (station:GetCommodityMarket()
) rather than through GetCommodityStock()
et. al., though the only time that matters is in the case of a custom commodity price being set by a mission module.
Another thing to look at would potentially be to inspect the persistent market cache (stationMarket
in Economy.lua), though you'd need an accessor to retrive the variable outside of the Economy module.
If you wanted to get fancier, you could provide a button that simulates the effect of restocking ticks on the commodity market - possibly make a copy of the market datastore returned from GetCommodityMarket()
and call:
Economy.UpdateStationCommodityMarket(sBody, Engine.rand, marketCopy, comm.id_name, ticksToSimulate)
You could then display some sort of graph showing the commodity stock/demand levels over the simulate time - that could be a very useful tool when doing further work on the economy simulation.
- Add ui.collapsingHeader for displaying min/max/diff info - Add stats for commodity at current station - Don't show irrelevant stats when not purchasable - Rename tab to something shorter Note: if filtering out illegal goods there can still be e.g. nerve gas, if legal at some station (but of likely fewer samples).
1cab8f3
to
92e5769
Compare
Pushed a minor fix for layout and typographical issues. |
sqrt
purchasable
goods on/off (sadly we can't buy the fuzzy little Quibbles on the commodity market)¯\_(ツ)_/¯
Collapsed
Expanded
Include non-purchasable
Some info of station levels