Crafting recipe based on the input
Posted: Sat Oct 11, 2025 10:01 pm
Hello!
I got a mod idea: a more complex chemical crafting system, based on the input temperature of the fluids.
For example, one could have a crude oil cracking process, taking in oil and water. At 50°C, the output could be 80%/10%/10% (heavy oil, light oil, gas)
but at 250°C crude oil temperature, the output could be 50%/25%/25%. Just as an example.
This could open up some interesting gameplay, based on the heating and cooling of fluids, much like many real world chemical processes.
But how can i implement such a feature?
Some ideas i came up with:
1) Use the existing crafting system. The player selects e.g. "Oil Processing" as the recipe, but the chemical plant internally selects "Oil Processing 175°C", from a list of player invisible recipes. This is based on the input fluid box temperature, and would need to be checked every few frames. If the temperature changed, a different recipe would be selected, e.g. "Oil Processing 225°C".
Challenges:
- how would i display a different recipe to the user from the internal one? Given the complexity, if i have 5 temperature points for fluid 1, and 5 for fluid 2, that would mean 25 permutations of temperature combinations. As such, the user should only see 1 recipe, and not worry about the entire list. How do i do that?
- when to change the recipe? Is there a callback i can use whenever a product is completed? Or check on every Nth tick? My concern is that if i change the recipe at a random time in the crafting cycle, the process would loose the fluid ingredients, creating a very lossy process.
2) Create my own crafting system. I experimented with showing my own GUI (not easy) which looks similar to the chemical plant one, with a progress bar, and fake the same look. Then i create the crafting logic by manually operating the fluid boxes.
Challenges:
- very tedious to create the same GUI feeling
- very performance intensive to always check every few ticks.
I tend towards option 1, but how would i implement that without loosing production progress and ingredients?
I got a mod idea: a more complex chemical crafting system, based on the input temperature of the fluids.
For example, one could have a crude oil cracking process, taking in oil and water. At 50°C, the output could be 80%/10%/10% (heavy oil, light oil, gas)
but at 250°C crude oil temperature, the output could be 50%/25%/25%. Just as an example.
This could open up some interesting gameplay, based on the heating and cooling of fluids, much like many real world chemical processes.
But how can i implement such a feature?
Some ideas i came up with:
1) Use the existing crafting system. The player selects e.g. "Oil Processing" as the recipe, but the chemical plant internally selects "Oil Processing 175°C", from a list of player invisible recipes. This is based on the input fluid box temperature, and would need to be checked every few frames. If the temperature changed, a different recipe would be selected, e.g. "Oil Processing 225°C".
Challenges:
- how would i display a different recipe to the user from the internal one? Given the complexity, if i have 5 temperature points for fluid 1, and 5 for fluid 2, that would mean 25 permutations of temperature combinations. As such, the user should only see 1 recipe, and not worry about the entire list. How do i do that?
- when to change the recipe? Is there a callback i can use whenever a product is completed? Or check on every Nth tick? My concern is that if i change the recipe at a random time in the crafting cycle, the process would loose the fluid ingredients, creating a very lossy process.
2) Create my own crafting system. I experimented with showing my own GUI (not easy) which looks similar to the chemical plant one, with a progress bar, and fake the same look. Then i create the crafting logic by manually operating the fluid boxes.
Challenges:
- very tedious to create the same GUI feeling
- very performance intensive to always check every few ticks.
I tend towards option 1, but how would i implement that without loosing production progress and ingredients?