So, I had to run errands for most of today, but while I was doing them, I was seriously able to think about how a new economy plugin could work, as well as learning lessons from the old one.
As implemented, the economy is supposed to essentially make your fortress a capitalist society. The problem with that a typical dwarven fort doesn't represent that sort of system; dwarves work together as a whole to accomplish goals, weather they're hauling, soldering, healthcare, etc. Without hauling, which didn't pay anything as far as I know, nothing happens, and these dwarves become destitute.
As I sketch some ideas, I only need a few bits and pieces from the existing economy code.
Here's roughly what I'm thinking.
- The Fortress Account
- The Fortress itself would have an account. The fortress account grows by creation of coins, or by taxing guilds (dwarves themselves shouldn't be taxed, once its paid out, its theirs to keep. All transactions within the fortress go from this account to the guilds, and then the dwarf. A subset of dwarves would be paid directly from the fortress accounts, such as haulers..
- Coins themselves are owned by the bookkeeper, and not by individual dwarves; this prevents splitting, coin hauling, etc. They physically exist within the fortress, but throw them into a stockpile and call them good. No need to haul them everywhere. If possible, I'd also attach a value multiple to them to make them attractive for trading (i.e., paying for goods in cold hard cash).
- Restoration of Guilds
- 23a had guilds which dwarves belonged to and represented their works. This is a step in the right idea, but the old dwarvish economy didn't take it far enough, and was too rigid
- Each job pays into the guild, NOT to the dwarf. So if you do 25 mining jobs, the wage for each job goes into the guild's master account until the end of the month; this is likely something that will only exist within DFHack itself, and not within DF's existing economy code
- The economy DFHack plugin would keep track of the number of jobs done by each dwarf, and use that to track which guild they're part of. For instance, if a dwarf did mining for most of a month, they were part of the miners guild, even if their top skill was fish dissector. At the end of the month, the job count is zeroed out, and starts again. So if one month they do nothing but mining, they'd be a part of the mining guild, NOT part of the fishers guild. The following month, if they did nothing but make mechanisms, they'd be part of the engineers guild
- Guild leaders can make mandates if they're not getting enough work, to do something relevant to their guild.
- At the end of each month, the guild figures how much it should get generated, and makes a withdraw from the fortress account. Then each guild pays out to their members, based on skill, number of jobs a dwarf did for that guild, etc. I haven't worked out the specifics, but *every* dwarf in that guild will get something. So if a miner is badly injured in a cavein and can't work for a season, they will still get some dwarfbucks, though less if they actually did something for that guild.
- Products created are property of the fortress, not of the guild; dwarves in effect are getting paid to create them; the fortress simply automatically buys everything it can
- Not all money is paid out to dwarves, some stay within the guild itself
- Unguilded Dwarves
- Some dwarves won't be paid out from a guild since they're working for the fortress directly. This likely includes the noble special labors like "Update Stockpile Records", soldering, hauling, a few other things
- If there isn't enough labor to establish a guild, i.e. one dwarf makes a few mechanisms, and no other engineering happens then they will be paid from the fortress accounts instead of a non-existent guild
- Civil service doesn't pay well, but *does* pay consistently; enough to afford quarters and food. Minimum wage is calculated out from the cheapest of rooms available, plus cost of food, and a little on top
- Children will get a small amount of money for food from the fortress account each season.
- In effect, the fortress itself is a superguild.
- Taxes
- Unless one minted coins near nonstop, the Fortress Account would be quickly depleted after a few months. To prevent this happening, guilds are taxed to make up shortfalls in the fortress account. I'll likely need to implement an inflation mechanic to keep this working sanely.
- Taxes are only levied if the fortress can't pay out; since the fortress can make some money on its own through the sale of items (food, clothes) and rent
- Dwarves themselves aren't taxed. Once money is in their accounts, its theirs to spend on food, rent, and clothes.
- We calculate out how much is required to come out of the fortress account, and leverage taxes against the most wealthy guilds (though a bit from all of them as well). Money from the guild is moved back into the fortress account; this happens automatically, no tax collector noble to muck crud up.
- The fortress can go into debt if it simply can't cover its costs. This is a bad thing; likely a negative thought starting with the economy nobles, and working downward. Basically, if your fortress can't cover its own costs, stress levels go up. Minting coins is a solution, exports is another (maybe have"offerings" be goods being sold in the greater world, when something is offered, DB go into the fortress account; I could possibly tie this into trade agreements, but I don't know if DFHack has the necessary hooks to look at these programatically, and use it as a pseudo-supply and demand system).
The end result should be a system that doesn't starve your dwarves, but have them moving throughout the fortress, each earning a living, buying food they like if they can afford it, fancy clothes made of dragon leather, etc., else just falling into the rank and file. The economy shouldn't be something that requires micromanagement, more something that keeps the fortress acting like a living organism.
As of right now, to implement any of things, I need to do the following:
- Build a reliable job detector; I already semi-do this for dwarfvet, I just need to ramp it up.
- Create classes in a new plugin to handle the guilds.
- Figure out how to set the price of items within the fortress; as of right now, they're all initialized to 1; I'm going to need to spend some time with gdb and the item structures. This is the only thing I don't know how to do right now. This is the only thing that requires the current economy code to be active, the rest can be done via DFHack tick handlers; worse case scenario, I can watch for the eat/drink jobs, and the items attached to them. Painful, but doable.
- Define new nobles in the raws for guilds, and have them assigned automatically if a guild is created.
- Get room purchasing to work, or failing that, auto-assign rooms based on a dwarves balance (may be saner way to go; prevents them from starving themselves because they bought a million db apartment for a month; dwarf logic isn't foolproof in this regard).
- Generate mandates to prevent the fortress from going into debt to badly.
As a whole, the system needs to do the following:
- Prevent useless labor from gumming up the works (coin stacking)
- NOT require large amounts of micromanagement; guild leaders and the bookkeeper should generate mandates to keep things moving smoothly, but otherwise stay out of the way.
- Make the fortress feel alive, and be fun to have enabled. Not something condemned to the disabled pile because it breaks the game in half.
- Be fun, challenging and yet worthwhile. If you want dwarves to be truly happy with amazing mansions, you need to make sure they can afford it. A productive fortress is a happy fortress! By having a fortress flush with money, dwarves can afford loads of stuff (minimal wage will dictate what your civil service dwarves can afford; may extend this to all guilds as well).
I'm slightly worried I'm designing something too big, but knowing what I know from previous DFHack adventures, I honestly think this should be doable ...