# Is this question about languages & architectures appropriate for Gamedev SE?

After discovering Dialog, I have become enamored with the idea of writing text games in logic languages. Unfortunately, Dialog has some key limitations that makes me think twice about starting a large project in it: mutable facts can only be unary or binary, there is no/little support for FFI, and objects cannot be instantiated at runtime. While these problems can be worked around, it starts to defeat the purpose of using a DSL - not to mention the runtime costs of everything but hacking in an FFI.

Being passingly familiar with logic languages in general, I looked towards Prolog to see if it would be suitable and found that there is little support for mutability in most logic languages. One either passes around the world state (potentially slow) as a parameter, or uses the incredibly dangerous assert*/retract family. With a bit of imagination, I can envision perhaps some system that assembles prolog/datalog databases dynamically, or translates queries to SQL, but this is well beyond what I am familiar with.

Being out of my depth, I'm hoping I can ask around for some advice; Gamedev SE seems like an appropriate place to ask in lieu of the strangely hostile StackOverflow. If this isn't the right place, would anyone know of somewhere more suitable?

Further Info:

To clarify why I think Dialog is inappropriate, I will examine the workarounds that I know/can think of. For the limited arity of facts, you have the macro facility which allows you to bundle facts like so:

@($Obj is$Rel $Parent) *($Obj has relation $Rel) *($Obj has parent $Parent)  You may notice that this macro only works if $Obj has only one relation (mutable facts are deterministic). This can be worked around by interpreting some datastructure composed of lists, but will miss out on optimization by the compiler. Similarly, you could enumerate these composite facts with IDs, but I also anticipate performance issues there.

@($Obj is$Rel $Parent !$ID)
*($ID has object$Obj)
*($ID has relation$Rel)
*($ID has parent$Parent)


For dynamic object creation, you can apply a similar tactic of assigning unique IDs to objects and tracking them with lists, but this again frustrates the compiler's optimization which is built around the object datatype (IIUC).

(new $Class is$ID)
(there are $N instances) (world objects$Objs)
(now) (world objects [$Class |$Objs])
($N + 1 is$ID)
(now) (there are \$ID instances)

• I'm not one of the mods, but I think asking questions about using Dialog to design a text game is perfectly fine for this site. You'd obviously have to keep them narrow and answerable, i.e. instead of generally asking how to design games in Dialog you could ask "How to work around [x] problem in Dialog?" and so on, but otherwise I see no issue. I hope you find a way to make this game, Dialog and Prolog are very interesting and unusual language choices for game-making - in college I had to put together a game purely in Racket, which was an equally tricky task. Oct 15 at 15:24

I am a bit unclear on your question.

Are you asking for library recommendations? If so, that is out of scope on this site. I would recommend softwarerecs.stackexchange.com or gamedev.net Discord for questions like that.

Are you asking about the pros and cons of specific tools? If so, that can be suitable for this site, as long as it isn't too vague. Be sure to specify your use case so we can best advise.

• I'll confess I'm also a bit unclear on the question and what a good answer should include. I think it would be beneficial to walk through a gameplay scenario in the question, "I want to be able to author a sequence of interactions in a text game that plays out like this..." and "I want the authoring process to have these attributes..." concluding "...what is a way I can achieve that gameplay outcome, while meeting my goals for the authoring workflow?"
– DMGregory Mod
Oct 15 at 18:08
• Language, library - any framework that lets me efficiently express the game logic using the logic programming paradigm is fine by me. I just want to make games, in the end. Software Recs SE looks like a good place to ask, thanks. Do programming paradigms and sweeping architectural decisions count as "specific tools"? E.g., ECS vs. traditional OOP as an obvious one or Prolog vs Dialog perhaps as applicable to the question? Oct 15 at 20:45
• @DMGregory Are you suggesting these questions as meta questions for me to answer to clarify this particular meta question, or as proposals for questions to ask on the regular website (is there a term for it?)? If it's the latter, then that's amazing! I only take issue with these constraints because I want to express things like procedural generation and object graphs (rather than trees). A concern, though, would be whether I would need to specify that this is in Dialog specifically, or would I be free to leave the framework to the answerer? Oct 15 at 20:52
• I was thinking about what would be needed to make it an answerable question for the main site. If it boils down to "what library should I use" or "should I prefer ECS or OOP" then those wouldn't be on-topic for this site. But if you want advice about how to write code to achieve a specific goal then I think that's on-topic for the main site. Just be sure to give us some good concrete examples of the kinds of procgen / object graph problems you need to solve, so we can come up with solutions that meet those needs.
– DMGregory Mod
Oct 15 at 21:02
• Sorry, @Evorlor, I forgot to mention that the framework need not be implemented. I'd also be happy implementing it myself if there was a convincing argument for its design and enough information for an idiot like me to cobble it together. Hence why I titled the question "architecture". Sorry it ended up being so unclear. Oct 15 at 21:03
• @DMGregory Then, if I am understanding you correctly, I could ask "What's the most efficient way to express mutable game state in the logic paradigm?", leaving the language/framework to the answerer? So long as I clearly define what the game state constitutes and what mutability and efficiency mean in this context? Oct 15 at 21:10
• "Most efficient" sounds like an optimization problem. Sadly in gamedev we usually don't have proofs of optimality. I'd ask for a strategy to achieve the kinds of gameplay outcomes you have in mind, and accept that the proposals you get might not be THE most efficient, just something that works. We can use votes to highlight ones that seem to be more efficient than others.
– DMGregory Mod
Oct 15 at 21:13
• @DMGregory That makes sense. Thank you, this has clarified a lot for me! Oct 15 at 21:16