Hacker News new | ask | show | jobs
by dhx 16 days ago
This will perhaps be overkill for what you're trying to achieve, but there is Object Process Methodology (OPM)[1] which may be inspiration for modelling recipes. It looks similar to the methodology you're using, and as an example, expects the following type of modelling:

"peeling carrot" (process) consumes "washed carrot" (object)

"peeling carrot" (process) yields "peeled carrot" (object)

"peeling carrot" (process) yields "carrot peel" (object)

"finely dicing carrot" (process) consumes "peeled carrot" (object)

"finely dicing carrot" (process) yields "finely diced carrot" (object)

"prepare mirepoix" (process) consumes "finely diced carrot" (object)

"prepare mirepoix" (process) consumes "finely diced celery" (object)

"prepare mirepoix" (process) consumes "finely diced onion" (object)

"prepare mirepoix" (process) consumes "butter" (object)

"prepare mirepoix" (process) yields "mirepoix" (object)

The advantage of OPM is alignment of graphical and textual representations.

The downside of such approach is you soon discover how many millions of objects may exist in recipes--unwashed carrot, washed carrot, orange carrot, purple carrot, yellow carrot, white carrot, peeled carrot, coarsely diced carrot, finely diced carrot, julienned carrot... and purple julienned carrot vs. yellow julienned carrot. And that's just basic preparation complexity well before any contemplation of cooking or plating up elements. To go further you then discover a lack of useful labels such as "mirepoix" or "soffrito", if for example, you wanted to substitute sweet potato in place of carrot in the recipe.

Then there is SysML 2[2] which is kind of like OPM if you ever wanted to write a recipe in 35,000 lines of code, including possibly all the complexity of mathematical modelling of the Maillard reaction for purple carrots vs. yellow carrots using either extra virgin olive oil or butter. Probably best suited for the largest food processing companies such as Nestle, Unilever, Modelez, etc and even then, inherent complexity of their food products rarely would reach the level of a fine dining dish prepared by a chef.

[1] https://en.wikipedia.org/wiki/Object_Process_Methodology

[2] https://www.omg.org/spec/SysML/2.0/Language/PDF

1 comments

OPM looks like a great way to implement a free-style crafting system for a roguelike. I mean instead of having standard recipes that you have to assemble you could invent your own by putting together basic ingredients but then you need a way to know what comes out (and its effects I guess). I don't know if any existing games do that.
Also have a look at Inform 7[1] (domain specific language for interactive fiction), specifically the "Stone" example section[2] which explains edible food and the effects different foods may have on the adventurer.

It's similar concept to OPM with some modelling basics already built on top for player movement throughout a world, player interaction with objects (looking at, lifting, moving), and many other primitives needed to write interactive fiction. And relevant to this thread, Inform 7 of course has modelling basics for a player eating food, drinking potions, etc.

[1] https://en.wikipedia.org/wiki/Inform#Inform_7_programming_la...

[2] https://ganelson.github.io/inform-website/book/RB_9_1.html

Thanks! I know Inform. Haven't used it but I know of it and I think I've even played a few games written with some version of it. Adventure games don't usually do what I had in mind but maybe it's possible to do just not something very relevant to the genre?
I mean Minecraft is quite similar in concept. Start with wood and stone and end up with an atomic bomb.

Also useful to watch Dr. Stone anime.

That's right. Hadn't thought of Minecraft, was thinking very narrowly about roguelikes. Text based and all.