WVAviator / lorecraft

Generate and play AI adventure games. Built with Rust/Tauri and TypeScript/React/Tailwind.
1 stars 0 forks source link

Narrator Functionality #16

Closed WVAviator closed 10 months ago

WVAviator commented 11 months ago

Upon starting a new game, a narrator Assisstant and Thread should be created, following the instructions from OpenAI's Assisstants API. The narrator instructions should include all non-changing context (game summary, scene list).

When the player types something and presses enter, a "send_message" Tauri command should be invoked with the message attached. That command should create a Message and add it to the Thread. It should then trigger a Run, passing in current information to the "additional_instructions" field (inventory, scene description). The Run will then need to be polled to determine its completion, and then the new Message response fetched, any actions and response applied to underlying game state, and then returned to the frontend.

Game Session will need to store message history, action history, current scene, current inventory, and anything else dynamic in the game. It's worth considering returning this entire state object to the frontend (minus the Game object, as it's fairly large) and just letting React do the work of updating the information based on state changes. A GameState struct, stored on the GameSession, could be useful.