Skip to content

Suggestions / best practices to follow #26

@ShockiTV

Description

@ShockiTV

Hi,

looking into code and trying to find a way to implement few things I would like to see ingame, I stumbled into some design issues.

First most obvious is that many things are being done in the app lua part and not using game events.

For example suggested flow for MIC interactions. Currently you trigger mic read from the script file and all other is done in lua app.
I would rewrite it a little.
For example I would add talker_event.script which would do AddScriptCallback("talker_event_trigger") and would register processing of given trigger which would lead to save into DB, if it is type which should be saved.
So back to the MIC use, it would do the mic call as now, but also pass reference to on_transcribed_text, which would be something like

function on_transcribed_text(event)
    SendScriptCallback("talker_event_trigger", event)    
end

And in lua app, it would do just that, transcribe and call callback .

Actual AI call will be done in another script, which would be listening for events on "talker_even_trigger". If the even type is something like "actor_mic_spoken", it will call the lua app method to do the processing which can include AI interaction.

The actual events should use raw constants for factions etc in DB, not the translated ones. Translation should be done "just in time" when creating AI prompt. Cause currently it is hard to do any additional things with it, and need to translate back to the game language values before using any game commands.

For example I wanted to trigger "enemy_sound" aggro command if you speak in vicinity of enemy. With this reworked setup, I can listen to event of player speaking on script level, check if any observer is enemy (which is kinda harder with current translation already in event) and trigger enemy version of AI prompt (which can have a chance (or 100% from max 3 enemies or whatever MCM setting) to enemy commenting with slightly different AI prompt) and also provide callback (which will wait for AI response if there is any expected) to trigger given "enemy_sound" aggro event which will make them go check if something is happening on your location.

To make this happen, I suggest 2 things:

  • use the custom script callback events to make all interactions more granular and observable
  • use raw game constants in DB events

I can do most of it myself, but the DB part is not backwards compatible (well there is possibility of migration when initializing the event store).
Just wanted to start discussion first and know if such things would be welcomed

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions