4ian / GDevelop

🎮 Open-source, cross-platform 2D/3D/multiplayer game engine designed for everyone.
https://gdevelop.io
Other
11.7k stars 887 forks source link

feature: extending dialogtools to (optionaly) recognise the concept of an actor and apply some styling to things via the event sheet #6461

Open blurymind opened 8 months ago

blurymind commented 8 months ago

Description

Dialog heavy games often introduce the concept of an actor. That concept is used to apply base styling to the text when an actor is talking, change the avatar and do other things.

currently trying to do this with dialogtools is kind of cumbersome. You have to manually do it with bbtags all over the place that are later difficult to update (if you decide to change an actor's text color for example)

Solution suggested

The dialogtools extension can get a new mechanism that lets you add, remove and keep track of existing story actors.

Its interface can get a few new actions and conditions, as well as scrolling text parsing capabilities;

actions:

expressions:

// we can also directly alter the actor's stats and even add more new stats by doing this in yarn:
<<set $actor.fl.name = Florian>>
<<set $actor.fl.outfit = office>>
<<set $actor.fl.color = 230,122,113>>

<<set $actor.mike.name = Michael>>
<<set $actor.florian.outfit = office>>
<<set $actor.florian.color = 10,220,30>>

<<if $actor.florian.mood == happy>> yay! <<endif>>

// we are doing this by writing and reading directly to the dialog state
// that has the added benefit of greatly simplifying implementation of load/save game

also when we write a line like this in yarn

fl: this is an interesting idea
mike: is it?
fl: I think it will make it much easier to do polished looking dialog in games

dialog tools can identify that the line starts with an existing actor's id, followed by ":", and if so, automatically apply a style to it in the game via the new event sheet expressions + strip out the id: from the beginning of the scrolling text line

Florian: this is an interesting idea (you can now easily set up via events the text displayed to be in blue + avatar with applied mood to it)
Michael: is it? (notice how the name you can display is Michael, not mike the short alias and the short alias is now stripped out of the text)
Florian: I think it will make it much easier to do polished looking dialog in games (the name can be show in another label object and not be embedded in the dialog text)

And so of course this is entirely optional and if the user has not created any actors linked to dialog text lines, this new behavior is not applying any change to the scrolled text

@4ian is this something that would be welcome as pr? I kind of take this idea from how visual novels are implemented - specifically renpy. Also notice that alot of existing yarn games are doing this extra step in order to reduce tying to set text color/avatar/etc when the talking character is changing

the basic goal here is to eliminate the need to use tons of repeated commands and bbtags to set things up every time the talking actor in the game changes. Make the actual story writing process much easier and less verbose/prone to errors. If the dev takes the extra steps to add actors and set them up, they can benefit from just starting a dialog line with their name

blurymind commented 8 months ago

I almost have something now that can be pr-ed.

Created a task here for feedback https://trello.com/c/OyHmrf2D/537-implement-an-actor-concept-to-dialoguetools-extension

This has been bugging me with the initial implementation for ages

blurymind commented 8 months ago

This is now in PR, I just need to create a simple example of the new mechanics and do some more testing.

This was tested in a more complete project setting via javascript event blocks before pr-ed. I just migrated my code to the pr and renamed/hooked some things.