home about the studio about the team luxe game engine join the discord

You've successfully subscribed to Studio Any Percent!

Subscribe to Studio Any Percent

Stay up to date! Get all the latest & greatest posts delivered straight to your inbox

mossfield origins - dev #10

waste + food + water

Connecting the dots

Today I focused on finishing up the loose ends for the remaining producer buildings, making consumers block things, adding the waste resource to the game, and more. I did do a few assets and unique building states, but the gameplay is still the focus.

I also found several small issues, like when you destroy a producer (like when upgrading a building) all of it's resources get destroyed too. So that's fixed now, the stock just transfers to loose stock in the world.

New stock meshes

The image below shows the new stock meshes for wood + stone. The stockpile building was adjusted to account for the new sizes, but it looks a lot nicer and chunkier. Before, the stock building would also only stack on one pile, but now it returns a random pile to stack onto, so things look more organic. You can see it in motion further below.

Waste Generation and Processing

Some buildings like the wood based power producer and the first tier of wood and stone producers generate waste.

There's a specialized storage specific to waste, that will process it and slowly destroy it (for now). This means if you're generating more waste than you're processing it's gonna start piling up, and this leads to people wanting to leave.

The other factors are that waste generates work, which takes time away from other work that you want done, as well as taking up space. You can opt not to use waste buildings or to upgrade them to more efficient versions though.

Today I implemented the waste resource, waste resource asset, displayed the value on the hud (which for some reason the icon hides sometimes? I'll fix that later), added waste producers to all the buildings, added a waste storage + the custom waste storage logic which destroys waste over time.

You can see all that + the new stock stuff below. The waste resource is a small white box with some black marks on it, and the waste storage is the recycling icon.

Blocking Consumers

Consumers just take resources from a pile, if there are some. However, a building relying on the resource shouldn't be functional while it's consumption is blocked. If the building itself is a power producer, like the wood power producer that consumes wood, the power also has to be shut off.

This is all working now, the consumers block producers + power generators as expected, so that resources or waste don't generate if there's no input. And for the wood power producer, no power is generated, and it disables the node in the power network, sending whichever buildings are relying on it offline (unless they have another source).

In the video you can also see some simple state logic for the wood power producer. When the building is blocked, it changes some materials and stops the animations, when it's unblocked it plays the animations and sets the material back. There'll be status items in the side bar as well as icons above when in various states too, but it was bothering me that it animated when disabled, so now it doesn't.

Food and water production and storage

I hooked up producers to the food and water buildings, and hooked up storage to the food and water storage, so that supply chain now exists and there's daily food + water production + storage. I haven't yet added the food lifetime system but that'll come in soon.

I forgot to set the amount per visual so food generated an awful lot awfully quickly...

Not an exciting video, they just move stuff around.

I should note that because most of the systems are in place, added stuff to a building is really quick. In the video below I added a storage to the food storage building. There's not a lot to it. For things like producers or consumers the most work is in just positioning it in relation to the visuals but that's real quick too. (Ignore the ui issues in the editor like long strings... it's wip ✨)


Some quick things I wanna clean up:

  • There's no tasks generated atm for restocking consumers, I'll add that.
  • Producers only generate one task at a time, which isn't working well when they're stacking up. It should probably try to offload as much as it can onto stock piles, so generate N tasks where N is stock/offload_amount
  • When you destroy stockpiles, the resources are destroyed. Same as before, just gotta transfer them to the world.

    Bigger systems:
  • Food and water consumption
  • Food lifetimes