[1.0] [WIP] Replimat - Distributed food replicator system

Started by sumghai, August 16, 2017, 05:39:21 AM

Previous topic - Next topic

sumghai

Quote from: tiger33116 on September 08, 2017, 04:37:50 PMOne get the basic components done first so hoppers to get feed stock, the tank to store it, and conduits to move it to the terminals. From there it's a base to really add events for using it.

That was the original plan, yes, but I've ended up tackling low-lying fruit lately because I struggle with C# coding of complex systems.

Quote from: tiger33116 on September 08, 2017, 04:37:50 PMLuciferium laced food anyone?

I'm gonna pass on this one.

Quote from: tiger33116 on September 08, 2017, 04:37:50 PMThe second thing I would suggest is some type of scanner that allows the terminals to put specific meals out when used.

Do you mean scanning a new food item in order to add it to the master list of available recipes?

Quote from: tiger33116 on September 08, 2017, 04:37:50 PM
This also could be expanded to get basic recourses or certain items at a very high feed stock cost or using a different type of feed stock. That could also have very interest events tied to it as well.

Industrial replicators are probably outside the scope of this mod, but I'm definitely keen to implement them someday elsewhere.

FYI, I chose the name Replimat for this mod because I wanted to focus on meals, and the name comes from the self-serve eatery aboard the titular space station in ST:DS9.

Sixdd

This looks great! I'd also like the idea that the computer could store "scanned" meal items and only the items you've scanned can be produced, maybe defaulting to nutrient paste when there are no recipes "installed/scanned".

I can't wait to have a fully working Replimat system.

As an aside, I noticed that human meat is disabled in the building defs, I would argue that after reconstitution nobody would notice they are eating human meat, just a thought.

sumghai

Quote from: Sixdd on September 13, 2017, 02:21:29 AM
This looks great! I'd also like the idea that the computer could store "scanned" meal items and only the items you've scanned can be produced, maybe defaulting to nutrient paste when there are no recipes "installed/scanned".

I've thought about this for some time, but felt that this would be too tedious in terms of gameplay, as well as being a bit beyond my minimal coding expertise.

Rather, all recipes come preloaded into the Isolinear Computing Module, which is only available from exotic goods traders. You would then use the ICM to build a Replimat Computer, and only those Terminals connected to the Computer can replicate meals (disconnected Terminals will do nothing).

Quote from: Sixdd on September 13, 2017, 02:21:29 AMAs an aside, I noticed that human meat is disabled in the building defs, I would argue that after reconstitution nobody would notice they are eating human meat, just a thought.

Makes sense - organic matter is organic matter.

sumghai

Progress Report, 21 September 2017

Since my last update, I managed to have the tanks store nutrient feedstock, and the terminals consume feedstock whenever a meal is being replicated. However, dubwise and I soon discovered that if a map does not have any Replimat-related buildings, the game would eventually crash after filling the debug log with various ThoughtWorker and JobDriver errors.

After much discussion and despite my dislike of bundling depedencies, we ended up rewriting the current code from scratch using Harmony to patch existing job drivers.

Here is what we have working so far:
- Terminals generate a random meal whenever a colonist or healthy prisoner uses it
- Feedstock tanks supply nutrients to Terminals
- A rudimentary food selection menu allows selection of available meals

And here are our outstanding issues:
- Terminals do not yet update in real time when feedstock tanks are missing/empty
- Visitors cannot use the Terminals
- Feedstock tanks can currently only be filled/emptied in dev mode
- Food delivery job drivers for colonist and prisoner patients currently do not recognize Terminals as a food source, throws log errors and fails entirely
- Custom refrigerated hoppers not yet implemented
- A power failure to the Replimat system could potentially crash the game completely
- Replimat computer not yet implemented
- Incidents disabled
- Exotic part required to build replimat computer temporarily unavailable do to removal of orbital trader patches

Looks like we've got our work cut out for us...

Sixdd


Madman666

This is definitely nice thing to look out for. Will be paying close attention to this)) Cooks be gone!

sumghai

Progress Report, 7 October 2017

The next piece of the puzzle were the hoppers.

In the context of the Replimat mod, the hoppers are supposed to take raw food, disassemble them at a molecular level into an organic nutrient suspension, and pipe them through the powernet to the feedstock tanks. I started off by making a 3x1 building with a 1x1 storage cell, with the two bits at the side representing the molecular disassembly machinery:



The transparent lid uses code similar to that for Rimfridge, allowing the contents of the hopper to be shown.

At dubwise's suggestion and assistance (along with help from a number of modders on Discord), I've made it so that if the hopper is connected to the powernet and has power, it will keep the raw food inside frozen. This is so that if the tanks on the network are all filled up, any leftover raw food isn't going to rot.

We believe our implementation of the freezer code might be a bit more efficient than what RimFridge has, so if you're interested, you can take a look at this commit: https://github.com/sumghai/Replimat/commit/8c75922bb0fd21ec0486732c89329a9bf2a5090a

I haven't yet fully implemented the actual conversion from raw food to feedstock, but the hopper currently supplies feedstock to the tanks at a steady rate for free. This, of course, will be fixed.

sumghai

Progress Report, 28 December 2017

After a bit of a hiatus, I've resumed work on this mod.

Hoppers now convert raw food into nutrient feedstock, which are then stored inside the feedstock tanks. As the Replimat Terminals already consume feedstock each time it replicates a meal, this milestone now means the basic supply chain from raw food->feedstock->meal is now complete.

Also, Replimat Terminals now require a Replimat Computer to be connected to the same powernet before they can start producing meals. The plan is to eventually move the meal selection / policy management UI to the computer, where players can define which food and beverage items are available from the menu for colonists and prisoners.

I've also updated the WIP mod to B18, which involved a whole bunch of minor tweaks and fixes.

One new issue I've identified is that sometimes, if a pawn can't use the Replimat (either because there is not enough feedstock or the pawn is on a map without a Replimat system), the pawn stops looking at other food sources and ends up starving. I think this may have something to do with FoodOptimality or even the order in which the JobDrivers are being added. I'd better fix this before looking into any other issue.


sumghai

Progress Report, 31 December 2017

Dubwise has significantly overhauled the entire codebase, and fixed quite a few major issues:

  • Replimat Terminals are now derived from the stock Nutrient Paste Dispenser, which allows pawns to use stock JobDrivers. Doctors can once again feed sick patients, wardens can feed prisoners, and prisoners can use terminals in prison cells (in the last case, wardens will not unnecessarily deliver food as usual). For those of you running the Hospitality mod, visitors can now also use the Replimats, but only after they've eaten all the food they bought with them.
  • Food optimality and preferences have also been fixed; if the Replimat system is down for any reason, pawns will safely revert to looking for precooked meals, nutrient paste meals, raw food etc without throwing massive errors or starving.
  • Finally, the Replimat computer now also has a gauge showing how much feedstock is available across all connected tanks.
My todo list, in rough order of priority:

  • Remove the "Needs hopper" message from Terminals
  • Fix status messages for Terminals and pawns (currently, they always say "getting nutrient paste" instead of the actual food item)
  • Add Hopper FX
  • Add alert message for low feedstock
  • Add "not connected to computer" and "no feedstock" status message for Terminals
  • Re-add "Sensitive Taster" trait if missing
  • Re-add incidents
  • Move meal selection/policy UI to Computer
Some (possible) stretch goals for future versions:

  • Batch produce meals (useful for caravans)
  • Facilities for feeding animals/pets
  • Facilities for replicating drinks (including synthehol variants of alcoholic drinks?)
  • Meal policies for colonists, visitors and prisoners
  • Daily meal schedules (i.e. what food items are available at different hours of the day)
  • Replimat-specific food poisoning incident?

Now, some questions for you guys:

  • Should I make the feedstock tanks smaller?
    The current tank has a 2x2 tile footprint, with a nominal capacity of 8000L based on some back-of-the-napkin calculations assuming a 2m diameter and 2m high cylindrical industrial tank.

    However, each replicated meal uses less than 0.5L of feedstock, and the conversion rate of raw food to feedstock is also quite low, which means that a single 8000L tank would be more than enough for a colony of several dozen pawns. If I make the tanks smaller, players can then scale the number of tanks to the size of their colonies. Also, having several tanks spread throughout a colony offers some redundancy in case raiders manage to destroy one or more tanks with a well-placed mortar round.

    If I do reduce the size of the tank to a 1x1 tile footprint, what should the new capacity be?
     
  • Should the Hoppers no longer refrigerate food?
    The Hoppers currently have RimFridge-like code that preserves any food stored inside it in case the feedstock tanks are full. Since it's now been established that the current tanks are too big to ever be filled to capacity, the Hoppers are already working non-stop convert raw food into feedstock. Should the fridge code be removed? Are there case

As always, please have a play around with the latest WIP and let us know what you think!

Harry_Dicks

Holy moley... this mod looks awesome! Gonna keep my eye on this one ;)

sumghai

Progress Report, 3 January 2018

Tackled some of the low-lying fruit on my todo list over the past few days:

- Terminals no longer show the "Needs food hopper" alert message

- Replimat Spill and Kibble Malfunction incidents added back into mod, and will "waste" feedstock when triggered; the incidents will only also happen if there is enough feedstock in the tanks

- Tank capacity reduced to 250 litres with a smaller 1x1 tile footprint; in the absence of any feedback, I made the executive decision to do so.

- Computer size reduced to a smaller 2x1 footprint, with feedstock gauge shifted upwards to compensate


Harry_Dicks

Quote from: sumghai on January 03, 2018, 02:05:40 AM
Progress Report, 3 January 2018

Tackled some of the low-lying fruit on my todo list over the past few days:

- Terminals no longer show the "Needs food hopper" alert message

- Replimat Spill and Kibble Malfunction incidents added back into mod, and will "waste" feedstock when triggered; the incidents will only also happen if there is enough feedstock in the tanks

- Tank capacity reduced to 250 litres with a smaller 1x1 tile footprint; in the absence of any feedback, I made the executive decision to do so.

- Computer size reduced to a smaller 2x1 footprint, with feedstock gauge shifted upwards to compensate



I really, really like the new computer. I didn't even know it came with a gauge on it, how awesome! Also, about the feedstock tanks, honestly I really liked the bigger ones. What about having both? A small 1x1 tank with 250L, and a big 2x2 with 1500L? Those are just rough numbers, but I threw out 1500 so that it would be a little more efficient than 4 small ones.

Either way, this mod is looking so freaking promising. Especially if you can "time" restrict things. Something to think about - but maybe in the future you could have a very similar system, but it is similar to a restaurant's fountain system. This way you could make a proper bar with some taps, that could dispense different drinks (Cupro's or Veg Garden's) that are piped in from some back storage room. Maybe even require Dub's Bad Hygeine's water/sewage lines to be connected to it!

Also, I'm sad to see that there is no longer a replimat conduit. Hypothetically, couldn't we just have our own sort of "replimat conduit" with Supe's Parallel Power Conduits and Power Logic? That actually has me kind of curious. Can the food still "travel" along those conduits, or must they be the vanilla conduits? And if they have to be vanilla conduits, could we use Power Logic's emitter and receiver coils for a separate conduit network without causing any issues?

Sorry for all of the questions, but there are just so many freaking possibilites with this mod and I FUCKING LOVE IT! 8)

SzaryKaptur

Doesn't work, when everything is builded they won't use it and they stop eat normal meals

SzaryKaptur


Vlad0mi3r

The idea of feeding animals with this system would be the reason why I would use this mod. I know I can use industrial rollers to distribute stuff like kibble around but building your base around rollers doesn't work for me.

Looking forward to the possibility of getting the kibble where it needs to be without the haul.
Mods I would recommend:
Mending, Fertile Fields, Smokeleaf Industries and the Giddy Up series.

The Mod you must have:
https://ludeon.com/forums/index.php?topic=40545.msg403503#msg403503