Secondary Market Definitions Defined

General discussion for players of Oolite.

Moderators: winston, another_commander

User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 556
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Secondary Market Definitions Defined

Post by Nite Owl »

Been trying to wrap my head around these for a while now. It may have clicked but my confidence is still low. All of this comes from HERE. Would truly appreciate either a confirmation of the definitions as interpreted herein or a correction of my errors. Here goes.

Primary Price is the Price Average of a Good from the trade-goods.plist

Local Capacity is either the Secondary Station's Capacity or the defined Capacity of a class of Goods or of a specific Good

Primary Capacity is either the Main Station Capacity or the Capacity of a specific Good from the trade-goods.plist

Primary Quantity is the Quantity Average of a Good from the trade-goods.plist

Once the above definitions are finalized my hope is that one of our Wiki Wizards can update the page linked above to reflect these definitions. It is possible that only myself is struggling with these definitions but somehow that is doubtful. In a previous post the "spara" method of defining a Secondary Market was pointed to by me because of this definition problem. It was then correctly pointed out by phkb that the new method devised by cim from Oolite v1.82 going forward should be used. This lead me to revisit the "cim" method. Unfortunately my lack of an exacting grasp of the above definitions still puzzles me. My hope is that with this post some light may be shed at the end of the tunnel. Any answers to resolve this confusion would be truly appreciated.
Humor is the second most subjective thing on the planet

Brevity is the soul of wit and vulgarity is wit's downfall

Good Night and Good Luck - Read You Soon
User avatar
Cholmondely
Archivist
Archivist
Posts: 5365
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Secondary Market Definitions Defined

Post by Cholmondely »

Nite Owl wrote: Mon Dec 11, 2023 8:24 pm
Been trying to wrap my head around these for a while now. It may have clicked but my confidence is still low. All of this comes from HERE. Would truly appreciate either a confirmation of the definitions as interpreted herein or a correction of my errors. Here goes.

Primary Price is the Price Average of a Good from the trade-goods.plist

Local Capacity is either the Secondary Station's Capacity or the defined Capacity of a class of Goods or of a specific Good

Primary Capacity is either the Main Station Capacity or the Capacity of a specific Good from the trade-goods.plist

Primary Quantity is the Quantity Average of a Good from the trade-goods.plist

Once the above definitions are finalized my hope is that one of our Wiki Wizards can update the page linked above to reflect these definitions. It is possible that only myself is struggling with these definitions but somehow that is doubtful. In a previous post the "spara" method of defining a Secondary Market was pointed to by me because of this definition problem. It was then correctly pointed out by phkb that the new method devised by cim from Oolite v1.82 going forward should be used. This lead me to revisit the "cim" method. Unfortunately my lack of an exacting grasp of the above definitions still puzzles me. My hope is that with this post some light may be shed at the end of the tunnel. Any answers to resolve this confusion would be truly appreciated.
I've failed to understand this, despite trying, despite bamboozling poor old Spara to write a thread on the subject, and intermittedly hassling Phkb down there in the antipodes.

Cim was upset that his simpler system failed to be understood and properly used. Why not bug him? :mrgreen:

Personally speaking, I'd rather add you in as one of the wiki editors and let you lose on it! At least you vaguely understand this sort of stuff...
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Secondary Market Definitions Defined

Post by phkb »

Is the *main* goal to adjust existing commodities, or create new ones? The reason being, you shouldn't need to touch "trade-goods.plist" if you're not creating a new commodity, which can eliminate a lot of unnecessary noise from a potential how-to guide.

I've got a bit of time over the next week or so, so I might be able to put something together that walks through the process step-by-step, with examples. But it helps if I know what the primary focus is.
User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 556
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Secondary Market Definitions Defined

Post by Nite Owl »

My trade-goods.plist has only had the Alien Items entry Tweaked. They were moved above Gold in the sort order. They also had their sell price adjusted to be a bit more profitable and consistent across all of the Oolite economies. Aside from that my trade-goods.plist does not need any further Tweaks nor is my aim to add any Goods. My primary focus is to learn how to change some of the availability and pricing for the other vanilla Goods at specific stations using the preferred cim method as opposed to the older spara method. The formula that cim created to do this makes sense to me on a mathematical level. How to code that formula into a shipdata.plist also makes sense to me. What is missing are the numbers to input into cim's formula and where they can be found. These numbers are essential to get the desired results. The definitions in my original post need to be defined in order for me to find the numbers that those definitions point to. Basically you could reinterpret the list of definitions from my original post as follows.

Where can the numbers that represent a Good's Primary Price and Primary Quantity be found ?

Where can the numbers that represent Local Capacity and Primary Capacity be found ?

The above forgoes any guess on my part as to where these numbers might be hiding. Without the numbers from the above cim's formula cannot be used accurately. Just randomly plugging some numbers into the other variables used in the formula and then checking the result is far too haphazard a methodology. My belief is that cim would not create something that random in his attempt to redo the Commodities in Oolite. Using the spara method, along with the Oolite Commodity Calculator, exact numbers can be input that will give accurate results. Completely understand that the
cim method is the preferred way of doing this hence my desire to learn how to use it properly. That proper use cannot be achieved without this information.

Anyhoot, as usual, this ramble has gone on long enough. Again, any help in solving this minor dilemma would be much appreciated, Thanks for reading.
Humor is the second most subjective thing on the planet

Brevity is the soul of wit and vulgarity is wit's downfall

Good Night and Good Luck - Read You Soon
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Secondary Market Definitions Defined

Post by phkb »

Remember: when defining secondary markets, everything is related to the system or main station price and quantity.
So, the "primary_price" is the current actual price of the good at the main station.
The "primary_quantity" is the current quantity of that good at the main station.
The "local_capacity" is whatever capacity value has been set for your secondary station for that good.
The "primary_capacity" is what the capacity for that good is at the main station.

These aren't chart averages or goods averages. These all relate to the main station market. Secondary markets are tweaked versions of the main market.

Does that help a little? Or have you found that those definitions don't apply?
User avatar
Cholmondely
Archivist
Archivist
Posts: 5365
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Secondary Market Definitions Defined

Post by Cholmondely »

History
1)Aegidian created the original market-related programming based on Classic Elite and then made it modifiable (2003-6)
2)cim changed the market-related programming to something simpler (Oolite v.1.82) (May 2015)
3)Spara came up with his "fix" for converting the old station markets to work with cim's changes (July 2015)
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Secondary Market Definitions Defined

Post by Switeck »

Here's a section from shipdata.plist for one of the secondary stations I modified:

Code: Select all

	"market_capacity" = 63; // maximum capacity for any good
	market_definition = (
		// empty array matches system prices
		// leaving the key out entirely is a blank market
			{
				// Narcotics sometimes available?
				"type" = "class";
				"name" = "oolite-medical";
				"quantity_randomiser" = 2.0;
				"capacity" = 31;
			},
			{
				// import cheap mining products
				"type" = "class";
				"name" = "oolite-mining";
				"quantity_multiplier" = 0.4;
				"quantity_randomiser" = 0.1;
			},
			{
				// Less traveled, less available
				"type" = "default";
				"price_multiplier" = 1.05;
				"price_randomiser" = 0.1;
				"quantity_multiplier" = 0.5;
				"quantity_randomiser" = 0.3;
				"capacity" = 31;
			}
	);
	"market_monitored" = no;
It doesn't work like I want or expected it to.

Prices are consistently lower than the main station, despite a price multiplier of 1.05 -- I'm guessing due to the price randomiser being only 0.1.

Quantities are typically 0 or 1, with the highest being maybe 4. I expected quantities to be 40-50% of the main station.
User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 556
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Secondary Market Definitions Defined

Post by Nite Owl »

phkb wrote: Tue Dec 12, 2023 9:03 am
Remember: when defining secondary markets, everything is related to the system or main station price and quantity.
So, the "primary_price" is the current actual price of the good at the main station.
The "primary_quantity" is the current quantity of that good at the main station.
The "local_capacity" is whatever capacity value has been set for your secondary station for that good.
The "primary_capacity" is what the capacity for that good is at the main station.
If my interpretation of the above is correct then the exact numbers for the "primary_price" and "primary_quantity" are unknowable outside of the game. The only numbers that could be used for these two variables would be the "price_average" = [#] (in decicredits) and the "quantity_average" = [#] (gets rounded) from the trade-goods.plist. These numbers would only be an estimate because they are modified by several of the other trade-goods.plist variables for a specific Good based on the economics of the system that the Secondary Market would appear in. This would work well if that Secondary Market was to only appear in one system so that the economic variables could be calculated. However, if we take an example of a Secondary Market that is going to appear in every system, like Rock Hermits, then the results are much less predictable. It is then going to come down to figuring out the ideal numbers for the variables used by the Secondary Market coding one puts into a shipdata.plist. Not an easy task given the estimations one has to use to get to those numbers. Lots of trial and error to get it just right but worth it in the end. Lesson Learned.

Thank You phkb for the information. It will be most helpful going forward in my quest to code things properly.
Humor is the second most subjective thing on the planet

Brevity is the soul of wit and vulgarity is wit's downfall

Good Night and Good Luck - Read You Soon
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Secondary Market Definitions Defined

Post by phkb »

Nite Owl wrote: Tue Dec 12, 2023 9:57 pm
This would work well if that Secondary Market was to only appear in one system so that the economic variables could be calculated. However, if we take an example of a Secondary Market that is going to appear in every system, like Rock Hermits, then the results are much less predictable.
This might help a bit. Here's something I prepared earlier...

CheckingTradeGoods.oxz

This is a utility I put together that will automate the task of checking on prices around a chart. What it does is automate the process of jumping into every system in the chart, collecting prices and quantities for all trade goods, and then jumping to the next system. At the end, it auto-docks the player and dumps summary information into the latest.log. You can specify what types of things to output via an F4 interface screen. That interface screen is also where you initiate the process from.

By default, it's set to check the main station market. But if you extract the contents, in the script.js file, you can set the "this._stationRole" value to be the role of your station, and it will then check the market there.

Important things to note:
1. Don't run this with lots of OXP's installed. The best method is to have *just* the OXP's you need to check the market. In your case, that sounds like a single station OXP.
2. It will take about 15 minutes to jump to every system (on my rig, at least), so once it starts, just sit back and watch it go. You can check the status in the log file - you'll get a running commentary on how far through the process you are.
3. If you find yourself drifting through space and nothing is happening, it was probably something that stopped a jump - best idea at that point is just to stop the game and restart.
4. It will jump to other galaxies if you have the latest version of 1.91 installed. You can select the galaxy you want to check from the F4 Interface screen.
5. It *won't* check multiple galaxies at a time. Do one galaxy, then restart the game and do another.
6. It *will* automatically jump into the systems of the Great Rift in G7. But it *won't* jump to any of the other unreachable systems in other galaxies.
7. There is no point 7.

There are some more note in the script.js file about the process. Hopefully it all makes sense.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5365
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Secondary Market Definitions Defined

Post by Cholmondely »

Nite Owl wrote: Tue Dec 12, 2023 9:57 pm
phkb wrote: Tue Dec 12, 2023 9:03 am
Remember: when defining secondary markets, everything is related to the system or main station price and quantity.
So, the "primary_price" is the current actual price of the good at the main station.
The "primary_quantity" is the current quantity of that good at the main station.
The "local_capacity" is whatever capacity value has been set for your secondary station for that good.
The "primary_capacity" is what the capacity for that good is at the main station.
If my interpretation of the above is correct then the exact numbers for the "primary_price" and "primary_quantity" are unknowable outside of the game. The only numbers that could be used for these two variables would be the "price_average" = [#] (in decicredits) and the "quantity_average" = [#] (gets rounded) from the trade-goods.plist. These numbers would only be an estimate because they are modified by several of the other trade-goods.plist variables for a specific Good based on the economics of the system that the Secondary Market would appear in. This would work well if that Secondary Market was to only appear in one system so that the economic variables could be calculated. However, if we take an example of a Secondary Market that is going to appear in every system, like Rock Hermits, then the results are much less predictable. It is then going to come down to figuring out the ideal numbers for the variables used by the Secondary Market coding one puts into a shipdata.plist. Not an easy task given the estimations one has to use to get to those numbers. Lots of trial and error to get it just right but worth it in the end. Lesson Learned.

Thank You phkb for the information. It will be most helpful going forward in my quest to code things properly.
So, the basic market in each system is unknowable in advance of arrival at the system (and changes at each arrival) - and the secondary markets are tweaks of that main market.

Cim posted a formula for a totally independent market inside a system which is here.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 556
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Secondary Market Definitions Defined

Post by Nite Owl »

Switeck:
Try this.

Code: Select all

{
	// Less traveled, less available
	"type" = "default";
	"price_multiplier" = 1.5; // 1.05 would only be a 5% price increase where as 1.5 would be a 50% price increase
	"price_randomiser" = 0.1; // a 10% variation above or below the 50% price increase
 	"quantity_multiplier" = 0.5; // this would give you a 50% decrease in quantity from the Main Station
 	"quantity_randomiser" = 0.1; // a 10% variation above or below the 50% decrease from the Main Station
	"capacity" = 31;
}
Gives me a chance to use the new found knowledge. Fingers crossed that this is correct.
Humor is the second most subjective thing on the planet

Brevity is the soul of wit and vulgarity is wit's downfall

Good Night and Good Luck - Read You Soon
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Secondary Market Definitions Defined

Post by phkb »

Cholmondely wrote: Tue Dec 12, 2023 10:29 pm
So, the basic market in each system is unknowable in advance of arrival at the system (and changes at each arrival)
You can get an estimate:

Code: Select all

System.infoForSystem(galaxyNumber, 96).samplePrice("food") / 10

will give you a sample price for food in Digebiti (if you are actually in Galaxy 1). But, as the documentation says
There is of course no guarantee that the price returned by this method will be anywhere near the actual price when the system is next entered.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Secondary Market Definitions Defined

Post by Switeck »

Nite Owl wrote: Tue Dec 12, 2023 11:02 pm
Switeck:
Try this.

Code: Select all

{
	// Less traveled, less available
	"type" = "default";
	"price_multiplier" = 1.5; // 1.05 would only be a 5% price increase where as 1.5 would be a 50% price increase
	"price_randomiser" = 0.1; // a 10% variation above or below the 50% price increase
 	"quantity_multiplier" = 0.5; // this would give you a 50% decrease in quantity from the Main Station
 	"quantity_randomiser" = 0.1; // a 10% variation above or below the 50% decrease from the Main Station
	"capacity" = 31;
}
Gives me a chance to use the new found knowledge. Fingers crossed that this is correct.
The price ends up being way higher than the main station's price always...but what I wanted was either equal or only slightly more than the main station.
(0-0.5 credits more)

As for the quantity, if I raise the "quantity_multiplier" to 5, it's usually slightly more than the main station has for that commodity.
When set to 0.5, the amount available is usually 0-4, tending towards 1-2...while the main station has 10-30 for the same items!
So if I really wanted half what the main station has...I need to use a "quantity_multiplier" of 2-3?!
User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 556
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Secondary Market Definitions Defined

Post by Nite Owl »

The "type" = "default" variable changes the prices and capacities for ALL of the commodities on your Secondary Market. Having played around with these variables for the past few days this one seems to be the most wonky in terms of stable results given the variations possible between each commodity. It seems its best use is when you have defined each individual commodity you want to change and then want the remaining commodities to not exist in the Secondary Market at all. That is the way my test coding has been done so far and it seems to work better then defining commodities in any sort of group. Using the "type" = "class" or "type" = "default" variables defines the commodities in broad strokes while using the "type" = "good" variable is specific to just a single commodity so there seems to be less chance for variations. Yes, it does involve a bit more coding to define each commodity on an individual basis but it seems to be worth it if you get the result you want. Just my observations so far. This is all new to me too. However, the learning curve is slowly becoming a straight line.
Humor is the second most subjective thing on the planet

Brevity is the soul of wit and vulgarity is wit's downfall

Good Night and Good Luck - Read You Soon
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Secondary Market Definitions Defined

Post by Switeck »

The "type" = "default" variable changes the prices and capacities for ALL of the commodities on your Secondary Market...that are not enumerated above it.
But the problem is not with which commodities that modifies, since I have a good handle on commodities modding from working on Switeck's Shipping OXP years ago.
Instead it is the resulting amount of commodities for sale as well as the price bump that are far less intuitive than they appear.
They are multipliers of multipliers of original unknown values found at the main station.

I state original unknown values because phkb had to code a round-the-galactic-chart jump path to visit all the systems to get spot-check commodity values for the main stations:
https://bb.oolite.space/viewtopic.ph ... 81#p292681
(And I spotted swi2 variable logic which looks suspiciously similar to something I never "officially" released as an OXP/OXZ. 8) Good to see it's used somewhere!)
Post Reply