Secondary Market Definitions Defined

General discussion for players of Oolite.

Moderators: another_commander, winston

User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4612
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 »

Switeck wrote: Thu Dec 14, 2023 3:17 am
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!
:D
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4612
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 »

Switeck wrote: Thu Dec 14, 2023 3:17 am
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
As I mentioned up-thread, you can get an estimate using SystemInfo.samplePrice for any system in the current galaxy. How different it would be to actually jumping into the system, I'm not sure, but if you don't want to do the whole jumping process thing, that might be an easier place to start.
User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 518
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Secondary Market Definitions Defined

Post by Nite Owl »

Switeck wrote: Thu Dec 14, 2023 3:17 am
The "type" = "default" variable changes the prices and capacities for ALL of the commodities on your Secondary Market...that are not enumerated above it.
Yes, my previous post should have been clearer with regards to that. The wibbly-wobbly timey-winey "unknowns" mentioned in your previous post are still the primary problem. The experimentation continues.
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: 2412
Joined: Mon May 31, 2010 11:11 pm

Re: Secondary Market Definitions Defined

Post by Switeck »

Nite Owl wrote: Thu Dec 14, 2023 3:59 am
The wibbly-wobbly timey-winey "unknowns" mentioned in your previous post are still the primary problem. The experimentation continues.
I'm reasonably sure part of the tiny quantities at secondary stations is caused by using:
"capacity" = 31;
...where the main station is hard-coded to a max capacity of 63 if you're buying or 127 if you're selling.

If the quantity for sale at the main station is calculated firstly as a percentage value (0% to 100%) and then multiplied by its max capacity, then maybe the reason the secondary station isn't getting the same quantity for sale is because it's likewise taking the same percentage value and multiplying by its max capacity, which is considerably smaller than the main station.

So to match the main station, we need to know the max capacity of both the main station and the secondary station to determine the ratio difference.
...Then cram that value into:
"quantity_multiplier"
for that secondary station.
User avatar
Cholmondely
Archivist
Archivist
Posts: 4965
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: Thu Dec 14, 2023 3:59 am
Switeck wrote: Thu Dec 14, 2023 3:17 am
... that are not enumerated...
The wibbly-wobbly timey-winey "unknowns"...
Gentlemen,

if I'm following this, then it seems that cim's new market system is every little bit as horrendous as Aegidian's predecessor - but with the added complication that nobody really knows what the various levers do either! It just looks "cleaner"!



Can I ask:

0) Might cim have included some comments in the vanilla game code which might explain a little more? I understand that he was one of our better commentators...

1) Is it actually possible to "fix" SW Economy so that the markets of the so-called mining systems actually act as such (rather than as agriculturals with zero quantities of agricultural commodities but with low prices for them)?
- ie high prices for food, wine & liquor, medicine; moderate prices for textiles & furs; high prices for machinery; moderate prices for computers & luxuries, rock bottom prices for minerals & water.

2) Is Vincentz's project (New Deal) achieveable? (His 4-way economy).

3) Is Phasted's Real-Life economics modifiable to also change the quantities (it currently changes the prices only, but over time they tend towards zero if one stays in the system for long enough).

This last might be a bit unreal. Real-life changes in prices make a lot of sense, but if the real trade market are the visible (and invisible) contracts markets, then while prices/quantities would change, a Jameson in a Cobra would have little medium-term affect.
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: 4612
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: Thu Dec 14, 2023 5:00 pm
0) Might cim have included some comments in the vanilla game code which might explain a little more? I understand that he was one of our better commentators...
There's nothing extra in the code that I can see. The rock hermit market_definitions in shipdata.plist have a bit of info.
Cholmondely wrote: Thu Dec 14, 2023 5:00 pm
1) Is it actually possible to "fix" SW Economy so that the markets of the so-called mining systems actually act as such (rather than as agriculturals with zero quantities of agricultural commodities but with low prices for them)?
I thought I fixed this?
Cholmondely wrote: Thu Dec 14, 2023 5:00 pm
2) Is Vincentz's project (New Deal) achieveable? (His 4-way economy).
Not with a market_definition. You would need to use a market script to achieve this.
Cholmondely wrote: Thu Dec 14, 2023 5:00 pm
3) Is Phasted's Real-Life economics modifiable to also change the quantities
Yes.

But let me return to my original offer. Do you want a demo/walkthough of a market_definition, or a market_script? It all comes down to what you're trying to achieve.
User avatar
Cholmondely
Archivist
Archivist
Posts: 4965
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 »

phkb wrote: Thu Dec 14, 2023 9:14 pm
Cholmondely wrote: Thu Dec 14, 2023 5:00 pm
0) Might cim have included some comments in the vanilla game code which might explain a little more? I understand that he was one of our better commentators...
There's nothing extra in the code that I can see. The rock hermit market_definitions in shipdata.plist have a bit of info.
Cholmondely wrote: Thu Dec 14, 2023 5:00 pm
1) Is it actually possible to "fix" SW Economy so that the markets of the so-called mining systems actually act as such (rather than as agriculturals with zero quantities of agricultural commodities but with low prices for them)?
I thought I fixed this?
Cholmondely wrote: Thu Dec 14, 2023 5:00 pm
2) Is Vincentz's project (New Deal) achieveable? (His 4-way economy).
Not with a market_definition. You would need to use a market script to achieve this.
Cholmondely wrote: Thu Dec 14, 2023 5:00 pm
3) Is Phasted's Real-Life economics modifiable to also change the quantities
Yes.

But let me return to my original offer. Do you want a demo/walkthough of a market_definition, or a market_script? It all comes down to what you're trying to achieve.
1) SW Economy

I'm sorry, I should have gotten back to you about your market_tweak script for SW Economy - too much on my plate, I'm afraid. All I did was look at it and play the version you sent without modifying it.

You allowed tweaking the agri-goods quantities between 66% - 25% of the original quantities (line 18 below). But Stranger was trying to create a 3rd economy pole - planets rather like the rock hermits, which have minimal or no agriculture, and hence no agricultural exports, and have to import the agricultural products instead.

So trade (in theory - but not in his oxp) flows from the (first) agricultural pole to the (second) mining pole and then from the mining pole to the (third) industrial pole. And then from the industrial pole back to the agricultural.

Agri food/textiles/furs/medicine > Mining or RH minerals/gold/platinum/gems > Industrial Alloys/Machinery/computers/luxuries > agri

And SW Economy stops the agriculturals from selling any industrial stuff, and the industrials from selling agricultural goods. So I expected to see either none or very low quantities of agriculturals in the mining worlds, but more crucially to see very high prices for the agricultural products - which I didn't. Whereas the prices for food/liquors etc are high in the rock hermits.

This rather wrecked the third mining pole for me, I'm afraid!



NB: The claimed interactions for SW Economy are not perfect.
eg.: One would expect Machinery to command high prices in both Agricultural and Mining worlds. Not so sure about computers & luxuries: surely only the rich agri worlds would splash out on those unless there was a desperate need for weather/earthquake predictors or some such.
eg.: One would expect medicine to be in great demand on RHs rather than selling for rock-bottom prices at low tech agri RH's. That is just bizarre!

SW Economy probably needs somebody like Switeck to sit down and work out what would make sense in terms of supply and demand for the various commodities in the 8 economies. And then one could see if it would be programmable.

Your market_tweak script (to replace Stranger's original):

Code: Select all

"use strict";
this.name = "market_tweak.js";
this.author = "Stranger";
this.copyright = "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description = "Script for selecting market preset";
this.version = "3.7.2";

/*
    Tweaked by phkb
    Instead of completely zeroing out quantities of food, textiles, liquor and furs in systems with harsh conditions,
    I've instead reduced the amounts for sale by half. Can be adjusted by changing the "this._harshFactor" variable up or down.
    Also added code to make tweaks apply to all system stations, not just main station. Turned off by default, but can be turned on
    by changing "this._applyToAll" to "true";
*/

this._applyToAll = false;
this._harshMining = {
    agri_quantity_reductor: 2, // increase this value to remove more agri-related goods (1.5 = 2/3rds of original, 2 = half original, 3 = 1/3rd of original, 4 = 1/4th of original)
    price_discount_factor: 2.0, // increase this value to make the price discount of mining goods greater
    quantity_increase_factor: 2.5 // increase this value to make the quantity boost of mining goods factor greater
};

//-------------------------------------------------------------------------------------------------------------
this.startUp = function () {
    //log(this.name, "this OXP initialising!");
}

this.shipExitedWitchspace = function () {                     // Welcome to system!

    if (system.isInterstellarSpace) return;                 // oops... we have a problem with navigation

    var industry_adjust = (25000 + system.productivity) / 50000; // production of industrial goods vs GNP scaling
    var agro_adjust = (10000 + system.productivity) / 25000; // production of agro goods vs GNP scaling
    var goods_store;

    if (this._applyToAll) {
        var stns = system.stations; // use this to apply to all stations
    } else {
        var stns = [];
        stns.push(system.mainStation); // use this to only apply to main station
    }
    var i = stns.length;
    
    while (i--) {
        var stn = stns[i];

        if ((system.techLevel + 2 * system.government) > 12) { // illegal goods prohibited in (tech OR social) advanced worlds
            stn.setMarketQuantity("slaves", 0);
            stn.setMarketQuantity("narcotics", 0);
            stn.setMarketQuantity("firearms", 0);
        }

        if (system.economy > 4) { // items unavailable in agrarian worlds
            stn.setMarketQuantity("computers", 0);
            stn.setMarketQuantity("machinery", 0);
            stn.setMarketQuantity("alloys", 0);
        }

        if (system.economy < 3) { // items unavailable in industrial worlds
            stn.setMarketQuantity("food", 0);
            stn.setMarketQuantity("textiles", 0);
            stn.setMarketQuantity("liquor_wines", 0);
            stn.setMarketQuantity("furs", 0);
        }

        if (system.techLevel < 4 && system.mainPlanet.radius < 54250) { // too harsh conditions to produce much by archaic methods
            goods_store = parseInt(stn.market.food.quantity / this._harshMining.agri_quantity_reductor);
            stn.setMarketQuantity("food", goods_store);
            goods_store = parseInt(stn.market.textiles.quantity / this._harshMining.agri_quantity_reductor);
            stn.setMarketQuantity("textiles", goods_store);
            goods_store = parseInt(stn.market.liquor_wines.quantity / this._harshMining.agri_quantity_reductor);
            stn.setMarketQuantity("liquor_wines", goods_store);
            goods_store = parseInt(stn.market.furs.quantity / this._harshMining.agri_quantity_reductor);
            stn.setMarketQuantity("furs", goods_store);
            // bump mining goods by factors relating to TL/radius/productivity
            var prod_factor = (((system.productivity / 4500) * 4 + (system.techLevel / 3) + (system.mainPlanet.radius / 45000)) / 100) * this._harshMining.quantity_increase_factor;
            var price_factor = (((system.productivity / 4500) * 3 + (system.techLevel / 3) + (system.mainPlanet.radius / 45000)) / 100) * this._harshMining.price_discount_factor;
            var list = Object.keys(system.mainStation.market);
            log(this.name, "prod factor = " + prod_factor);
            log(this.name, "price factor = " + price_factor);
            for (var j = 0; j < list.length; j++) {
                if (stn.market[list[j]].classes.indexOf("oolite-mining") >= 0) {
                    var amt = stn.market[list[j]].quantity * 10;
                    var price = stn.market[list[j]].price;
                    log(this.name, "pre: " + list[j] + " price = " + price + ", amt = " + amt / 10);
                    stn.setMarketQuantity(list[j], parseInt((amt + amt * prod_factor)) / 10);
                    stn.setMarketPrice(list[j], parseInt(price - price * price_factor))
                    log(this.name, "post: " + list[j] + " price = " + stn.market[list[j]].price + ", amt = " + stn.market[list[j]].quantity);
                }
            }
        }

        if ((system.economy > 2) && (system.techLevel > 3)) { // items available only in archaic tech OR industrial worlds    
            stn.setMarketQuantity("minerals", 0);
            stn.setMarketQuantity("radioactives", 0);
        }

        if (system.techLevel < 7) { // items unavailable below median tech limit
            stn.setMarketQuantity("computers", 0);
            stn.setMarketQuantity("medicine", 0);
            stn.setMarketQuantity("luxuries", 0);
        } else {
            goods_store = Math.floor(stn.market.computers.quantity * industry_adjust);
            stn.setMarketQuantity("computers", goods_store);
            goods_store = Math.floor(stn.market.medicine.quantity * agro_adjust);
            stn.setMarketQuantity("medicine", goods_store);
            goods_store = Math.floor(stn.market.luxuries.quantity * industry_adjust);
            stn.setMarketQuantity("luxuries", goods_store);
        }

        if (system.techLevel < 4) { // items unavailable in archaic tech worlds
            stn.setMarketQuantity("machinery", 0);
            stn.setMarketQuantity("alloys", 0);
            stn.setMarketQuantity("oxygen", 0);
        } else {
            goods_store = Math.floor(stn.market.machinery.quantity * industry_adjust);
            stn.setMarketQuantity("machinery", goods_store);
            goods_store = Math.floor(stn.market.alloys.quantity * industry_adjust);
            stn.setMarketQuantity("alloys", goods_store);
            goods_store = Math.floor(stn.market.oxygen.quantity * industry_adjust);
            stn.setMarketQuantity("oxygen", goods_store);
        }
        
        // low tech production, but needs some investments 
        goods_store = Math.floor(stn.market.liquor_wines.quantity * agro_adjust);
        stn.setMarketQuantity("liquor_wines", goods_store);
        goods_store = Math.floor(stn.market.furs.quantity * agro_adjust);
        stn.setMarketQuantity("furs", goods_store);
    }
}
2) Worked examples

How about some tweaked markets for some of the extra stations: say Hathor which is supposed to offer cheap agricultural products. Presumably this would be at rich agri worlds (they can afford to pay for a Hathor and protect it from pirates).
KW's blurb: For several years, traders had been complaining about prices and availability of products at the main GalCop stations. Being the only trade point for a system, demand was high and prices often matched, leaving a very slim profit margin for many, especially new traders or those independent pilots w/out large contracts. To this end, several businesses began trading from large dockable ships and sometimes asteroid bases, setting up independent markets that could cater to bulk haulers, casual traders and even hard up pilots trying to make a living but unable to afford the prices at main stations.

The Hathor was designed as a wholesaler - dealing with bulk traders for supply they stocked plenty and were able to keep prices low, ensuring a steady stream of traffic. The stations also provided simple but cheap hotel rooms for pilots wishing to leave their ships but unable to afford accommodation on the main stations. The restaurants on a Hathor are also cheap, attracting many pilots who come just to eat rather than trade, income that helps support the station. Although the range of goods at a Hathor is not as broad as a main station, this is not their point : they deal mainly in staples and essentials, which is exactly where a lot of pilots make their living.


Image
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: 4612
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 »

From the sounds of it, I think everyone wants to see how to rework the entire economy to create 3/4/5/x-pole trade routes, all with the existing tech. Would that be a fair assessment?
User avatar
Cholmondely
Archivist
Archivist
Posts: 4965
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 »

I do. Not sure about the rest of our motley crew!

I find Stranger's and Vincentz's models fascinating. But Stranger's has issues, as adumbrated above.

Vincentz's model probably does too: I've not thought it over critically.

The available complexities are good - I can see that a rich agricultural could have a very different economy from a poor agricultural. Ditto with rich and poor industrials. Each of the Mainly's should presumably specialise in different mixtures.

I like Stranger's use of planet size as a limiting factor on agriculturals (but take on board Redspear's critique - however I do feel that Stranger's limiting of exclusively mining worlds to the lower TLs probably annuls it).

I like Stranger's use of low TL to limit production of computers, machinery, luxuries, & medicine. And of low GDP to limit quantity.

I also like Redspear's idea of limiting demand. How many luxuries will a dirt-poor TL1 anarchy actually be able to buy?

I like Redspear's idea of including trading tips (demand/supply) on the F7 screen. And his idea of making species relevant.

I feel strongly that with the vast collection of ideas out there (redefining economies and introducing more poles (SW Economy/New Deal); dynamic variations in price and quantity (Real Life Economics), taking into account economy type, politics, species, GDP, planet size (SW Economy - to an extent); distance from safe trading zones/hub count (Risky business/Risk-based economy/Real Life Economics); distance from place of production (whiskey OXP)

The overriding point is this. It has to be complex but be predictable. The idea that eg. only Mainly Agriculturals will have a high demand for Machinery seems contrived.

There is a lot more to say, but this should be enough to get a ball rolling!

Reference: Economics
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: 518
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Secondary Market Definitions Defined

Post by Nite Owl »

phkb wrote: Fri Dec 15, 2023 12:54 am
From the sounds of it, I think everyone wants to see how to rework the entire economy to create 3/4/5/x-pole trade routes, all with the existing tech. Would that be a fair assessment?
If you want to go into that deep a dive my belief is that it would certainly result in something positive. Re-imagining the entire Oolite economy or even attempting to alter it in the way that Stranger's OXZs do was not my reason for starting this thread. The origin of my inquiry goes back to THIS POST from 2021 to which there was not a conclusive answer or as lively a discussion as in this thread. Understandable, as that older post was buried in the Tinkerer's Workshop while this one is a whole new topic. A recent recommendation on my part of the "spara method" versus the "cim method" sparked my interest in again trying to learn the correct and most recent way of coding things. The result of that need to learn lead me back to the trade-goods.plist page, the "cim method", and my feeble attempts to understand how to get it to correctly do anything positive. My lack of any further enlightenment between 2021 and now resulted in the first post of this thread. My questions from 2021 through 2023 have been answered. The results are still a bit difficult to deal with given the "unknowns" involved but further experimentation will work it all out, one way or another, eventually.

So, phkb, if you have the time and feel that a need is there to rework these things once again please do so. Anticipating the outcome of such work will be a good thing. My personal goals for this subject have been met by the explanation you gave as to where the numbers for those variables come from. To change up Shakespeare a bit, "If coding be the food of Oolite, play on." Okay, that was terrible. "My code, my code, my kingdom for some code." Even worse. "Code on McDuff". Stopping now lest all lies in jest.
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: 2412
Joined: Mon May 31, 2010 11:11 pm

Re: Secondary Market Definitions Defined

Post by Switeck »

phkb wrote: Fri Dec 15, 2023 12:54 am
From the sounds of it, I think everyone wants to see how to rework the entire economy to create 3/4/5/x-pole trade routes, all with the existing tech. Would that be a fair assessment?
Other than trying to get station markets or cargo contracts working, I do almost nothing with commodities markets.
I can fuss around with the system as-is and come up with working results more-or-less in-line with what I want.
I haven't bothered because it's not easy.
phkb wrote: Thu Dec 14, 2023 3:24 am
As I mentioned up-thread, you can get an estimate using SystemInfo.samplePrice for any system in the current galaxy. How different it would be to actually jumping into the system, I'm not sure, but if you don't want to do the whole jumping process thing, that might be an easier place to start.
I worked with SystemInfo.samplePrice in my earlier mods of the core game's Cargo Contracts ...and that price generator was slightly broken too by cim's economic changes.

If I wanted to set commodities prices and amounts, I could do that "manually" in a .js that fires whenever reaching a system much like Spara's method...and that could handle whatever nuances I cared to inflict on it, such as slightly more available for sale at higher tech levels or safer government types.

Right now, there's still lots of add-on stations with completely broken markets (0 price and availability on everything)...or they only have Spara's method, which puts them very out-of-sync with the main station.

That's what concerns me, as fixing each of them is time-consuming to avoid creating "free money" balance issues.
User avatar
Cholmondely
Archivist
Archivist
Posts: 4965
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 »

Assuming that there is no immediate rush to create an immensely complex redefinition of the entire Economy of the Ooniverse, here are some possible smaller projects with annotations:

List of Stations needing TLC

I would have thought that two quite different worked examples should show people how to do it. How about Hathor and either Ziemans (with a twiddle for when arena events occur) or BioSphere (with a narcotics twiddle for those placed in the higher GDP multi-gov/feudal/anarchy systems).
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: 4612
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: Fri Dec 15, 2023 12:00 pm
How about Hathor
OK, Hathor first.
The very first thing to deal with is the spawn rate. The current spawn script has Hathor stations turning up in about 50% of systems where the TL is greater than 7, and the government is either a Dictatorship, a Communist, a Confederacy, a Democracy or a Corporate State. That's probably too often based on the lore info, especially when economy doesn't play into the calculation at all.

How about this:
TL >= 8
Productivity > 30000 15000
Economy = Rich Ag, Avr Ag, Poor Ag Any Agri system

(Edit to tweak numbers when I discovered that the initial set produced none).

Those parameters nets 15 systems in Gal 1 (Anbeen, Biisza, Ceedra, Celabile, Edorte, Edreor, Engema, Leoned, Ququor, Rarere, Rizala, Teveri, Tibionis, Veale, Xeer), which seems like a far more sustainable number of stations.
User avatar
Cholmondely
Archivist
Archivist
Posts: 4965
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 »

phkb wrote: Fri Dec 15, 2023 1:13 pm
Cholmondely wrote: Fri Dec 15, 2023 12:00 pm
How about Hathor
OK, Hathor first.
The very first thing to deal with is the spawn rate. The current spawn script has Hathor stations turning up in about 50% of systems where the TL is greater than 7, and the government is either a Dictatorship, a Communist, a Confederacy, a Democracy or a Corporate State. That's probably too often based on the lore info, especially when economy doesn't play into the calculation at all.

How about this:
TL >= 8
Productivity > 30000 15000
Economy = Rich Ag, Avr Ag, Poor Ag Any Agri system

(Edit to tweak numbers when I discovered that the initial set produced none).

Those parameters nets 15 systems in Gal 1 (Anbeen, Biisza, Ceedra, Celabile, Edorte, Edreor, Engema, Leoned, Ququor, Rarere, Rizala, Teveri, Tibionis, Veale, Xeer), which seems like a far more sustainable number of stations.
That gives 2 average agris, 1 rich agri & 12 mainly agris. That makes a lot more sense to me. The price of food is not all that much, but the diferential for mainly agris would be worthwhile. I'd have expected more rich agris though, but if they are too poor to afford one, then they are too poor to afford one (you need to pay for patrols against pirates/Thargoids, too)! And 4 are confederacies, 2 democracies and 9 are corporate states.

I'm happy with that - well done, Sir!
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: 4612
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 »

The "script.js" file for the Hathor station now looks like this (I've removed the Nephthys spawning routine so we can just focus on Hathor):

Code: Select all

"use strict";
this.name = "Hathor-Nephthys-populator.js";
this.author = "Thargoid";
this.copyright = "For Killer Wolf to use as he pleases.";
this.version = "1.1";
this.description = "Script to add Hathor and Nephthys stations to systems.";

this._always = false; // in case you want to put them everywhere! testing purposes, obviously

this.startUpComplete = function() {
	// add hathor stations to market inquirer
	if (worldScripts.market_inquirer) {
		worldScripts.market_inquirer.$inquirerStations.push("KW_hathor");
	}
}

this.systemWillPopulate = function() {
	if (system.isInterstellarSpace || system.sun.isGoingNova || system.sun.hasGoneNova) { return; } // block them from appearing in interstellar space or nova systems.

	if (this._always == true || (system.techLevel >= 7 && system.economy >= 4 && system.productivity > 15000)) {
		var posHathor = Vector3D(0.0, 0.0, 0.7).fromCoordinateSystem("wsu");
		system.setPopulator("KW_hathor", {
			callback: function(pos) {
				var hathor = system.addShips("KW_hathor", 1, pos, 0)[0];
				worldScripts["Hathor-Nephthys-populator.js"].turnStation(hathor, system.sun);
				log("populator", "Hathor added.");
				}.bind(this),
			location: "COORDINATES",
			coordinates: posHathor,
			deterministic: true
		});
	}
}

this.turnStation = function (stationEntity, targetEntity) {
	if (!stationEntity.isValid || !targetEntity.isValid) { return; }
	let stationVector = stationEntity.position.subtract(targetEntity.position).direction(); // unit vector pointing away from the sun
	let angle = stationEntity.heading.angleTo(stationVector); // angle between current heading and target heading
	let cross = stationEntity.heading.cross(stationVector).direction(); // set the plane where we should rotate in
	stationEntity.orientation = stationEntity.orientation.rotate(cross, -angle); // re-orient the station away from the sun
}
That will give us a station in our selected systems, with the ability to save at the station.
Post Reply