SW Economy
Moderators: winston, another_commander
Re: SW Economy
I've been meaning to change the market slightly for TL 14-16 systems, unreachable systems (Oresrati GC8), and possibly very low TL as well.
Wouldn't be too hard to add or reduce how much they have for sale. Changing prices would probably interfere with more other OXZs.
Wouldn't be too hard to add or reduce how much they have for sale. Changing prices would probably interfere with more other OXZs.
Re: SW Economy
Bug report, or perhaps "edge case resilience" suggestion. My Latest.log complained of line 33 and 31 in market_restore.js from this OXP. It was attempting to set the quantity of alloys to a value larger than 127 (which is out of range for the setMarketQuantity function, triggering the line 33 error) and subsequently complained that the market was undefined (line 31 error).
It appears line 42 has incorrect capitalization, shipWillEnterWitchSpace instead of Witchspace.
It also seems that the capacity attribute of a market definition is not always present when retrieving the ship (station) market property in OOJS. When omitted, the mainStation capacity is used.
Therefore, I revised the code, as follows (second function included for fixed capitalization):
This seems to have solved the problem. An Octahedron Outpost and Super Hub I in my current system are reported to have undefined capacity.
It appears line 42 has incorrect capitalization, shipWillEnterWitchSpace instead of Witchspace.
It also seems that the capacity attribute of a market definition is not always present when retrieving the ship (station) market property in OOJS. When omitted, the mainStation capacity is used.
Therefore, I revised the code, as follows (second function included for fixed capitalization):
Code: Select all
//restore market when station is spawned
this.shipSpawned = function(ship) {
if (ship.isStation) {
var index = this.$primaryRoles.indexOf(ship.primaryRole);
if (index !== -1) {
var commodities = ["food","textiles","liquor_wines","furs","medicine","luxuries","alloys","machinery","computers","water","oxygen","minerals","radioactives","gold","platinum","gem_stones","alien_items","slaves","narcotics","firearms"];
var market = this.$markets.splice(index, 1)[0];
var i, commodity;
for (i = 0; i < market.length; i++) {
commodity = commodities[i];
if (ship.market[commodity] === undefined) {
log(this.name, ship.name + " has undefined market entry for commodity " + commodity + ": SW Economy will skip");
continue;
} else if (ship.market[commodity].capacity === undefined) {
log(this.name, ship.name + " has undefined capacity for commodity " + commodity + ": SW Economy will use " + system.mainStation.market[commodity].capacity + " as limit");
ship.setMarketQuantity(commodity, Math.min(system.mainStation.market[commodity].capacity, market[i][0]));
} else {
ship.setMarketQuantity(commodity, Math.min(ship.market[commodity].capacity, market[i][0]));
}
ship.setMarketPrice(commodity, market[i][1]);
}
this.$primaryRoles.splice(index, 1);
}
}
}
//wipe everything when leaving system
this.shipWillEnterWitchspace = function() {
this.$primaryRoles = new Array();
this.$markets = new Array();
delete this.shipSpawned;
}
- Cholmondely
- 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: SW Economy
Just wondering if this would be useful for marking out mining systems: World script event handlers: chartHightlightModeChanged
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?
•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?
- Cholmondely
- 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: SW Economy
Finally started playing again! I've yet to tweak SW Economy. But at first blush:phkb wrote: ↑Thu Feb 29, 2024 10:53 pmHere's something I prepared earlier.
SWEconomy_3.9.oxz
I don't have scope to properly test this at the moment, but maybe it will work first try? Worth a shot, anyway.
So, this is a re-work of SW Economy so that it uses the new Market Script Interface OXP. I also put all the customisations into Library Config, so you can tweak it from there. Note, though, that if you tweak settings that would apply to the current system, you won't see the impact until the system is regenerated (ie jump out and then back).
The final tweak was for mining worlds. They should have a bump in prices for agricultural products. As well, I've added an indicator to the chart screens so its now possible to quickly see which systems are mining worlds. This does nothing in the vanilla game, because no systems mean Stranger's criteria for a mining world (TL < 4, planet radius < 54250), at least in chart 1. I suppose one of his other OXP's must tweak the planet sizes.
As I said, I haven't fully tested this, as I'd need to set up an environment with a SW config, and I don't really have time for that. But hopefully everything will work first time. Let me know if it goes OK. I do have Stranger's permission to update this in the DM if we're comfortable with the changes.
1) Ararus has TL4 and is "extremely agricultural" but its radius (6221km) should mean it has an agricultural economy and it usually produces furs et al.
Not now! It's just like the older version SWEconomy - low prices for food/furs etc but none of those goods for sale - and oodles of minerals and radioactives for sale instead.
2) Ararus's Rock Hermit has virtually nothing for sale (usually has lots!) - just 3TC of highly priced radioactives and some Quirium Crystal.
3) Peculiar effects on the station markets at Ensoreus (Nuit, SothisTC, Superhub, Nephthys) - some had very low prices for gold (30₢/kg) and/or furs (20₢/TC) and/or food and/or textiles and/or computers (20₢/TC)...
My current OXP cocktail recipe includes Smugglers (+ addenda, and currently not affecting either Ensoreus or Ararus), Risky Business (with cim's Risk-based Economy enabled), the various market-tweaked stations (Nuit, SothisTC, Nephthys) and Spara's "Ye Olde Hermits".
Question: is there any way to get Oolite to display how it calculates the markets?
Anyway, I'll do some more playing and report back when I've visited a proper mining world.
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?
•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?
- phkb
- 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: SW Economy
OK, so there are some bugs, in strangers original and my update.
1. The mining worlds, in strangers original and in my updated version, are defined as having techlevel < 4 and planet radius < 54250. However, *all* systems have a radius < 54250. I think this should have been 5425.
2. My calc to bump mining goods in mining worlds wasn't having as much of an impact as it should because of a similar error in the calc.
3. My code to add "(M)" to mining worlds wasn't working because of a bug. But it's probably just as well, as it would have ended up flagging all TL<4 systems as mining.
I'm going to run some tests today to see what impact the fixes above have.
1. The mining worlds, in strangers original and in my updated version, are defined as having techlevel < 4 and planet radius < 54250. However, *all* systems have a radius < 54250. I think this should have been 5425.
2. My calc to bump mining goods in mining worlds wasn't having as much of an impact as it should because of a similar error in the calc.
3. My code to add "(M)" to mining worlds wasn't working because of a bug. But it's probably just as well, as it would have ended up flagging all TL<4 systems as mining.
I'm going to run some tests today to see what impact the fixes above have.
- phkb
- 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: SW Economy
OK, it's slightly confusing.
In the current system, if you check the radius of the main planet, it returns something like 41160 km (using Lave as the example here). However, if you use something like this:
you'll get 4116. And 4116 km is what you see on the F7 System Data screen.
I don't think this changes the fixes I'm applying, but it's worth understanding where my bug came from, and why it would be different in strangers original (he was always checking the system.mainPlanet.radius).
In the current system, if you check the radius of the main planet, it returns something like 41160 km (using Lave as the example here). However, if you use something like this:
Code: Select all
System.infoForSystem(galaxyNumber, system.ID).radius
I don't think this changes the fixes I'm applying, but it's worth understanding where my bug came from, and why it would be different in strangers original (he was always checking the system.mainPlanet.radius).
- Cholmondely
- 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: SW Economy
Stranger's original does distinguish between more and less than 5425 (or some such). G1 Ararus has an agricultural economy, selling furs et al. G2 Laenin does not.phkb wrote: ↑Mon Mar 11, 2024 12:02 amOK, so there are some bugs, in strangers original and my update.
1. The mining worlds, in strangers original and in my updated version, are defined as having techlevel < 4 and planet radius < 54250. However, *all* systems have a radius < 54250. I think this should have been 5425.
2. My calc to bump mining goods in mining worlds wasn't having as much of an impact as it should because of a similar error in the calc.
3. My code to add "(M)" to mining worlds wasn't working because of a bug. But it's probably just as well, as it would have ended up flagging all TL<4 systems as mining.
I'm going to run some tests today to see what impact the fixes above have.
I've not yet tested your tweak on Laenin.
And Stranger's Habitable planets changes the radii. (I think it's that OXP, rather than another of his suite).
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?
•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?
- phkb
- 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: SW Economy
SW Economy (original) was only ever looking at the current system. Thus it was using the larger number,Cholmondely wrote: ↑Mon Mar 11, 2024 12:19 amStranger's original does distinguish between more and less than 5425 (or some such). G1 Ararus has an agricultural economy, selling furs et al. G2 Laenin does not.
My tweaked version is using System.infoForSystem, so I needed to use the smaller number. So, the bug was just in mine.
I'm doing some tests at the moment. Here's what I get in Laenin (main station):
Code: Select all
Food price: 6.8 ₢, qty: 14
Textiles price: 16.0 ₢, qty: 8
Furs price: 57.3 ₢, qty: 16
Liquor/Wines price: 24.8 ₢, qty: 12
Minerals price: 9.1 ₢, qty: 83
Radioactives price: 14.7 ₢, qty: 34
Gold price: 33.2 ₢, qty: 13
Platinum price: 56.3 ₢, qty: 24
Gem-Stones price: 15.0 ₢, qty: 8
And here's the main station at Ararus:
Code: Select all
Food price: 9.0 ₢, qty: 39
Textiles price: 13.9 ₢, qty: 18
Furs price: 53.8 ₢, qty: 38
Liquor/Wines price: 21.9 ₢, qty: 19
Minerals price: 10.8 ₢, qty: 65
Radioactives price: 19.6 ₢, qty: 27
Gold price: 37.9 ₢, qty: 12
Platinum price: 69.0 ₢, qty: 11
Gem-Stones price: 16.3 ₢, qty: 5
- phkb
- 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: SW Economy
Actually, on reflection, I think the mining world farming good should be reduced a lot more, and the prices for them should be increased a bit more. I'll have a play with some tweaks.
- phkb
- 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: SW Economy
Here's Laenin after some tweaks:
Code: Select all
Food price: 7.9 ₢, qty: 10
Textiles price: 16.2 ₢, qty: 5
Furs price: 65.1 ₢, qty: 9
Liquor/Wines price: 24.4 ₢, qty: 5
Minerals price: 8.9 ₢, qty: 81
Radioactives price: 16.3 ₢, qty: 33
Gold price: 32.8 ₢, qty: 13
Platinum price: 59.3 ₢, qty: 26
Gem-Stones price: 17.2 ₢, qty: 17
- Cholmondely
- 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: SW Economy
Ummm...phkb wrote: ↑Mon Mar 11, 2024 12:26 amSW Economy (original) was only ever looking at the current system. Thus it was using the larger number,Cholmondely wrote: ↑Mon Mar 11, 2024 12:19 amStranger's original does distinguish between more and less than 5425 (or some such). G1 Ararus has an agricultural economy, selling furs et al. G2 Laenin does not.
My tweaked version is using System.infoForSystem, so I needed to use the smaller number. So, the bug was just in mine.
I'm doing some tests at the moment. Here's what I get in Laenin (main station):Does that look any better?Code: Select all
Food price: 6.8 ₢, qty: 14 Textiles price: 16.0 ₢, qty: 8 Furs price: 57.3 ₢, qty: 16 Liquor/Wines price: 24.8 ₢, qty: 12 Minerals price: 9.1 ₢, qty: 83 Radioactives price: 14.7 ₢, qty: 34 Gold price: 33.2 ₢, qty: 13 Platinum price: 56.3 ₢, qty: 24 Gem-Stones price: 15.0 ₢, qty: 8
just off the top of my head,
in my antiquarian (Stranger's original) version of SWEconomy, Laenin's prices for agricultural Food, Textiles, Furs, Liquor/Wines & Medicine are really low. But there are none of them - zippity doo-dah - for sale. Just minerals et al.
Stranger succeeded with the market quantities. But failed with the prices. What Stranger was trying to achieve was high prices for food/textiles/liquor/wines/medicine as they could not be sourced locally and need to be imported.
His SWEconomy managed to produce the right quantities (zero) but the wrong prices (far too low) for these mining worlds.
Why does this matter?
Well. Stranger is into his astronomy. Laenin has too small a radius to have the gravity to have an atmosphere capable of growing plants/rearing animals. And. Laenin's wealth (poor agri) & TL (4) is too low to allow technology (eg. hydroponics/terraforming/etc.) to remedy this. (See his essay on Habitable Planets: Can a planet with a radius of a pathetically tiny 3000 km possibly be an advanced agriculture world with a population of billions of residents? Definitely no way! Such a planet is far too small to maintain a dense and warm atmosphere. If it were located in the habitable zone of a solar system, then that small planet would have an extremely rarefied atmosphere with an atmospheric pressure of a few millibars - or less! ...).
So the only resources the planet has to offer are mining commodities.
So Laenin needs food. And textiles. And wine/liquors. And medicine. (And from industrial worlds, also machinery, and possibly alloys et al). The idea is that Laenin is no longer an agricultural world but is now a "mining world" (the third trading pole vis-a-vis the agris and the industs - and they each produce goods which Laenin will pay well for).
I'm sorry. I seem to be doing an utterly lousy job of explaining what SWEconomy is supposed to do.
Basically.
1) Agri worlds sell food to Mining worlds.
2) Mining worlds sell raw materials to Industrial worlds.
3) Industrial worlds sell machinery et al to Agri worlds.
SWEconomy is broken because Stranger was unable to create high food prices for his "mining worlds". Consequently, there is no profit in selling food to mining worlds. This is because mining world prices are identical to agri worlds. Stranger has not found a way to fix this and change the mining world prices.
The entire matter is further complicated because he had no way to label his "mining worlds "as such. They are labelled as poor agri worlds because Oolite does not seem to allow labelling them as mining worlds instead. If one knows what Stranger is up to, then one knows that small radii poor agris with low TL are mining worlds. And one expects markets to match - which they don't exactly (thanks to the low food prices).
Does that make it all any clearer?
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?
•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?
- phkb
- 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: SW Economy
Got it: Mining worlds should have low farming quantities, but high prices.
Previously you mentioned that one problem with SW Economy was that there were zero commodities of farming goods available, and I put a tweak together that reduced them instead. Can I assume that you would prefer the quantity of farming goods to be zero if the prices can be increased?
Re: Ensoreus
I've run my checks through, and for Extreme Industrial (which covers Ensoreus) I get these stats:Not sure what influenced Ensoreus' market in your game to get a value so low for gold.
Previously you mentioned that one problem with SW Economy was that there were zero commodities of farming goods available, and I put a tweak together that reduced them instead. Can I assume that you would prefer the quantity of farming goods to be zero if the prices can be increased?
Re: Ensoreus
I've run my checks through, and for Extreme Industrial (which covers Ensoreus) I get these stats:
Code: Select all
commodity price min price avr price max qty min qty avr qty max availability
food 15.1 16.9 18.4 0 0 0 0.00%
textiles 23.9 25.2 26.6 0 0 0 0.00%
liquor_wines 35.1 37.2 39.6 0 0 0 0.00%
furs 71.9 82.4 94.2 0 0 0 0.00%
medicine 72.7 80.1 87.6 1 0 2 10.00%
luxuries 58.3 62.6 70.1 11 17 28 100.00%
alloys 33.2 38.3 43.3 19 36 56 100.00%
machinery 39.6 41.9 44.3 43 60 87 100.00%
computers 57.3 62.4 68.8 19 26 37 100.00%
water 8.7 9.0 9.2 38 41 45 100.00%
oxygen 17.5 18.0 18.6 14 19 29 100.00%
minerals 12.7 13.2 13.6 49 53 58 100.00%
radioactives 26.7 28.9 30.9 3 5 8 100.00%
gold 38.1 42.5 45.8 2 4 8 100.00%
platinum 68.8 74.9 81.7 1 6 19 73.30%
gem_stones 19.0 21.4 23.6 1 4 9 100.00%
alien_items 73.3 74.9 77.3 0 0 0 0.00%
slaves 46.3 63.2 79.4 1 0 4 6.70%
narcotics 11.0 44.3 86.9 17 4 41 13.30%
firearms 46.4 52.4 57.1 13 8 127 10.00%
- Cholmondely
- 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: SW Economy
1) Mining worlds should have zero farming quantities. No atmosphere -> no farms (unless they have wealth or technology, but then they defined out of being "mining worlds" and back to being "Agricultural worlds" by SW Economy).phkb wrote: ↑Mon Mar 11, 2024 1:30 amGot it: Mining worlds should have low farming quantities, but high prices.
Previously you mentioned that one problem with SW Economy was that there were zero commodities of farming goods available, and I put a tweak together that reduced them instead. Can I assume that you would prefer the quantity of farming goods to be zero if the prices can be increased?
Re: Ensoreus
I've run my checks through, and for Extreme Industrial (which covers Ensoreus) I get these stats:Not sure what influenced Ensoreus' market in your game to get a value so low for gold.Code: Select all
commodity price min price avr price max qty min qty avr qty max availability food 15.1 16.9 18.4 0 0 0 0.00% textiles 23.9 25.2 26.6 0 0 0 0.00% liquor_wines 35.1 37.2 39.6 0 0 0 0.00% furs 71.9 82.4 94.2 0 0 0 0.00% medicine 72.7 80.1 87.6 1 0 2 10.00% luxuries 58.3 62.6 70.1 11 17 28 100.00% alloys 33.2 38.3 43.3 19 36 56 100.00% machinery 39.6 41.9 44.3 43 60 87 100.00% computers 57.3 62.4 68.8 19 26 37 100.00% water 8.7 9.0 9.2 38 41 45 100.00% oxygen 17.5 18.0 18.6 14 19 29 100.00% minerals 12.7 13.2 13.6 49 53 58 100.00% radioactives 26.7 28.9 30.9 3 5 8 100.00% gold 38.1 42.5 45.8 2 4 8 100.00% platinum 68.8 74.9 81.7 1 6 19 73.30% gem_stones 19.0 21.4 23.6 1 4 9 100.00% alien_items 73.3 74.9 77.3 0 0 0 0.00% slaves 46.3 63.2 79.4 1 0 4 6.70% narcotics 11.0 44.3 86.9 17 4 41 13.30% firearms 46.4 52.4 57.1 13 8 127 10.00%
2) My Ensorean Gold prices:
Main Orbital Station (& Superhub) - 40.9₢
Nuit Station - 29.6₢
Sothis TC Station - 30.4₢
Nephthys Station - 32.7₢
Visiting Liner Market - 46.0₢
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?
•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?
- phkb
- 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: SW Economy
OK, here's how mining systems look across chart 1 after some tweaking:
There are 19 systems in chart 1 that are in this group, and it's worth noting that their stated economy if either "Strong" or "Extreme" Agricultural.
What do you think? Is this kind of what you'd be expecting?
Code: Select all
Mining systems
commodity price min price avr price max qty min qty avr qty max availability
food 12.0 14.4 18.2 0 0 0 0.00%
textiles 25.0 28.5 31.4 0 0 0 0.00%
liquor_wines 38.1 43.3 48.2 0 0 0 0.00%
furs 67.2 81.5 94.7 0 0 0 0.00%
medicine 43.6 50.5 55.7 0 0 0 0.00%
luxuries 85.7 92.8 99.3 0 0 0 0.00%
alloys 38.8 41.8 46.4 0 0 0 0.00%
machinery 64.5 67.9 71.4 0 0 0 0.00%
computers 88.6 98.8 107.0 0 0 0 0.00%
water 2.8 3.3 4.0 61 68 74 100.00%
oxygen 11.5 12.2 13.0 0 0 0 0.00%
minerals 8.8 9.6 10.3 67 76 87 100.00%
radioactives 14.8 17.6 19.2 24 29 34 100.00%
gold 29.7 34.6 38.0 10 13 17 100.00%
platinum 53.4 61.6 68.7 12 24 40 100.00%
gem_stones 13.7 16.7 19.9 4 8 11 100.00%
alien_items 23.8 28.2 34.2 0 0 0 0.00%
slaves 1.4 22.0 41.9 10 19 34 100.00%
narcotics 16.0 52.4 90.1 5 34 58 100.00%
firearms 79.7 85.3 90.6 1 20 101 47.40%
What do you think? Is this kind of what you'd be expecting?
- phkb
- 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: SW Economy
In the hope I've got this working now, here's a download link: SWEconomy_3.9.1.oxz