Economy & Outposts

I’m going to break one of my unwritten rules today and talk about stuff that isn’t quite done, because the alternative is taking far too long to talk about it at all. There are a lot of inter-related systems in the works, and it’s not going to be possible to playtest properly until most of them are in place, so please keep in mind that the features I’m going to describe here may change more than usual.

If I’m counting correctly, this is the third “from the ground up” rewrite of the economy system. Well, maybe the second, since the first one wasn’t a re-write, technically. Still, the economy system has had a more turbulent path through development than just about any other part of the game.

(Let me take a moment here and clarify what I mean when I say “economy” – it’s the behind-the-scenes system that produces and moves around between markets commodities such as food, fuel, and supplies, and determines their base prices at various locations. This is different from a player-centric notion of “the game’s economy”, which focuses on how the player gets and spends credits – a perfectly fine use of the term, but not what I’m talking about here.)


So, why did it go through a couple of complete re-writes? I think it’s because up until now, the primary reason for its existence – a macro-scale game that the player can participate in, which is to say building outposts and such – didn’t exist, and so the shape the economy needed to take was murky.

If I had to do it over again, I’d do something much simpler the first time around, but, well, hindsight. The attempts to “get it right” before having enough information to do so were well-intentioned but ultimately futile. On the bright side, I definitely learned how not to go about it, and got a good sense of where the performance limitations are, so there were some benefits to doing it the hard way.

Previous System
I don’t want to spend too much time talking about the previous version of the economy, that is, the one that’s in the current release – it’s in the past, and we’re moving on! In brief, units of each commodity are created and consumed, and the algorithm tries to distribute it appropriately, from sources of production to sources of demand.

It’s computationally challenging – somewhat akin, though not identical to the traveling salesman problem – and it doesn’t reach a fully stable equilibrium, in part because of the shortcuts it has to take to do the calculations in a reasonable amount of time. It’s easy for a mod to get it into a bad state – e.g. where supplies are too expensive – by adding markets without exercising the utmost care, and its performance also doesn’t scale well when more markets are added.

For all that, it’s just about good enough for what it needs to do, but it isn’t a reliable foundation to build something larger on.

First off, what do we actually want out of the new system? At a high level, it should be simpler, so that what’s going on can be more easily presented to the player, and so that it has more reasonable performance requirements. It should also be more predictable, so that the player can take actions to engineer a specific outcome.

On a lower level, there are lots of things the system should be able to represent, such as “smuggling” and “a commodity shortage”, but there are too many of those to list out here. Instead, I’ll mention specific considerations if they played into a design decision that I’m talking about.

New System
One critical issue here is performance – the new system needs to run quickly, so that when the player establishes an outpost, we can compute how it fits into the economy without delay, and so that mods can add populated planets to the game more freely.

A good way to improve performance is to do less things. A good way to do less things is to zoom out on the detail, that is, to make things more abstract. Happily, this is also a good opportunity to make them more comprehensible to the player.

The first step is to express supply and demand in units that are different from the units in which the player’s cargo is counted. For example, currently Jangala – a mid-sized Hegemony market – might have demand for 4000 units of Food, which equates to 4000 units of Food that your fleet might carry in its holds. Instead, we’ll change the scale to top out somewhere around 10, so that Jangala would have a demand for 6 units of Food.

This is a lot easier to display in the UI, and since we’re no longer dealing with cargo-units, it’s also easier to step back and make some simplifying assumptions. The key one is this: a source of supply can meet any amount of demand up to the supply value, without being used up.

For example, if a market produces 5 units of Food, and several nearby markets have demand for up to 5 Food, it can meet the demand in all of them. If a nearby market has demand for more Food than that, the Food-producer can meet it partially, still without being used up.

Conceptually, this represents being able to scale production up within a certain range – keeping in mind that this is (again, conceptually) a logarithmic scale, so 6 units is an order of magnitude more than 5 units, this just about makes sense.

This simplifies the algorithm for distributing commodities drastically, since it no longer has to worry about consumers competing with each other for a limited supply. Each calculation of “where does market X get its supply of Y” can be done independently of the other such calculations.

Algorithm Details – Reach and Shipping Capacity
Now, let’s break down exactly how the new algorithm works.

Each market has a “reach” and a “shipping capacity”, both set to initial values based on the market’s size.

Two markets are within reach of each other – meaning, they can supply each other with goods – if their distance is less than or equal to their combined reach, in light-years. (Note: I’m using “good” and “commodity” interchangeably here.)

The lower shipping capacity of the two markets limits the maximum number of units of a commodity they can ship to one another; this also doesn’t get used up but rather limits each transaction. For example, if a market has a shipping capacity of 4, and has demand of 4 for multiple goods, it can ship in all of these, but if it has demand 5 for something, it’d only be able to ship in 4 units of that.

Given these two constraints, we go through every demand on every market and pick the best supplier, preferring a supplier that:

  • Can satisfy the most demand
  • Is local (i.e. if a market produces enough Food to satisfy demand, it won’t be imported from elsewhere)
  • Belongs to the same faction
  • Has higher stability
  • Is closer

For example, a market will only export from another faction if none of the same-faction markets in reach can meet as much of the demand as an out-faction supplier can.

There are a few more details (handling smuggling, shipping within the same star system, and some other special cases), but the above is the core of the distribution algorithm.

It has two important properties – one, it’s easily fast enough that we can recompute the distribution without a noticeable delay prior to, say, showing a dialog. Two, it reaches a stable state quickly, meaning the distribution is predictable and won’t change without a change in the markets to trigger it. If you’ll note, these two properties are exactly what we wanted to achieve, so at least by that measure, the new algorithm is successful.

Commodity Information
Of course, none of this is much good if the player can’t see what’s going on. Part of the reason for the overhaul is making the system something that can be conveyed to the player more easily. (As an aside, “how easy is it to put together a UI for this mechanic” is a primary design consideration for a mechanic, rather than it being a “let’s design the mechanic in a vacuum and assume we’ll manage a good UI for it somehow” type of situation.)

So, the player needs to see, as concisely as possible, the state of supply and demand at a market, what it’s producing, importing, and exporting, what it needs, what it has too much of, and so on – and there are 15 or so different commodities that this information needs to be displayed for. This sounds like a lot, and it is, but the relative simplicity of the new system helps out.

Each commodity that a market has supply or demand for gets a row in the “Commodities” panel in the lower right of the market screen, and each row makes use of different icons – faction crests, and commodity icons with various outlines and brightness – to convey what’s going on. The player has to be able to tell what’s going on without reading this blog post, so there’s a legend that explains what each symbol means:

For example, in the screenshot below, we can tell that Jangala has 8 units of Organics available (the “8x” in the top commodity row), and that 2 units are neither being exported or consumed locally, with the excess resulting in lower prices (the two green-outlined icons at the end of the row). We can also tell that Jangala is producing these Organics (the gear icon on the left side) and that the primary importer of these is a Hegemony market (crest on the right side).

For Recreational Drugs (the purple syringes, fourth row from the bottom), we can tell that two units are being produced locally (bright icons), but that demand is being met by importing 3 units (1 dim icon, and also a crest of the faction the drugs are coming from on the left, in this case also the Hegemony). The red outline around the crest tells us that it’s a smuggling operation, the three dim red-outlined syringes tell us there’s a lot of unmet demand (and so higher prices), and the lack of a faction crest on the right tells us Jangala is not exporting any drugs.


Being able to read this at a glance is going to take a bit of experience, but the information that’s most important to a newer player – is something cheap or expensive here? – is the most easily gleaned. If there are green icons, it’s cheaper, and if there are red icons, it’s more expensive, and that’s really all there is to it. Once a player digs into the system more, I think it’s also reasonable to expect them to learn how to read this display more easily.

It’s always hard to tell how well a display or relatively complex information will do the job, but I’ve found (and fixed) some bugs in the simulation from seeing things that looked odd in this display, and that’s a really good sign as far as its ability to accurately convey information.

Player Impact
There’s lots of room here – and, indeed, need – for giving the player things to do that impact the economy. A core one already implemented is the destruction of trade fleets reducing the amount of a commodity available at the destination market, and more large-scale destruction of trade fleets temporarily reducing the shipping capacity of a market.

There are several more things I’d like to look at here – actions the player can take to make changes and nudge the economy in a direction they prefer – but I’m not quite ready to talk about them.

Finally, we’re getting to the main reason for doing the economy overhaul in the first place – outposts! A lot of the mechanics are unfinished, and many of the UI elements you see in the screenshots are not connected to anything on the backend. There’s lots of work left to do here, so I’ll talk about a few things in general terms and only dive into details where the details are available.

In brief: you can establish an outpost on a planet you’ve surveyed, it requires a lot of crew, machinery, and supplies, and it starts out as a size 3 market. After that, you can build industries or structures (from the game’s point of view, they’re the same thing, but it makes sense to call certain things one or the other, e.g. “Mining” is an industry, while “Orbital Station” is a structure), which can make the outpost produce or require commodities. Outposts can also produce patrol fleets (given certain structures exist) and are a source of both profit and difficulties, such as defense against pirate raids.

Speaking of profit, the general idea here is that an outpost (or a colony, the terminology is a bit vague still) 1) has an income based on its size, 2) has an upkeep based on the number and type of industries, and the planet’s hazard rating, and 3) has more income based on what it’s able to export. So, you can get some minor income by establishing an outpost and growing it, and you can make a lot more by making it a part of other factions’ supply chain. Doing that, and picking a good location to establish an outpost in the first place, requires some information, so, it’s back to “exposing what’s going on under the hood” to the player.

Nearby Markets
When establishing an outpost, a critical piece of information is which other markets it will be within reach of. This is going to affect where it can get the commodities it requires – initially, food, fuel, and supplies will be among the most important – and where it’s going to be able to export its production. Thus, before establishing an outpost, the player has access to this screen:


It shows all markets within reach and, since a new outpost has some ways to extend its reach, which will also grow as the outpost increases in size – some markets outside the current reach, as well. Those are indicated with red text in the “In reach?” column. You can see what commodities they have available, what they have demand for, and so on.

The “Waystation?” column points to another mechanic, also related to market reach. A waystation is an outpost without a permanent population, and what it does is make any markets within reach of a waystation also count as being within reach of each other, as long as at least one of them belongs to the same faction as the waystation.

Waystations are expensive to maintain, but allow trade that would otherwise be impossible to take place. For example, if you find a resource-rich planet on the outskirts of the Sector, it would be far outside the reach of any of the core worlds, but you could still make the connection by building a chain of waystations along the way.

(… in theory. The mechanics are there, but a lot of the other mechanics to really playtest this aren’t, so, let’s see how it goes. But then I did mention this earlier; probably no reason to keep harping on it.)

Supplier Details & Potential Exports
Another important task the player needs to do – either before or after establishing an outpost, depending on how far ahead they’re planning – is to figure out where they can export whatever it is they’re producing. Chances are, whether you’re producing Food, Ore, or something higher up the production chain like Heavy Machinery, your potential customers are already getting at least some of their demand filled elsewhere. So, how do you push their current supplier out and become their preferred supplier yourself?

This goes back to the commodity distribution algorithm described earlier in the post. Let’s reiterate the rules here – the best supplier is one that:

  • Can satisfy the most demand
  • Is local
  • Belongs to the same faction
  • Has higher stability
  • Is closer

These are listed in order of importance, so if a market needs 8 Ore and can get it from another faction, it’ll do that in preference to just relying on its local production of 7 Ore.

A related task is seeing what another market’s current and alternate suppliers of a commodity are – this can be useful both for becoming a supplier yourself, or for exploring the viability of cutting off or disrupting the market’s supply of the commodity. If there are many alternate suppliers, it probably won’t work, but if there’s only one or two, that’s a possible weak point!

So, the main questions the player needs to be able to answer – and, again, we’re looking to expose what’s going on under the hood in the most comprehensible way we can – are:

  • Where does this market get a particular commodity, and where would it get it if that source was disrupted?
  • Who are the potential customers for a commodity my market is producing, and who are they getting it from instead?

Enter another dialog, this one accessible by clicking on a row in the commodity widget:


The tab above shows the alternate sources of Food for Cibola. As we can see, Mazalot is the current source, beating out Fikenhild due to having higher stability. Both of those beat out Gilead due to belonging to the same faction as Cibola – the Persean League – while local production and Ailmar lose out due to being unable to meet as much of the demand as the other sources.



This tab shows the current and potential Food exports from Gilead. As we can see (due to the “Rank” column having a 1 in it) it’s already the current provider of food for Chalcedon. Gilead is ranked 2 for several other markets, meaning it’s not the current provider, but only one provider is a better option in each case – which in turn means there’s a good opportunity for Gilead to rise to the top. Clicking on Kazeron, we can see its preferences for Food sources:


Gilead is indeed second, while Mazalot is the current provider. Would be a shame if something happened to it…

Bumping Off the Competition
Clearly, there need to be several options for advancing your market in the ranks of potential suppliers. One is already there – intercepting trade fleets – but something more subtle and perhaps more permanent would be good to have as well. This is another area where much is still undone; I’ve got a list of “things you might do to achieve your exporting goals”, but it’s going to take some experimenting to nail down a good set.

(Dropping a planetbuster because you’re looking to sell some cabbages seems rather extreme, doesn’t it? Perhaps it is, but have you seen my cabbages?)

Coming Up
Continuing in the same vein, here’s an incomplete list of features/functionality/content that’s more or less directly related to outposts and is still largely or completely undone:

  • Immigration – how an outpost grows in size, what happens when it does, etc
  • Market financials – income, upkeep, a monthly report, etc
  • Ship and weapon production (blueprints, etc)
  • AI Core mechanics (you’ve probably spotted some related icons in the screenshots, but I’ll say no more)
  • Exploration tie-ins – things you find in various star systems that affect any outposts you might establish there; lots of potential, but will have to winnow down a reasonable set
  • Things to defend outposts from; key to giving you something to fight for, i.e. context

So, overall, that’s a fair amount of stuff still to do for outposts. On the bright side, I think the underlying economy system is solid and should support everything we need, and a lot of the work to expose its workings to the player – a big risk factor, as well as just being a lot of work – is in a good place as well.

Comment thread here.



Tags: , , ,

This entry was posted on Tuesday, September 19th, 2017 at 5:10 pm and is filed under Development. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.