Unending Galaxy : Trading and Economy

In this article I will get into details about the economic system used in Unending Galaxy. Most of the following is already implemented in my current development build.

Enjoy! 🙂

The game has 2 main station types: Factories and Trading Ports. The factories produce wares periodically using resources, very similar to X. Except that coding wise, anything in the game is a ware, including ships, weapons and so on. So ship producing facilities can be put into the galaxy without additional coding. Trading stations collect wares produced by factories and act as the main trading hub of each sector, they can also act as resource sink if there’s an overflow of a particular product. And, of course, sectors lacking a particular product will buy it for an higher price than sectors having too much of it. Raw materials can be found in the right sectors through mining asteroids (3 kinds so far, probably more later) and solar panels (raw energy, basically used for everything). Factories use those resources to make basic wares that are, in turn, used to make more advanced ones and so on. In other words, space trading simulator 101.

What’s more interesting is how the transit of wares is happening. Compared to X, it’s a much more efficient system. In X, any of them, each trading vessel scan the whole universe for stations sell/buying what they want. This is something that doesn’t scale well at all as the computing cost grow exponentially as the amount of traders and factories increases. More to the point ships have no guarantee that what they want is still there when they arrive at destination. In UG, most of the decision process (where to buy, where to sell) is not done by the ships but by the station themselves. It can be compared to a mission board, factories post missions like “need 100 energy cells” or “10 javelin missiles available” to this board when needed. Then, at both the station AI level (local trading) and the faction AI level (inter sector trading), those missions are attributed to the most suitable trading vessels available. It’s faster, more efficient and scale very well with crowded maps. Also, it can be incorporated into the mission system for the player.

UG in its base form (not-modded) probably won’t feature as many wares as X3, firstly because I lack graphic assets to have a bazillion factory types, and secondly because I don’t really think it’s needed to have 10 or so variants of the same exact product. More isn’t necessarily better.

What’s not yet set in stones, is how the AI determines what factories it needs and where to make them. It’s a fairly easy task for basic resource collection factories (mines and solar panels), but it’s quite more complicated for the whole thing. A quick and hopefully temporary solution is to make templates that will be used in sectors featuring a set of resources and according to the needs of the faction. The issue is that the AI wouldn’t handle custom made factories and wares (except by adding them to the template) which is not a deal breaking in itself, but it may lead to a feeling of “déja-vu” when visiting new sectors. I have some ideas on how to write a more adaptive system taking any kind of ware or station into account, and I will come back to it when the game reach a more complete stage as it’s way too early to test this kind of thing.

And of course, the player will be able to buy his own factories and stations, like any other faction, and assign trading ships that will transit goods automatically to keep those running.