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.
Access level of Station.localMarket
Moderators: winston, another_commander
-
- Above Average
- Posts: 19
- Joined: Fri Feb 17, 2012 5:11 pm
Re: Access level of Station.localMarket
Unfortunately, it can't even be accessed through script. See the Station entry in [wiki]Oolite_JavaScript_object_model[/wiki].realbrit70 wrote: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.
What I'd recommend for this is write a pre-processor in some scripting language that you're comfortable with, that takes the various properties you want to account for, generates the commodities.plist entries for you, and also generates the planetinfo.plist entries needed.
Bear in mind:
- Tech level and population are extremely strongly correlated
- Tech level and economy type are fairly strongly correlated
- Tech level and government type are moderately correlated
- Tech level and productivity are moderately correlated (government and economy also have an influence)
-
- Above Average
- Posts: 19
- Joined: Fri Feb 17, 2012 5:11 pm
Re: Access level of Station.localMarket
Yeah, I'd already mapped those correlations out. I wasn't looking to disrupt them just initially use them to provide some fine manipulations of pricing and availability among systems of similar economy. For example, taking computers from a TL 10 to a TL 8 world with the same economy would give a greater chance of generating a small profit due to the difference in TL. There would be similar effects for other items, such as food being slightly more available and probably cheaper at lower population planets of similar economy due to increased surplus, that sort of thing.Bear in mind:Have a look at the tables on the Galaxy pages from [wiki]Oolite_planet_list[/wiki] for example. So you might have to be a little careful with what factors you use to supplement economy as they'll mostly point in the same direction.
- Tech level and population are extremely strongly correlated
- Tech level and economy type are fairly strongly correlated
- Tech level and government type are moderately correlated
- Tech level and productivity are moderately correlated (government and economy also have an influence)
The only changes that differ from the standard model would be for certain items where there price can be more affected by Government type rather than economy such as Alien Items where my economic model would give higher prices for such items at Corporate State (because the corps want to copy the potential technology) and Dictatorships (because most Dictators seem to have an avid interest in collecting unique items) while being slightly more available at Anarchic and Multi-Governmental systems.
In the long run I'd like to implement a dynamic system where systems tend to move in economic model from Poor Agricultural to Rich Industrial, with their TL/Population/Productivity moving along with the change. Obviously the rate of this change would be slow so it's effects were unlikely to be seen in more than a handful of systems over the course of the game and even then you are unlikely to see more than a single level of economic change. However that then leaves the option open to create random events (natural disasters or generational effects like collapse of communism, fall of the roman empire) that could drastically change the economy, government type, tech level, population and productivity of a system over a short period of time.
-
- Above Average
- Posts: 19
- Joined: Fri Feb 17, 2012 5:11 pm
Re: Access level of Station.localMarket
I agree but through the System object in the object model I can access the info object which has access to the properties describe in the planetlist.plist file. This includes an entry for market. The question is whether this grants access to the string value from the planetlist.plist file or to the actual localMarket array.cim wrote:Unfortunately, it can't even be accessed through script. See the Station entry in [wiki]Oolite_JavaScript_object_model[/wiki].
Re: Access level of Station.localMarket
Ah, that. No, that describes which commodities.plist entry is used to initialise the market. So you could switch commodity pricing models dynamically by writing to it (though this will increase savefile size), but you'd still have to define the models statically.realbrit70 wrote:I agree but through the System object in the object model I can access the info object which has access to the properties describe in the planetlist.plist file. This includes an entry for market. The question is whether this grants access to the string value from the planetlist.plist file or to the actual localMarket array.cim wrote:Unfortunately, it can't even be accessed through script. See the Station entry in [wiki]Oolite_JavaScript_object_model[/wiki].
Anyway, I'll definitely be interested to see how this idea turns out.