DRincs-Productions / pixi-vn-ink

1 stars 1 forks source link

Using PixiVN Features from Ink #26

Open BlackRam-oss opened 1 month ago

BlackRam-oss commented 1 month ago

It would be nice to add the primary functions of PixiVN in the Ink language. it is important that they do not interfere with the new syntax introduced does not interfere with the Ink one. so as to give the possibility of using Inky to test the narration.

BlackRam-oss commented 1 month ago

@blurymind hello sorry to bother you again, but I would need a second opinion.

in this issue I wrote some ideas to manage PixiVN functionality on ink. but I don't know ink that well and I would like to understand if the syntax can be intuitive

blurymind commented 3 weeks ago

yup no worries. I think I will try to make a basic example of inkjs talking to pixijs to illustrate this

blurymind commented 3 weeks ago

if pixi-vn already has exposed methods to do this - that can be used by a bridge class already :)

Can I not just set up the characters and then do this to make them say a line? https://pixi-vn.web.app/start/dialogue.html narration.dialogue = new Dialogue("Hello, world!", liam)

but then how do i do other stuff like make characters join the scene without saying a line, or changing existing lines? If I am just setting dialog to a line, that is not executing a method, which is more what I am expecting to find in a game engine.

This is the bit that will make it tricky

export const startLabel = newLabel(START_LABEL_ID,
    [
        () => {
            narration.dialogue = { character: liam, text: "Example of dialogue" }
        },
        (props) => narration.jumpLabel(START_LABEL_ID, props),
    ]
)

It expects you to define all of it in advance before you can show stuff? In my use case I need something that just allows me to show characters and their dialog without needing to define a list with actions in advance. The list part is something I want to replace with my own flow code. That way pixi-vn doesnt even need to translate ink syntax. A bridge can control that flow and tell the engine what to show and when

BlackRam-oss commented 3 weeks ago

hello i don't understand the question. do you mean if it is possible to set the current dialogue (or start other narration functions) outside of the "labels"?

if that is what you meant, then the answer is that it is possible, but (with the current version) pixi-vn will not handle the possibility of going back and the dialogue history (but there is a way to make them work)

what i'm wondering is how do you create a bridge? basically a bridge should detect events to the ink library and start functions and vice versa, right? what i don't know how to do is detect events, into ink

blurymind commented 2 weeks ago

So guess the question is, can we make pixi-vn display text and avatars or options without initializing the entirety of the story with its current api - which appears to expect a list of text.

For my use case, i want to let inkjs do that instead - decide when to display what text or options. Inkjs to keep track of story state, variables and so on - since they are embedded in its syntax. It has its own programming language and runtime and I dont want pixi-vn to reinvent that runtime and try to maintain feature parity with it at all.

You can embed hidden commands inside the text, using tags https://github.com/inkle/ink/blob/master/Documentation/RunningYourInk.md#getting-started-with-the-runtime-api

I can make a codepen example that is simple of how it can be used. Just need some time over the weekend

BlackRam-oss commented 2 weeks ago

Hello @blurymind

I finally decided to continue with the path of converting the json returned by the ink parser into one readable by pixi-vn. I understand the advantages of using ink directly, but the reasons why I took this decision are:

from Yarn Classic you are free to take "the texts, options and avatar" from ink. But I think it would be better to take this data directly from pixi-vn. I don't know how Yarn Classic works, but this way you could use the pixi-vn types and then it would make your work easier.

blurymind commented 2 weeks ago

To be fair I absolutely welcome that. The only concern is that it is such a huge undertaking that it might not be compatible with the demos even.

If you can get it to successfully parse something big like https://github.com/inkle/ink-library/blob/master/Stories/The%20Intercept/TheIntercept.ink That one is a pretty good stress test since it uses alot of the language's features

you can see that yarn can playtest it via inkjs with no problem already https://blurymind.github.io/YarnClassic/?gist=1252aaa8f74a394b3ac5695107f16e51&fileName=inkSample.ink

BlackRam-oss commented 2 weeks ago

considering the performances, these are not the best. because ink will analyze the file I generate a json, then this json will be analyzed by pixi-vn at the start of the project. so more or less if the performances of ink are n those of pixi-vn are 2n.

but consider that it is about milliseconds.

also I will implement a method to ensure that in the build phase the ink files will be transformed into the json compatible by pixi-vn. this means that in "production" nothing will be analyzed, so the startup performances are excellent.

in any case I will keep the file you gave me, when I will have finished with the development

BlackRam-oss commented 3 days ago

@blurymind

Hi, I had little time, but I managed to implement a fairly complete integration with ink. What is missing (but I will implement them in the future) are:

Starting tomorrow I will start implementing this issue. (I don't remember if you already answered me) What do you think about the syntax of these points?