Access level of Station.localMarket
Posted: Tue Feb 28, 2012 7:01 pm
I was interested by a couple of older posts on the possibility of changing the economic model used in Oolite and was investigating how I might accomplish that. The current algorithm for calculating available quantity and price is limited by how the pricing is directly tied with the economy meaning that the maximum profit for most items (depending on the amount of randomisation allowed by the mask_price) is going to be obtained travelling from poor agricultural to rich industrial systems or vice versa.
In order to add some variability to that, for example having rich agricultural systems be a more profitable market for computers given that rich farmers can afford better computers than poor farmers, then you could create a number of commodities.plist files and set the system market for each system to the appropriate plist on start up of the application or on entering a new galaxy. That I've already worked out and I am working on the implementation. This I think will provide a greater amount of trading interest as you are now looking at 3 or 4 systems in a trading route for maximum profits.
What I'd like to do however is implement a more dynamic economic model. One where the certain commodities do not follow the standard economic model but are impacted by the factors listed for a system such as Tech Level, Population, Government Type and Productivity. In order to do that I would either be creating an absolute tonne of commodities.plist to account for every variation or I would need to be able to adjust price for a given market AFTER the original pricing for that market had been set.
Looking through the source code I think I can do this by accessing the localMarket property of the Station object. This is an array of the data contained in the commodities.plist by the looks of things which gets populated with the appropriate random factor for the current system the first time the commodities screen is accessed in the system. My thought is to actually trigger the population of this array on arrival in the system (rather than when the player presses F8 or docks) and then adjust the pricing and quantity based on my own factors through script.
My only question is whether this property can be accessed and changed through script? The property does not appear to have and restricted access level, however I'm a C++/C# programmer and not an Objective-C and so I'm not 100% sure of this.
In order to add some variability to that, for example having rich agricultural systems be a more profitable market for computers given that rich farmers can afford better computers than poor farmers, then you could create a number of commodities.plist files and set the system market for each system to the appropriate plist on start up of the application or on entering a new galaxy. That I've already worked out and I am working on the implementation. This I think will provide a greater amount of trading interest as you are now looking at 3 or 4 systems in a trading route for maximum profits.
What I'd like to do however is implement a more dynamic economic model. One where the certain commodities do not follow the standard economic model but are impacted by the factors listed for a system such as Tech Level, Population, Government Type and Productivity. In order to do that I would either be creating an absolute tonne of commodities.plist to account for every variation or I would need to be able to adjust price for a given market AFTER the original pricing for that market had been set.
Looking through the source code I think I can do this by accessing the localMarket property of the Station object. This is an array of the data contained in the commodities.plist by the looks of things which gets populated with the appropriate random factor for the current system the first time the commodities screen is accessed in the system. My thought is to actually trigger the population of this array on arrival in the system (rather than when the player presses F8 or docks) and then adjust the pricing and quantity based on my own factors through script.
My only question is whether this property can be accessed and changed through script? The property does not appear to have and restricted access level, however I'm a C++/C# programmer and not an Objective-C and so I'm not 100% sure of this.