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

Allow player to interrupt conversation with hotkey #258

Open
art-from-the-machine opened this issue Apr 16, 2024 · 2 comments
Open

Allow player to interrupt conversation with hotkey #258

art-from-the-machine opened this issue Apr 16, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@art-from-the-machine
Copy link
Owner

This section of code in output_manager.py allows the player to "interrupt" a radiant conversation and join in (turning it into a multi-NPC conversation):

https://github.com/art-from-the-machine/Mantella/blob/94fdfba52e5be60ded5a8e7a96d3a63bc1ae560f/src/output_manager.py#L648C1-L653C46

A new line of communication can be created which indicates whether the player is attempting to interrupt the LLM's response at any point (and not just radiant conversations), and if so, end the response as shown in the code above. For example:

end_conversation = self.game_state_manager.load_data_when_available('_mantella_end_conversation', '')
radiant_dialogue_update = self.game_state_manager.load_data_when_available('_mantella_radiant_dialogue', '')
player_interrupt = self.game_state_manager.load_data_when_available('_mantella_player_interrupt', '')
# stop processing LLM response if:
# max_response_sentences reached (and the conversation isn't radiant)
# conversation has switched from radiant to multi NPC (this allows the player to "interrupt" radiant dialogue and include themselves in the conversation)
# the conversation has ended
if ((num_sentences >= self.max_response_sentences) and (radiant_dialogue == False)) or ((radiant_dialogue == True) and (radiant_dialogue_update.lower() == 'false')) or (end_conversation.lower() == 'true') or (player_interrupt.lower == 'true'):
    break

Note that this line of communication would also need to be added to the Mantella Spell. The method of communication will change once this HTTP PR is merged: #205. It is better to wait for this HTTP PR to be merged before working on this task to avoid rework.

@art-from-the-machine art-from-the-machine added the enhancement New feature or request label Apr 16, 2024
@Leidtier
Copy link
Contributor

In the HTTP branch, the sentences are produced async and put into a queue.
Every request to continue from the game simply returns the next sentence from that queue.
Interrupting using HTTP should be as simple as:

  • stop the async LLM generation if it is still running
  • clear the queue

The hardest part in all of this is to decide hoe to implement that on the games side, especially with VR

@DaymareOn
Copy link

As a player, and as a Dragonborn, interrupting a NPC speaking inane opinions like some are wont to do, and giving them right now a piece of my mind, is an essential bit of roleplay :P

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

No branches or pull requests

3 participants