Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Novel via prolog chaining #21

Open
peterohanley opened this issue Oct 29, 2018 · 7 comments
Open

Novel via prolog chaining #21

peterohanley opened this issue Oct 29, 2018 · 7 comments

Comments

@peterohanley
Copy link

The idea is to create a bunch of actions that have preconditions, expressed as prolog, and consequences. For example:

start_pursuit(A, B) :- character(A),
  character(B),
  knows_whereabouts(A, B),
  desires_interaction(A, B, OutcomeA, _),
  positive(OutcomeA).

which has as consequence pursuing(A, B). Another program will handling introducing and removing facts from the prolog environment. (frankensteined linear prolog basically) Possibly I will take character knowledge up one meta level, but not two. The novel is then a bunch of actions. Already this gives interesting narrative structures, like "tell the story in topological sort order but intentionally off by two" so you're always finding out why actions were just taken. The issues that I can foresee are:

  • how to write dialogue?
  • how to phrase pursuing and knows_whereabouts so I can write enough different actions?
  • desires_interaction is doing a lot of work here.
  • how to stop telling the story?

I'm sure I will find many other problems but I think the approach is promising, I know similar things have been done before.

@enkiv2
Copy link

enkiv2 commented Oct 29, 2018 via email

@shakna-israel
Copy link

desires_interaction would probably just need a series of weights, and then Prolog can handle it easily.

What motivates the character? Money? Hoarding everything?


I see a few things that would be easier, like dialogue, by using an embedded Prolog. That way, if there's no easy way to use the Prolog solver, you can just step back into the host language.

Say PicoLisp. It could handle generating the output file, and running a word count on it, to check for when the story should cease being generated.

@enkiv2
Copy link

enkiv2 commented Oct 30, 2018 via email

@peterohanley
Copy link
Author

Yeah, prolog rules determine the plot and actions and the host language will fill in descriptions and dialogue. Characters are motivated by finding the grail, which they do by finding enough kinds of information about , which they can get in a number of different ways or by taking from other characters. This plot is concrete enough that it should be practical. I considered an evil overlord plot but foiling plans seems more abstract. Of course, now that I seriously consider it I can think of ways to state it, but I'm sticking with Grail Hunters in the Jungle.

@shakna-israel
Copy link

Grail Hunters sounds awesome, and there's a lot to play with narrative-ly there. Easy to get several radically different outcomes.

@enkiv2
Copy link

enkiv2 commented Nov 1, 2018 via email

@peterohanley
Copy link
Author

I've made some progress.

start_moving(C, S, T) :-
	character(C),
	location(S),
	location(T),
	character_location(C, S),
	movement_possible(S, T),
	\+ moving(C, _, _).
start_moving(C, S, T) :! +moving(C, S, T),
	-character_location(C, S).
start_moving(C, S, T) :~ "$C left $S for $T.".

finish_moving(C, S, T) :-
	moving(C, S, T).
finish_moving(C, S, T) :!
	-moving(C, S, T),
	+character_location(C, S, T).
finish_moving(C, S, T) :~ "$C arrived at $T.".

ambush(C, T) :-
	moving(C, _, T).
ambush(C, T) :! true.
ambush(C, T) :~ "$C was ambushed by bandits on the way to $T.".

got_lost_while_moving(C, L) :-
	moving(C, _, _),
	location(L). % C goes to a random place
got_lost_while_moving(C, L) :! -moving(C, _, _), % safe because you can only be moving once.
	+character_location(C, L).
got_lost_while_moving(C, L) :~ "$C got lost and washed up at $L.".

I have a copy of https://github.com/Erdwolf/prolog that I've updated to compile, and which I'll modify to accept the above syntax. :- is like normal prolog, :! says how to modify the environment if this action is chosen, and :~ is my current plan for output. I will allow multiple :- and :~ clauses and if I think of a coherent use case for multiple effects allowing that will be easy too. This will allow a moving(C, Itinerary) multistep moving action that goes through locations rather than beelining, if necessary.

Actions are divided into starts and ends to allow interaction in the middle, like the ambush and getting lost possibilities here.

I have some ideas about choosing which action to take that I'll write up once they're more fleshed out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants