Representing Game Dialogue as Expressions inFirst-Order Logic

Not about OpenMW? Just about Morrowind in general? Have some random babble? Kindly direct it here.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Representing Game Dialogue as Expressions inFirst-Order Logic

Post by sirherrbatka »

So I found this article https://ir.lib.uwo.ca/cgi/viewcontent.c ... ontext=etd and after thinking about it starts to look very interesting to me, especially for an open world game with procedural generation involved.

Prolog-style world description allows establishing relations between places, events, organizations, and characters in such a way that dialogues and behaviors of characters are more susceptible to change in reaction to the player actions. I am finding this idea very intriguing.
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Representing Game Dialogue as Expressions inFirst-Order Logic

Post by raevol »

I'll have to read this later, but I am very interested, especially with the computational linguistics class I am taking this semester.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Representing Game Dialogue as Expressions inFirst-Order Logic

Post by sirherrbatka »

Yeah, I am actually going through "The Art of Prolog" currently. Logic programming seems to be one of the most underused programming techniques in existence.
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Representing Game Dialogue as Expressions inFirst-Order Logic

Post by raevol »

Finally got around to reading this. I feel like the particular courses I chose to take in my schooling where bizarrely specific to prepare me to understand this paper...

Anyway, it's pretty cool. It definitely adds a huge amount of background work to get a system like this running, but I can see how it would make dialog in games much more interesting and rewarding.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Representing Game Dialogue as Expressions inFirst-Order Logic

Post by sirherrbatka »

Yes, indeed. I was thinking about this lately and came to some conclusions. For instance, Morrowind (but not only) characters fell unrealistic partly because they don't seem to have any personal connections. If you happen to be on the main quest and they happen to be temple members they will not like you, but all world seems to be very shallow in terms of game mechanics. Barely anything changes, really. I really think that logic programming could be potentially used to reduce this issue and not only that but do this in an extendable way. For instance, modder could add new stuff into the database and modify how the existing (or not yet existing) queries work. This could be huge.

Also, building a reasonably efficient prolog engine is not as complex as it may appear. WAM is daunting; yes, but there are other interpreters that are much simpler. I found an article that describes 2000 java LOC logic interpreter. This would be IMHO a good starting point.
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Representing Game Dialogue as Expressions inFirst-Order Logic

Post by sirherrbatka »

Ok, so I took a shoot at implementing basic prolog interpreter myself. It took a bit to wrap my head around it, but it was kinda fun. Currently, I am doing some rudimentary optimizations (copy loop unrolling is next on the menu). If anyone is interested, here is the link:
https://github.com/sirherrbatka/huginn
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Representing Game Dialogue as Expressions inFirst-Order Logic

Post by raevol »

sirherrbatka wrote: 01 Aug 2019, 17:32 I took a shoot at implementing basic prolog interpreter myself
Yeow! You are a brave man!
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Representing Game Dialogue as Expressions inFirst-Order Logic

Post by sirherrbatka »

I have a habit to take tasks just out of my reach ever since OpenMW. It works very much in my favor when it comes to learning stuff.
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Representing Game Dialogue as Expressions inFirst-Order Logic

Post by raevol »

That's a smart way to do it!
User avatar
sirherrbatka
Posts: 2159
Joined: 07 Aug 2011, 17:21

Re: Representing Game Dialogue as Expressions inFirst-Order Logic

Post by sirherrbatka »

Unfortunately, my implementation right now is just as slow as the paiprolog. I honestly hoped for something better but I will keep working on it.
Post Reply