Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: 1 [2] 3 4 5

Author Topic: Economy Revamp  (Read 39865 times)

Dri

  • Admiral
  • *****
  • Posts: 1403
    • View Profile
Re: Economy Revamp
« Reply #15 on: April 21, 2016, 08:37:31 AM »

Lack of comments is probably due to the fact that the Economy/Trading are currently no match for the awesomeness of the combat system. :)
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7173
  • Harpoon Affectionado
    • View Profile
Re: Economy Revamp
« Reply #16 on: April 21, 2016, 09:08:54 AM »

Looks interesting.

Playing as a smuggler currently is a lot of fun, but there really isn't anything to do with the profits. Nice job on the hints of other things :P.
Logged

sycspysycspy

  • Commander
  • ***
  • Posts: 193
  • Translator of the Council of AL
    • View Profile
Re: Economy Revamp
« Reply #17 on: April 21, 2016, 09:19:27 AM »

Lack of comments is probably due to the fact that the Economy/Trading are currently no match for the awesomeness of the combat system. :)
+1 for this, but in order to build an effective fleet, trading is the best way to go.
Logged
Please report any translation error to me with PM.
- I just went over to my bank account and figured out I can live comfortably without working for the rest of my life as long as I die on next Tuesday.

HellBent

  • Ensign
  • *
  • Posts: 38
    • View Profile
Re: Economy Revamp
« Reply #18 on: April 21, 2016, 09:23:10 AM »

Dunno why this is getting such lack of interest.
For me economy and trade is one of the things I've been most looking forward to.

I have found making money from trading very obtuse, and if you start the game as a trader you need to get lucky with prices around you, and hope that somewhere close has a machinery shortage.
All in all I think this is very interesting, great to see this game come along in bounds with each blog post.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Economy Revamp
« Reply #19 on: April 21, 2016, 10:02:55 AM »

I'd like to hear more about the technical approach, though; it seems like this should all be pretty clean, fast spreadsheet shuffling and it's pretty weird to me that, when we start a game, it takes forever for those market "months" to execute. 

Most of the two months at the start have little to do with the economy - it's actually advancing the campaign engine, in large steps, to populate the sector with a reasonable spread of fleets, events, etc.

If it was *just* the economy, it would take under 10 seconds, depending on CPU of course. Which is still a fair length of time, but the core of it is O(n^2), and there really isn't a good way to get below that, whether you're doing bids/contracts or something else.

That probably points at update frequencies more than anything else; it's really just not that important, from a player POV, if markets only update in major ways (as opposed to dynamic events from local fleets arriving) once a week or so, I'd think.

It's not important right now, but it will be important later - the higher the frequency, the faster it reaches a stable point, both because there are more updates and because the updates are finer-grained and find the equilibrium faster. And, well, it *is* important now in terms of producing proper prices for supplies and fuel, though that'd be massive overkill if that's all that was required. The update frequency in the new version is once every 3 days, btw, though it'll take longer (and update stockpiles in larger increments) if need be.


Re stock icons; if there are more than ~5 of them, I'd overlay a number too. (Like Colonisation did)
...
While the exact number might not be particularly relevant to the player, it does help quantify the relative scales of product.

Honestly, not a fan. It's necessary in that screenshot, because the number of icons is huge compared to the space they dedicate to displaying them. I think they would do better just showing a single icon and a number, at that point - the stacking really isn't doing anything useful there.

In our case, the icons are spread out more. Given what the screen does, a difference between say, 8 or 10 icons isn't very important. Anything more, you'll pick up on visually, and if you need a detailed quantity, you can mouse over.

Adding a bunch of numbers over everything would look super cluttered and would, imo, reduce the readability a *lot*.



Oooh this is relevant to my interests.

(That totally made me laugh.)

  • Thank goodness markets can have realistic populations without causing massive supply/demand shocks. In fact I think 2^n is low enough to risk Fridge Logic thing from big markets not seeing much more traffic than small ones, could probably get away with 3^n or even 4^n.
I kind of like 2^p here - it produces results that "feel" right and are just in the player's grasp to influence on the high end. E.G. something like 8000 food/month needed by Chicomoztoc (size 8), vs 500 by a size 4 market. And it does help keep the number of icons in a manageable range on the low and high end, where I'm fairly positive a base of 3 or 4 would get away from that. As you can see, for Chicomoztoc it's juuust barely manageable already.


  • Is there now any built-in mechanism for correcting or at least compensating for Sector-wide over/undersupply (i.e. too many or not enough market conditions)? EDIT: okay, I see it does dynamically scale back
Right - for oversupply, production drops off to 0 when local stockpiles reach 2x base supply. For undersupply, nothing right now, but I'm thinking about some ways to handle this on a higher level - we'll see how that pans out :)

Hopefully, just being robust against oversupply will help out some in any case.


  • If the economy flow panel was scrollable the icons on that Chicomoztoc screenshot might not look so crowded. Though I think you really should do as TJJ suggests and use numbers instead of icon spam. Or use big icons that represent multiples of the small icons.
Don't want to make it scrollable, though, since it's supposed to be an "at a glance" thing.

(Yes, the commodity detail panel is scrollable too, but didn't see a way to avoid that. Might end up redoing its layout, though.)


  • A couple of mods (Interstellar Imperium and Nexerelin) have events that cause one-off destruction of stockpiles. Will the new economy reflect such events? Can it handle such events without making things go Horribly Wrong? Or should we target supply or something instead?
Should just work. In fact, should work better than before - it'll influence prices, show local demand as being not met, will show a nice huge dip in the "stockpiles" graph, etc.

Btw: all the "average" stuff is gone, nuked from orbit. I.E. getAverageStockpile()/getAverageDemandMet()/etc. It just works off the stockpile, which it can do because it's a fairly stable value now. Further, player trade directly influences the stockpile, instead of modifying averages etc. It's all much more straightforward. The one thing to watch out for is making more stuff available on all the submarkets, total, than there is in the stockpile - to make sure it doesn't happen, submarkets talk to each other to figure out how much each wants/gets.


The big planets in the background of the new detail overview is a nice touch. This is cool, but I'm mostly excited about what upcoming features it paves way for... ;)

Hey, someone noticed! Have to admit, I'm very partial to those myself. Really helps give each market a more unique feel.
Logged

ANGRYABOUTELVES

  • Admiral
  • *****
  • Posts: 592
  • AE ALTADOON GHARTOK PADHOME
    • View Profile
Re: Economy Revamp
« Reply #20 on: April 21, 2016, 12:13:30 PM »

Backend updates aren't nearly as flashy as new ships, weapons, or balance changes, but they can be even more important. Changes to make the economy more reactive aren't going to be noticeable by most players as of right now unless it significantly impacts the prices of Supplies or Fuel, but are going to be very important in the future once Industry becomes a thing. So even though I don't care much about trading or economy stuff right now, I'm glad you're keeping us up to date on this kind of thing.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Economy Revamp
« Reply #21 on: April 21, 2016, 01:16:32 PM »

Looked at what you were talking about, in terms of bids / contracts, for a bit.

Thought:  why not simply allow for each Market to set its current-bid price, taking into account the global running average and global demand, then each Market purchases with credit that's based on the Faction, rather than the individual location?  

It's not sensible to let AI Markets blow out completely because they simply can't afford to buy enough to meet the basics; preventing that requires too much work and it's not realistic, either; the United States isn't going to let everybody in Utah starve to death because the crops didn't grow this year, for example, and neither is the Hegemony going to let one of its military bases starve; colonies don't exist in vacuums and nations aren't just loose collections of markets; there are Central Banks IRL for a reason.

That would hugely reduce the amount of n^2 involved and probably lead to more sensible events in general and much more stability.  I'd probably also simulate the futures market a bit, and have Factions put in for long-term deliveries over time, rather than just buying at spot prices; that would also greatly reduce the need for math-heavy event calculations and for the vast majority of commodities, it's much more sensible and realistic.  After all, the Hegemony isn't going to buy Food for a military base on today's spot market, for example, they're going to lock in their prices in exchange for orders over a long period; months, at least.

Then the Market providing said resource launches a delivery fleet with escorts, etc., and it's all in-game events, but is much less volatile and math-heavy.  Then recalculate the global running average, based on that stock being in-transit and possibly lost, and the next bid can be dealt with.  Fairly cheap math then.

The only stuff that would remain outside that box would be black-market goods, but even there, you can use a similar model; demand would create a need to be met, etc.  The difference is that black-market goods wouldn't be allowable via global credit; the local economy would have to have the cash-on-hand to make a purchase.

That leads to the other issue; I presume that Credits aren't being controlled for, as a resource.  They should be, including Factions expanding their buying power by "printing money", which would dilute the value of the Credit in general, vs. Credits constantly getting "destroyed" when fleets do battle and the local Commanders credit stocks are lost, etc.  

The Black Market sucking Credits out of the "legitimate" economy (although most of that would just go right back in, by buying the Pirates goods on the open markets) would also lead to some meaningful price volatility on things like weapons and ships, which a smart player could use to their advantage, and therefore find some trading opportunities.

Don't get me wrong, I'm OK with real dynamic motions in economies here, but I think that that should happen almost entirely because of major events (a successful blockade of a location, using weapons to damage a planet, inciting a revolution, etc.) rather than it being a bunch of relatively-finicky, complicated internal workings.  In short, if the behavior of Markets isn't contributing very directly to Drama that can be tied to Fun... why spend so much time coding it?

For the most part, day-to-day buying of major commodities shouldn't be a bunch of individual locations attempting to seek stability, but should largely rest on the strength / weakness of the nation-state that is a Faction; this keeps things simpler overall (think of MOO II's economy here, where it was complex-but-computationally-simple) without any real drawbacks, other than losing the "each planet is an island" feel, which isn't terrifically realistic anyhow and is just costing CPU cycles.
« Last Edit: April 21, 2016, 01:23:10 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

nomadic_leader

  • Admiral
  • *****
  • Posts: 725
    • View Profile
Re: Economy Revamp
« Reply #22 on: April 21, 2016, 04:26:44 PM »

As one who thinks the overworld game is more interesting than combat (until the latter gets more integrated with the overworld anyway) I really liked this blog post.

This game is totally wasted on people who just like explosions.

I look forward to seeing what you give the player to do with this. I imagine being a manipulative Martin Shkreli of the sector.

Re: reducing the overall number of commodities-- what about all the campaign missions that require you to get 10,000 tonnes of heavy machinery? What about the giant freighters in the game? Will there be nothing to put in them? A pity if the ships became purely decorative.

Re: many icons in last screenshot -- Since every commodity icon is a very distinct, separate color (good design btw), can't you just represent them as bar graphs? ie pink bar for drugs, dark green for organics, etc.


Now a theoretical consideration:
I don't claim to be an economist or computer scientist familiar with all the algorithms you mention, but something to keep in mind: In real life trade is often irrational from a profit standpoint, so your simulation may not work as desired if you make markets behave entirely rationally. There's a metagame of trade that goes beyond simple profit.

In addition to immediate rational economic gain, trade happens for:
-Solidifying relationships between merchants, district leaders, or heads of state; part of diplomacy (gift giving,)
-Bailing out/stabilizing/developing other markets within one state (ie, buying a poor district's useless stuff to keep them from starving, or selling stuff to another district at a low price because they need it)
-Humanitarian aid to other states
-Useless displays of vanity and status (ie olympic villages)
-Internal political considerations (producing/selling at loss  something nobody much wants, because some powerful faction inside the state benefits from it)
-Because it happened before and people are just used to it and it has an inertia. Nomads use the same paths and trading oases in the desert because thats what their grandfathers did. You've already addressed this with accepted bids remaining accepted for a while. Inertia is perhaps even more influential than that however.

I don't say that all this stuff should be simulated in detail in the game. It just may be useful to think about stuff like that, and give yourself (and modders) some way to include provision for "irrational trade" in the simulation. Probably some factions would have a lot of centrally planned (for better or worse) economic activity, while others would be totally hands off and more 'rational.'
Logged

Bastion.Systems

  • Captain
  • ****
  • Posts: 412
  • Special Circumstances LCU
    • View Profile
Re: Economy Revamp
« Reply #23 on: April 21, 2016, 05:53:40 PM »

In the old model the unit price of goods dropped inside a single transaction. Is this still the case? In reality there usually is a short period before the market figures out that the shortage has ended and the excess goods are unsellable and the price drops.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Economy Revamp
« Reply #24 on: April 21, 2016, 07:43:54 PM »

@xenoargh:
Hmm - I rather suspect that what you're proposing would end up with a huge amount of corner-case related complexity (see: black market stuff).

Thought:  why not simply allow for each Market to set its current-bid price, taking into account the global running average and global demand, then each Market purchases with credit that's based on the Faction, rather than the individual location?

That still seems like O(n^2) in the number of markets, except now they also have to share a common pool of credit, making things more complicated. Am I missing something?

I think you might mean that factions buy and sell as a unit - i.e. you'd be buying ore from the Hegemony, rather than from a specific market - but that really homogenizes all faction markets, with, I think, detrimental results in terms of there being opportunities to exploit. But since those are so abstract right now (and mostly exist in my head), it's not exactly something that can be discussed super productively... so many ways to do it, you know? :)


Quote
neither is the Hegemony going to let one of its military bases starve

That doesn't happen with this system, either. Military bases, in fact, get increased stability to reflect their political pull. Even if they didn't, it's rare for a market to get zero of something, since when stockpiles get very low, prices go up a lot, allowing it to temporarily outbid the better-stocked competition.

Credits being a resource... also something I'd given some thought. For me, that feels like an unnecessary complication. I mean, what's the benefit? It's going to be confusing to the player, and my feeling is it would make it much more difficult for the simulation to stabilize. Especially if factions are capable of making more credits on demand, one would have to be careful to ensure there's no runaway inflation, etc. And then you'd need to adjust bounty payouts etc - lots of repercussions for unclear gains.

Quote
rather than it being a bunch of relatively-finicky, complicated internal workings.

Making it not finicky and a lot less complicated is more or less the point of this revamp :)



Re: reducing the overall number of commodities-- what about all the campaign missions that require you to get 10,000 tonnes of heavy machinery? What about the giant freighters in the game? Will there be nothing to put in them? A pity if the ships became purely decorative.

I'll have to adjust those missions; have a todo item about it somewhere. The high-end quantities are such that the Atlas is still useful, in terms of the amount of stuff that's available to buy. Whether there's a point to shipping that much of it is another question; will depend on how things shake out.


Re: many icons in last screenshot -- Since every commodity icon is a very distinct, separate color (good design btw), can't you just represent them as bar graphs? ie pink bar for drugs, dark green for organics, etc.

That wouldn't look as good, wouldn't work for colorblind people, and wouldn't be mod-friendly. Plus, from a usability point of view, having that many graphs would be much harder to take in at a glance than seeing the icons. In one case, you just have the color - but in the case of icons, you have color and shape. That helps keep a large amount of information from becoming overwhelming.


Now a theoretical consideration:
I don't claim to be an economist or computer scientist familiar with all the algorithms you mention, but something to keep in mind: In real life trade is often irrational from a profit standpoint, so your simulation may not work as desired if you make markets behave entirely rationally. There's a metagame of trade that goes beyond simple profit.

In addition to immediate rational economic gain, trade happens for:
-Solidifying relationships between merchants, district leaders, or heads of state; part of diplomacy (gift giving,)
-Bailing out/stabilizing/developing other markets within one state (ie, buying a poor district's useless stuff to keep them from starving, or selling stuff to another district at a low price because they need it)
-Humanitarian aid to other states
-Useless displays of vanity and status (ie olympic villages)
-Internal political considerations (producing/selling at loss  something nobody much wants, because some powerful faction inside the state benefits from it)
-Because it happened before and people are just used to it and it has an inertia. Nomads use the same paths and trading oases in the desert because thats what their grandfathers did. You've already addressed this with accepted bids remaining accepted for a while. Inertia is perhaps even more influential than that however.

I don't say that all this stuff should be simulated in detail in the game. It just may be useful to think about stuff like that, and give yourself (and modders) some way to include provision for "irrational trade" in the simulation. Probably some factions would have a lot of centrally planned (for better or worse) economic activity, while others would be totally hands off and more 'rational.'

These kinds of things would be handled through events and/or missions. The goal for the economy simulation is to provide a solid base on which other, more complex mechanics can operate.


In the old model the unit price of goods dropped inside a single transaction. Is this still the case? In reality there usually is a short period before the market figures out that the shortage has ended and the excess goods are unsellable and the price drops.

Yes, that's still how it works. Kind of has to to prevent infinite/free money exploits. In the example you're giving, for example, you could sell at a high price, wait for it to drop, then buy everything back at a low price, then wait for prices to go up again, etc.
« Last Edit: April 21, 2016, 07:48:24 PM by Alex »
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Economy Revamp
« Reply #25 on: April 22, 2016, 10:36:31 AM »

Quote
I think you might mean that factions buy and sell as a unit - i.e. you'd be buying ore from the Hegemony, rather than from a specific market
My thought here was that Markets would go to the global exchange and buy XYZ at whatever XYZ's bid prices were, hit their locally-available Credits, and then draw from the Faction if necessary.  Naturally, that would mean that some Factions would run at a deficit; but perhaps they could increase their tax rates and pay down their debt in exchange for slower economic growth in the short term, like the real world.

I agree about the black-market; that'd require some work to avoid various Bad Things.

Anyhow, I'll keep thinking about the n^2 issues; seems like there really ought to be ways to get it down to n passes without too much distortion, so that it's just not major weightlifting at all.  Probably the biggest issue is treating commodities as commodities, and not as local produce that needs to be re-bid every time a transaction occurs; a futures market would probably simplify things a lot.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Economy Revamp
« Reply #26 on: April 22, 2016, 11:43:24 AM »

Ah, I see - hmm. That sounds like introducing a few systems that work off of the feedback from trade, which would themselves take some time to stabilize, if that makes sense. I.E. credits/tax rates - not directly involved in trade, but stabilizing eventually (hopefully) as a result of what happens during trade.

My experience with this stuff has been that having several systems that feed back into each other trying to stabilize like this is potential trouble - it either takes longer, or it just doesn't stabilize at all.

Another alarm bell with having credits etc would be it being a hard cutoff at some point (if that's how it worked) - everything could be working perfectly, looking good, and then come to a crashing halt in the next step because it ran out of money somewhere.

Anyhow, I'll keep thinking about the n^2 issues; seems like there really ought to be ways to get it down to n passes without too much distortion, so that it's just not major weightlifting at all.  Probably the biggest issue is treating commodities as commodities, and not as local produce that needs to be re-bid every time a transaction occurs; a futures market would probably simplify things a lot.

Thanks!

The current sim is sort of doing a "futures" market, btw - assuming we mean the same thing by that, to some extent at least - by looking at production instead of stockpiles when deciding what gets moved where. This does indeed help reduce volatility a lot; probably the cornerstone of making the whole thing work out.

I don't think it can be reduced below n^2 without a major paradigm shift (did I really just say that? sigh). At some point, it's got to decide, "where does this batch of food go", and, well - it's not even as simple as saying "find the market that pays the best", because that market may be able to get a better deal elsewhere.

Thankfully, though, it performs well despite being n^2, as the actual algorithm is pretty lean.
Logged

Psigun

  • Ensign
  • *
  • Posts: 40
    • View Profile
Re: Economy Revamp
« Reply #27 on: April 22, 2016, 12:00:25 PM »

Looks great. A robust trading system and economy was something I really wanted out of this game.
Logged

Deshara

  • Admiral
  • *****
  • Posts: 1578
  • Suggestion Writer
    • View Profile
Re: Economy Revamp
« Reply #28 on: April 22, 2016, 03:17:01 PM »

I'm very happy to hear that we're a step closer to commodity-starving markets into submission for fun and profit
Logged
Quote from: Deshara
I cant be blamed for what I said 5 minutes ago. I was a different person back then

PCCL

  • Admiral
  • *****
  • Posts: 2016
  • still gunnyfreak
    • View Profile
Re: Economy Revamp
« Reply #29 on: April 23, 2016, 09:41:17 PM »

As someone studying economics and has interest in compsci, this is interesting.

As far as that readability issue on large markets goes, what if instead of stacking icons based on absolute amounts (100 Organics/icon, etc) you made the stack sizes relative to the different goods on the market (%1 in market output/icon)? As far as I can tell, there's very little point in showing the actual number of a given good on the market in the "at-a-glance" view, nor is that view used to compare a market's output to another market's, so having a relative figure that scales with market size shouldn't cause many problems
Logged
mmm.... tartiflette
Pages: 1 [2] 3 4 5