Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.9.1a is out! (05/10/19); Blog post: Raiding for Fun and Profit (11/27/19)

Pages: 1 2 [3] 4

Author Topic: Speeders's Common Sense Economy Mod (in dev)  (Read 14939 times)

speeder

  • Commander
  • ***
  • Posts: 193
    • View Profile
    • Email
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #30 on: December 11, 2015, 08:20:04 AM »

I found why on my mod+vanilla at least, the supplies price were broken:

The refinery was a bottleneck.

On my mod I was trying to fix all raw materials, then fixing other stuff... after I noticed some wrong numbers when accounting only supply/demand, I decided to also look for stock/demand

The results were "eye opening"

when supplies have price settling between 100 and 200:

volatiles had a 1.6 stock/demand (probably because of the "depots" making the supply/demand calculation wrong)
organics has both 1.1 stock/demand and 1.1 supply/demand

ore, AFTER I modded the mines, was 1.5 stock/demand, 1.0 supply/demand
rare_ore, AFTER I modded the mines, was 2 stock/demand, 0.6 supply/demand

metal was 0.8 stock/demand 1.0 supply/demand
rare_metal was 0.4 stock/demand 0.6 supply/demand


the only source of rare metal in the game is refineries, thus it was clear something was wrong with them...

I tried to apply my usual code of production based on profit, the result was even more bizarre, my debug printed that the refinery profit making metal was 200k credits, but the profit making was negative 50k credits...


So I made a spreadsheet to facilitate things, and start fiddling with number, reached a result I wanted, pasted in the game...

And hooooray, supply price dropped to average 40!!!

Still, it was supposed to be 100...

So I will fiddle more until I fix it... still, I found interesting that the reason why supply price was broken was the metal refinery...

EDIT:

more fiddling with the refinery, and some minor fiddling with mines (they were making by default too little rare_ore)

also I had to edit slightly the rare ore and rare metal prices.

for now things are going well, I will need to tweak them more later (they are producing until stock/demand hits 3, then the profit system kicks in and they start to produce at 40% of capacity, then market gets stable that way... I would preferred if instead the stock was about 1.5 and production was higher).

But for now I am happy.

Also fuel and supplies on jangala are now averaging the base price, sometimes it go lower, hooray for new players :)

Now from testing around jangala at least, what needs fixing is domestic goods (jangala is undersupplied with them, since I have no idea what makes domestic goods, and how, I can't even start figuring why yet).
« Last Edit: December 11, 2015, 09:30:49 AM by speeder »
Logged

speeder

  • Commander
  • ***
  • Posts: 193
    • View Profile
    • Email
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #31 on: December 19, 2015, 06:58:36 AM »

New feature added:

The "Open" market not only updates every time you land on it, it also update ships and equipment based on the time since it last updated.

Some players on other threads complained that they had to land every 30 days to find the ship they wanted (this is the default vanilla behaviour, also if you don't land, ships don't update, and if you DO land, they only update as if 30 days have passed).

So behaviour of the "Open Submarket" on my mod:

Goods update every time open the trading screen, they use a very smooth quadratic formula, the idea is that as the raw goods amount increase, you don't see a too fast increase in the market (to avoid seeing millions of food units on the market... on my formula if there is 2 million food in the internal stocks, you see about 150.000 on the market).

Every time you open the trading screen, but with at least 1 day of different from the last time, it updates ships and weapons, in the same speed as Vanilla (50% of weapons rotate in a month, 25% of ships rotate in a month), but it do that in steps of 1 day, so if you return to a market after a year, it is possible that it rotated all ships and weapons, while if you visited it in 15 days, it will have rotated the half amount of stuff it would have in 30 days.

Also I made market conditions influence ship and weapon generation, following the game lore:

Autofactories (that in the game lore are the only things that can manufacture many stuff in the game, because they have special blueprints in them) increase max ships in the market by 3 for example, and increase a good amount of weapons available too.

Spacestations (That the in-game tooltip claims might have a shipyard) has similar, but weaker effects.

some other conditions also affect it.



As for the rest of the mod: I am slowly improving the business code, and converting more business from vanilla to "profit-accounting" business, it is been harder than I thought (specially because vanilla has some businesses in particular with some very weird behaviour, for example loss-producing business, that take more goods than they generate in terms of wealth).
Logged

RyMarq

  • Ensign
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #32 on: December 19, 2015, 09:37:23 PM »

I suppose I will put this comment here.

If you are looking for a large-step delayed trade economy to feed supply and demand, then your factors are very simple.

Stockpile Size: This is the core thing here. In order to stabilize an economy like this, stockpile size must be *very large*. We are talking months of supply. This gives you the padding and stabilization necessary to dampen the system.

Ordering Logic: With a sufficiently robust stockpile, a system can order exactly what it consumes, and it will be perfectly stable. The larger the delay between 'ordering' and 'receiving' the more this is important for stability, given a larger multi-part system. Each step between supplier and end user adds chaos, based around how much they deviate from ordering based upon their consumption (including shipments out). Larger Stockpiles allow this to occur flexibly, without suffering collapse behaviors.

These two parts are key. When you deviate from the points I am listing above, you are inviting instability into the system. Maybe you want that, but you can be sure its what you are getting.

For the record, I do not see a reason for smaller stockpiles. They force you to produce things arbitrarily in failure conditions, just to make the game work, and it isn't as though having a large number somewhere is going to cause a bug.


I will get more into this later, I have been trying to make a full writeup on the subject, but its just not hitting my standards.


The most important thing to note though is that stability in a market system is based around the relative size of the stockpiles, and how 'calmly' an actor is able to order goods, and not overestimate its needs.


With regards to fleets defining all market activities... with *very large* once per month scale transfers, the whole process becomes a fair bit more reasonable. You still should have 'padding' so the market can have any of its needs met, but if you have very large stockpiles (and markets that respond to them well), then the random loss of major fleets is an infrequent sort of market disruption, and consecutive months of loss represent really major problems (that presumably could be reacted to as events).
Logged

speeder

  • Commander
  • ***
  • Posts: 193
    • View Profile
    • Email
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #33 on: December 20, 2015, 03:42:57 AM »

Yes, I will see if I can override the vanilla economy engine entirely.

The approach I've been using so far is failing, badly.

The vanilla economy engine has no ordering system, and the stockpile is actually too low, one failed month of production can knock ALL markets down, depending on what good it was.

Despite all my tweaking currently I am seeing this behaviour:

In sector generation, I told all factories to ignore raw material supply, and act as if they were 100% supplied, to generate at the start enough stock.

On the first day, the economy work as I want.

10 days on, the economy slows down, mostly due to lacking machinery.

15 days on, supplies price skyrocket, when I check why, is because there is not enough metal, when I check why there isn't metal, is because ore (of both types) are not being shipped to refineries, despite being produced in more than enough quantities, because of the way the game currently calculates shipping

the shipping formula is: if the BUYER market, has a bigger "demand" price, than the SELLER market+shipping(zero in vanilla)+distancefactor(I don't understood the formula for this) the trade is made.

The price is calculated based on how much goods are wanted in the transaction, if you are selling something, when you reach the 10 thousands the price drops to near 1, no matter what good it is, this result in shipping get stuck because both markets have the calculated price of 1, thus noone want to trade.

I will override this, and need new ideas on how to calculate price of large quantities of goods (beside the basic: 1 unit price * transaction quantity... that also sounds wrong).
Logged

RyMarq

  • Ensign
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #34 on: December 20, 2015, 06:12:27 AM »

Will do the math for this. Am busy this weekend, will be done monday, probably.
Logged

speeder

  • Commander
  • ***
  • Posts: 193
    • View Profile
    • Email
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #35 on: December 23, 2015, 06:59:41 AM »

My attempt at calculating the economy myself is partially working.

I also made a new model of how markets trade:

The market after processing supply, demand (supply first, to allow market to supply itself if possible), calculates how much stuff it need to import OR that it can export for each good, to keep a mininum level of stock needed to supply "x" months of demand (for now the default is 2 months).

Effects this will have on the game:

It can't start a import and export at the same time, this probably will have two effects, one is that we won't see circular trades anymore (ie: two markets exchanging the same goods between themselves... happens often in vanilla, and is obviously absurd), but we won't see much "passthrough" trades either (ie: if we have market A, B and C, we won't have B buying from A and selling to C), this second one I am unsure if people will consider good or not.

the other effect is that the economy will get stable easier, in my System Dynamics model testing, even with absurd numbers on the parameters, if the market can complete all transactions (ie: all imports and all exports are executed, and all supplies and demands are processed) it tends to not oscilate, or oscilate only once, and then the stock get stable and never changes... this of course make balancing other systems easier, but might make the game boring, probably will need in-game testing.


And here some pretty graphs:







Logged

RyMarq

  • Ensign
  • *
  • Posts: 9
    • View Profile
    • Email
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #36 on: December 23, 2015, 10:32:49 PM »

Your model creates a stabilized system of actors, if price is completely ignored and goods are distributed based upon need blindly regardless of affiliation or tie or distance.

Your ordering system does not include price, and it means that stockpiles are not allowed to occur. Its actually rather interesting in its behavior, because if a given empire/faction has more of a supply and goes to war with an enemy, every single system that enemy has will suffer a distributed increase in cost for the goods they cannot produce.

Currently, proxy mercantile planets can heavily alleviate that effect.

I still have yet to make a sufficiently good system here, but I wish you luck on your efforts there.


SD modeling is good for baseline equations to understand these flows and behaviors, but you have to remember that this is very finite set of actors with very strong restrictions on ordering decisions (distance/war/etc) that if you incorporate into your system will undermine it as anything more than a baseline goal.
Logged

speeder

  • Commander
  • ***
  • Posts: 193
    • View Profile
    • Email
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #37 on: February 13, 2016, 06:28:17 PM »

By the way, I am not dead.

I ended hitting several snags while making the overall economy, and decided to wait a bit for more updates of the game.

This is already paying off it seems, according to the changelog one of the things Alex will release in the new version is a non-hacky way to disable the economy without disabling markets, something that is essential for my mod to work.

While I wait, I am modding SimCity 4  :)

But don't worry, I will come back, specially considering the game is not even done yet.
Logged

Auraknight

  • Commander
  • ***
  • Posts: 123
  • I am a Knight of Aura.
    • View Profile
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #38 on: March 03, 2016, 01:10:15 AM »

keep on keeping on! I'm really looking forward to this mod, it's really peeked my interest! Best of luck to you in SimCity4 too!
Logged
~Aura be with you

Pax_Empyrean

  • Lieutenant
  • **
  • Posts: 71
    • View Profile
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #39 on: March 04, 2016, 09:04:06 AM »

I was looking for something like this. I'm very much interested in economics, both in real life and this game, and some of the stuff I've seen happening in vanilla makes no sense. (Seriously, importing AND exporting the same goods with the same trading partner?)

I don't fully understand how the economy in Starsector works, but I'm hoping to rectify that.

One question, though: would it be possible to change the maximum size of the stockpile for each planet based on that planet's stability? More stable markets would have larger stockpiles, and consequently would be harder to manipulate, starve of resources, etc. As such, prices and output would be more consistent at stable markets, while at an unstable market prices and production would be more volatile due to more frequent resource bottlenecks. I was rather surprised to find out that "stability" apparently doesn't work that way in the game, and is instead just sort of an abstraction for consumer purchasing power.
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 2792
  • Kickstarter is NOT a magic spring of free money!
    • View Profile
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #40 on: March 04, 2016, 09:24:52 AM »

(Seriously, importing AND exporting the same goods with the same trading partner?)
Welcome to chinese-style fast paced economics. Were factories building the same things compete and sub-contract themselves depending on their latest orders on a daily basis.
Logged
 

speeder

  • Commander
  • ***
  • Posts: 193
    • View Profile
    • Email
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #41 on: March 05, 2016, 09:41:23 AM »

I was looking for something like this. I'm very much interested in economics, both in real life and this game, and some of the stuff I've seen happening in vanilla makes no sense. (Seriously, importing AND exporting the same goods with the same trading partner?)

I don't fully understand how the economy in Starsector works, but I'm hoping to rectify that.

One question, though: would it be possible to change the maximum size of the stockpile for each planet based on that planet's stability? More stable markets would have larger stockpiles, and consequently would be harder to manipulate, starve of resources, etc. As such, prices and output would be more consistent at stable markets, while at an unstable market prices and production would be more volatile due to more frequent resource bottlenecks. I was rather surprised to find out that "stability" apparently doesn't work that way in the game, and is instead just sort of an abstraction for consumer purchasing power.

This is one of the first things I changed.


But by the way, now the hiatus on this mod became... "indefinite" for reasons beyond my control.

My PC is getting random BSODs, and they almost always happen with any game that use graphics card, this include Starsector, thus I can't test the mod, since firing up Starsector causes a BSOD (as does firing up anything else that uses OpenGL, even web-pages that use OpenGL to render something cause a BSOD).

And I am right now very low on money, so I can't buy a new PC or fix this one, so until I get a new PC, no Starsector modding :( (and no playign either! AAAAAAH!!! months will go without epic battles!)
Logged

Pax_Empyrean

  • Lieutenant
  • **
  • Posts: 71
    • View Profile
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #42 on: March 05, 2016, 11:46:00 AM »

Sorry to hear that. I hope you get back in working order sooner rather than later. No access sucks.

Where did you start poking around to see how the Starsector economy works? I'm a modder myself, albeit not much of a programmer, and wouldn't mind a few pointers to get started on tweaking the economic model that Starsector uses.
Logged

speeder

  • Commander
  • ***
  • Posts: 193
    • View Profile
    • Email
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #43 on: March 07, 2016, 08:53:57 AM »

Sorry to hear that. I hope you get back in working order sooner rather than later. No access sucks.

Where did you start poking around to see how the Starsector economy works? I'm a modder myself, albeit not much of a programmer, and wouldn't mind a few pointers to get started on tweaking the economic model that Starsector uses.

Sadly, Starsector economy wasn't meant to be modded, maybe because it ins't done either.

It is made basically of 2 separate components, the individual markets, that can update some stuff on their own and keep track of some things, and the overall economy simulator... the economy simulator is compiled and obfuscated, requiring some heavy reverse engineering to get any info out of it, also until recently it was not even possible to overrride it in any way (now you can disable it with a json, but when you will need to calculate the economy yourself in plugin events).

There is also some stuff in the fleet simulator, mostly about triggering the shortage and oversupply events, and spawning the trade fleets.
Logged

Serenitis

  • Admiral
  • *****
  • Posts: 810
    • View Profile
Re: Speeders's Common Sense Economy Mod (in dev)
« Reply #44 on: March 12, 2016, 06:45:31 PM »

Has anyone looked into why modded games have such inflated fuel prices?



Admittedly I don't really know what I'm doing so I'm loathe to mess with java stuff, but I can't seem to find any evidence of mods (that I have at least) adding any fuel production even though they each add several markets.
Is the entire sector dependant on those two antimatter plants on sindria?
Logged
Pages: 1 2 [3] 4