Friday, March 28, 2014
Code miracle in progress. I'll be perfectly honest, I don't know how much of this is going to be visible in the video. Hopefully quite a bit. But the more important thing is that the beast is coming alive. Really, there's no stopping it now
I've had basically all the macro-level breakthroughs I need (several new ones today!!!)
Apologies, once again, if this log is lacking in coherence. So much to explain.
Today I finally understood money, supply and demand, life plans, the universe, and everything
Let me explain!
Money Solves Everything
It's an idea that I've been beating around for quite some time, but without having really come to a full understanding of it until today. Previously I looked at money as just like any other resource. This is a mistake. The purpose of money is far greater than that. The power of money is far greater than that. The key is in the fact that it is an intermediary. But until today, I had not appreciated just how much the presence of an intermediary simplifies everything!!
From an algorithmic perspective, money literally makes everything easier. A good way to understand this is in terms of path finding, since ultimately, that's what AI is (graph searching). If I have a resource X and I want to figure out how I can change it into resource Y, the problem is immediately recognizable as a graph problem. Resources are nodes, and tasks are edges. Without money, this problem is a full-blown graph search. It is very, very computationally expensive. But what money does is really quite beautiful. It says: "look, you don't need to solve a full graph problem. You just need to convert your resource into money, and then convert that money into your target resource." The statement is simple: to convert X to Y, I first convert X to money and then money to Y. The introduction of the 'universal' intermediary completely kills the complexity of the problem. The only 'searching' involved is how to convert a resource to money and back again. But this is not a search at all, as there is only one type of task that does so (at least for the purpose of LT): using the market.
Embedded in this understanding are numerous subtleties. Perhaps the most beautiful of all is that: by relying on supply and demand to dictate the conversion rates to and from the intermediary, we implicitly solve the full graph problem in a distributed way. I will put my resource X on the market, and issue a 'demand' for Y. If there is an easy path from X to Y, someone else may recognize it. They will buy X, produce Y, and fulfill my demand for Y. The credits that they receive for doing so should implicitly equilibrate to the path length from X to Y, plus a markup factor that reflects the cost of expended capability*time (e.g., man-hours).
If it does not, a competitor should recognize the differential, say "hey, I can take X to Y for a lower price and still turn a profit," and voila, the price should be driven down up to the theoretical minimum of the cost of production. In my theoretical understanding of economics, I do not see why prices should
ever drop below the cost of production. For LT I will assume as much is true, although I'm sure numerous people could present me with odd cases where this happens in real life, for whatever reason
But this has been trivial so far. Let's look at something less trivial. Suppose the existence of a path from X to Y to Z. Now we begin to see the power of the 'distributed' solving that money allows. I want to take my X to Z. I do not see how I can do it. But I trust that money can make it happen. Hence, I put my X on the market and issue a demand for Z. One NPC recognizes that he can produce Z if he has Y. He issues a demand for Y. Finally, another NPC recognizes that he can take X to Y. He buys my X, creates Y, and fulfills the demand for Y. The first NPC then takes the purchased Y, converts it to Z, and the path is then complete. At no time did anyone inside the system have to solve a complex graph problem. At no time did anyone need to determine the true path length from X to Z. And yet, we have established an economy which is implicitly capable of converting X to Z for (in theory) the cost of the path length.
Note that it will inevitably take some time before supply / demand is able to equilibrate to reflect the optimal path costs. In some sense, one could look at it like running an iterative Bellman-Ford solve on a graph, or something like that. Seems to me it's basically what an economy is doing. During the time of instability, there will no doubt be some bad trades made. But I imagine this time can quickly be overcome in historical simulation, and, by the time the player enters the universe, the economy can be sunk comfortably into equilibrium.
What beauty. I have never had more respect for the theoretical power of currency as an intermediary
(Don't worry, my interest is only theoretical
)
Bipartite Task Network Planning
Going further with the idea of money as a common ground for resource acquisition, we can actually make the mechanism of macro-level planning even more precise than it was before. We can look at macro-level planning as consisting of two distinct task networks: one for obtaining money, and the other for using it (corresponding to the discussion above that any resource translation can be broken into X-to-money and money-to-Y). Basically, we don't care about the direct correspondence between our capabilities and our goals. Yes, it will be nice if they align. But ultimately, we should be practical above all else: we should create a plan to make money using our capabilities, and then create a separate plan to use money to fulfill our goals. This allows us to
very precisely understand the purpose of all of our actions. We are either trying to maximize the monetary output that our capabilities afford us, or we are trying to maximize the goal output that our money affords us. Again, using our understanding of money as an intermediary, this is actually equivalent to optimally using our capabilities (as well as the capabilities of the local market) to achieve our goals!
Implicit Resource Pipelines
So far I have not mentioned how this macro view of resources incorporates the previous idea of explicit 'task networks.' You might say, "well, that's all well and good, but what if there's no one else around to solve the other steps in the path for the NPC? How can an NPC set up a full production pipeline with just his lonesome self?" But wait a minute...there
is someone else around! There's...himself!
Who cares if an NPC is alone in his ambitions and trying to set up a production chain in the middle of nowhere? The process still works!! You see, he still puts his X on the market and issues a demand for Z. However, he also notices that there is now a demand for Z that no one is attending to, and he sees a way to take Y to Z. He issues a demand for Y. Woah, look, now there's a demand for Y that no one is fulfilling! And he sees how he could take X to Y! And look! There's a supply of X! He
buys his own X, takes it to Y, sells it to himself, takes it to Z, and...there you have it!
Sound a bit strange? Yes, perhaps. But at the same time, it's ridiculously-elegant. Who cares if the resources / credits do not actually change hands! From the algorithmic perspective, an economic joint that is supplied and demanded by the same person is just a special case of the more general notion. Here we have the
exact same effect as full production pipelines. YET. We have an iterative mechanism for creating them one step at a time,
AND, even better, we expose each link in the pipeline to the public market, which, at worst, will have no effect, and at best, will allow outsourcing to someone else who will handle it more cheaply and efficiently than us.
AS IF THAT WASN'T ENOUGH, we also have the added benefit that supply and demand is
fully exposed at all links, rather than just at the beginning and end of the pipeline. Hence, significantly more opportunities are created all over the place. Suddenly, both the player and other NPCs can see loads of opportunities to jump in and help increase the scale of the operation taking place. All at once, the universe lights up with opportunity.
Wow.
Wow wow.
Now that, on a scale of 1 to 10, is awesome.