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

Implement Dialogue tools Actor mechanics - closes 6461 #6469

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

blurymind
Copy link
Contributor

@blurymind blurymind commented Mar 20, 2024

This expands the current dialogue tools runtime with a set of Actions, conditions and expressions to enable setting actors and opening the door to implement a story based game with much less repetition for changing of avatars, text color, actor stats and so on

Todo:

I can confirm that this does not change of the existing functionality unless you set up an actor that is detected in a dialogue line in yarn.

I have also made some minor changes to simplify some of the existing code a bit

Assiciated ticket that this closes #6461 and #6420 since the actor stuff relies on it

New features that greatly simplify setting up complex dialogue:

  • Ability to create dialog actors and detect when they are the currently talking actor in yarn text lines
//in yarn
I am a normal line and I will work just the same as before
s: Hello, how are you? I am an actor line. If an actor with the id of "s" has been created, I will be treated differently
m: I am another actor line. The beginning "m:" will be stripped out of the text and DialogueTools will detect when I'm active
s smile: that is true! You can also pass arguments such as "smile" and dialog tools will tell the game when I am talking.
m: This makes it super easy to  dynamically change text color, avatars and so on when the active actor changes
s: what is useful is that the actor state is saved in yarn's state, that makes game saves and dynamic changes supper easy
// to change an actor's info, the pattern is as follows $a.[id].[variable]=newValue. Creating an actor simply sets those up
// this lets you easily change them during dialog or via the event sheet. A simple command is added to make this easier
<<set $a.s.color="123;12;123">>
// you can even attach your own values to an actor and use them to drive gdevelop events that update the avatars for example
<<set $a.s.face="smile">>
  • Ability to easily set up an actor's name, emotes, color, and any other parameters and dynamically change those
  • ability to get command parameter values via key like so (demonstrated use in the demo)
    <<command oldParameter keyedParameter=123 anotherKeyedParameter=true>>
  • ability to get tag values via key like so (demonstrated use in the demo)
    tag anotherTag keyedTag:123 anotherKeyedTag:true
  • basic ability to "fake" object variables in yarn, check if their keys exist, how many keys so we can iterate, delete object variables and so on. This is necessary for more complex games such as visual novels where we want to have better ability for yarn text to drive UI. The actor system is built on top of it

inspiration for thiss
https://www.renpy.org/doc/html/dialogue.html

@blurymind blurymind requested a review from 4ian as a code owner March 20, 2024 18:05
@blurymind
Copy link
Contributor Author

Sorry this is taking awhile for the demo. I want to make sure it stress tests the new features well while demonstrating in a simple way how to set it up and use it

@blurymind
Copy link
Contributor Author

@4ian and anyone interested in trying this new actor system, please feel free to give my little demo a try
https://github.com/blurymind/Gdevelop-dialoguetools-actor-system-demo

@blurymind
Copy link
Contributor Author

blurymind commented Mar 30, 2024

The demo presents a basic avatar mechanic where you have a left and a right avatar as well as layering (face is another layer from outfit) - all setup w the event sheet.

I am wondering whether to expand my actor system to also keep track of actor's avatar position and face to make it even easier to setup and use (fewer event sheet lines needed that way) - but it would make the system more opinionated about how its used in some ways. For now decided not to go further with adding more to it

@4ian
Copy link
Owner

4ian commented Apr 2, 2024

I've lost a bit track of the status of this, is this something ready to review/tested? :)

@blurymind
Copy link
Contributor Author

yes it is :) thanks in advance

@blurymind
Copy link
Contributor Author

If you feel like I need to expand the demo to present more of these features I can do that too? Let me know if you need anything for the pr or have feedback :)

@AlexandreSi
Copy link
Collaborator

I'm not familiar with dialogues with GDevelop. Do you know someone that used this feature a lot that could test this new feature to make sure it answers user needs?

@blurymind
Copy link
Contributor Author

blurymind commented Oct 22, 2024

Hi @AlexandreSi
The feature is really inspired by renpy. It just expands on what is already in gdevelop's dialogue tree feature, which I also created - to make it much simpler and quicker to craft rich dialogues without many event sheet actions.
It sort of lets you do what rpy scripts allow renpy users to do - in an opt in way. It only happens if you set it up.
https://www.renpy.org/doc/html/dialogue.html
You still have to set it up yourself, so it gives you tons of control how exactly it would work - but the setup part is made easier.

If you ever try to make a visual novel in renpy, you will find that it has its own dialogue scripting engine - similar to yarn. But that engine has the concept of actors, which yarn does not.
It lets the developer define the characters in the game, their avatars, text color, stats and so on in advance. This enables not having to do tons of repetition and boilerplate to trigger UI changes further down the line when writing the dialog.
This pr adds the concept of actors to gdevelop as part of the same extension that wraps yarn - in order to make writing dialog and particularly triggering avatar changes dynamically with much less code and setup.

If you want to understand its usefulness, it is probably best to try it with the pr branch and the example project branch the description of the pr links to. See what the example project implements and how, then try to do the same without the feature - with just the event sheet.

If there is not much interest in this becoming a part of gdevelop, I dont mind of declining my own pr :) Technically this doesnt really need to be a part of the engine. I have been using it for a while locally - i can override any js functionality without merging that to gdevelop. But since i was overriding my own js code that i wrote years ago, i thought might as well share the changes. It looks like if it just hangs around for years - it would just clutter the already busy pr list that GD has atm

I understand that there already is a paid visual novel extension or demo project using yarn? Not sure if this free one would clash with its sales too much 😸

In any case any feedback to the pr would be much appreciated. It would help me improve the extension

@Silver-Streak
Copy link
Collaborator

I'm not familiar with dialogues with GDevelop. Do you know someone that used this feature a lot that could test this new feature to make sure it answers user needs?

@AlexandreSi As someone who recently set up a real quick visual novel example for a friend, I can 100% confirm having the concepts of actors (and their states being accessible in the yarn dialogue files) reduces a TON of complexity that you manually have to set up a lot of duplicative events and variables for. I can assist with testing if needed, but as blurymind mentioned he implemented the original yarn/bondage.js/dialogue system as it is, so I'd trust the work.

@AlexandreSi
Copy link
Collaborator

I'm quite confident you are the right person for such an improvement @blurymind.
I want to make sure that the contribution addresses a user-oriented improvement/feature.
From what you're telling me @Silver-Streak it is the case.
I would just feel more confident if a user had some usability feedbacks, something that would say "this final user - that is not an engineer - gave their seal of approval".
Hope it makes sense 😅

@blurymind
Copy link
Contributor Author

blurymind commented Oct 23, 2024

Thank you, I would appreciate any feedback on the system and the demo project. They really need to be tested together and understand that its not a trivial task to do. Should ideally be by someone who understands the goal and benefit in this.

This really can be used for any type of game that needs character avatars and text colouring, but is ideal and inspired by what works for visual novels.

Renpy as an engine is surprisingly successful if you look at the number of games on steam made with it. My belief is that the key to its success is how quickly you can set up most of the ui mechanics and then triggering emotes is almost seamless. Actors hold variables as state, which is also an important part of this.

I didn't put that in the demo to keep it simple, but the ability to nest yarn variables which is also a part of this pr allows to easily set up a time system that makes events appear at different times of the week or day at different locations.

When you progress time, characters and locations change with it. This makes visual novels give the player the feeling of a living world which they can traverse

@Silver-Streak
Copy link
Collaborator

I have other obligations that will keep me swamped until the first weekend in November. While I can't test before then, if no one else has poked at it since then I'll see if I can play around with it.

@AlexandreSi
Copy link
Collaborator

I forked your branch (https://github.com/4ian/GDevelop/tree/experimental-build/actors-dialoguetools), formatted the code so that the CI checks passes, and started a build so that users can test it.

@blurymind
Copy link
Contributor Author

I am sorry, I will format this code on the pr after I sort out any review comments.
My Vscode prettier settings are not aligned with gdevelop's atm

@gsleonard
Copy link

Hello @blurymind
I played around with the project, and as a whole I think it's a really useful addition to the dialogue tree. Tools that like that help artists easily visualize their characters and scenes are fantastic. I think it'd also be a way for any renpy users who want to transition to gdevelop to do so more easily.
I don't really have anything bad to say about this, haha. Personally, I'd use it, with one caveat.

There is one thing I'd like to comment on, and I apologize if this isn't the right place to ask this, but it seems like there isn't any way to input line breaks into the dialogue. This causes the last "scrolled" text that hits the dialogue box border to suddenly jump to the next line in the middle of a word. Would this be something that's easy to implement/fix as well while you're updating the dialogue tree?
I've seen a some people hesitate to use yarn for Gdevelop because of this (me included), so I thought it'd be worth asking. Even if helpful concepts like actors are being introduced to the dialogue system, it might not see much use if things like this aren't solved first.

@blurymind
Copy link
Contributor Author

blurymind commented Nov 11, 2024

@gsleonard thank you for the kind words and the feedback. The scroll thing is something that has been requested before. Its an interesting bug which you can see in other game engines and even games on steam.

One way in which rpg maker for example has solved this is by adding a margin to how many words can be added to a line of text.
They kind of solved it by fixing the text scrolling implementation with the editor and telling the developer not to have more words than a line can fit - so as to avoid this scrolling problem.

I've looked into this before and so far couldnt figure a nice way to do it in the runtime, so am now wondering if yarn editor itself should warn the user when they exceed number of words.

Is that wrong or should it be done in the runtime - by breaking up sentences? The runtime doesnt know how many characters can fit on a line, so the developer will have to tell it.

I think this should be carefully considered and discussed in another ticket. Its a task which is trickier to do justice than it seems :)

@gsleonard
Copy link

@blurymind
Thank you for your reply.
I've found another ticket that relates to the topic so I mentioned you over there. I hope you can find time to check it out.

But yes, going back to the actor mechanic, I thought it was a good addition just based on my short time in testing it out. Though I'm just one user, I'd be happy to see it implemented.

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