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

Custom information on characters #2352

Open
lenny991 opened this issue Jul 26, 2024 · 7 comments
Open

Custom information on characters #2352

lenny991 opened this issue Jul 26, 2024 · 7 comments

Comments

@lenny991
Copy link

lenny991 commented Jul 26, 2024

Is your feature request related to a problem? Please describe.
I require some custom data in my game. I of course can do this separately from Dialogic but it would be quite great to use this otherwise great extension for the same purpose, as the UI is so good and having only one workflow for many things is useful.

Describe the solution you'd like
I would find it extremely useful for Dialogic to have a section in the character view for some custom data. This could just be a dictionary, the values of which could then be customized to be arrays, dictionaries, ints, strings, bools, vectors and whatever.

Describe alternatives you've considered
I am considering now just making separate resource to save in my project to keep track of this custom data, but it is not ideal.

Additional context
image

Also, yes, I'm still quite unfamiliar with this extension as I only started using it yesterday so if there is some workflow to get the same desired result, please inform me. Thanks!

@CakeVR
Copy link
Collaborator

CakeVR commented Jul 26, 2024

@lenny991
Copy link
Author

You can already do this: https://docs.dialogic.pro/custom-portraits.html#4-export-overrides

Hey, I don't quite understand how custom portraits can be used for other custom data. I am not intending on using portraits for my game, at least not the kinds of ones tutorials show, where a portrait of the character is shown on the side of the screen. Instead, I'd like for appearances of the character to be in the game world, independent of the Dialogue that is currently playing, but I have to create these instances from code as the level is imported from another program.

I'll of course try it out :) Thanks for the suggestion. I'll update this if it works well and if it doesn't, too,

@firedfromlife
Copy link
Contributor

firedfromlife commented Jul 31, 2024

@lenny991 It may not be ideal, but for my game we extended the DialogicCharacter class. We made minor changes to dialogic UI to show these settings in the character editor, but if you just export the variables they will show up in the inspector in Godot.

Screenshot 1 shows the minor tweaks, screenshot 2 shows the inspector.

  1. image

  2. image

Could be interesting if the UI automatically detected these additional variables and added them to the character view. Maybe that would be a good use for the custom_info variable that currently stores sound and style data? It is already a dictionary so it can store arbitrary data.

@lenny991
Copy link
Author

lenny991 commented Aug 1, 2024

@firedfromlife That would be quite ideal. I've now stuck to just giving the characters extra variables too and it seems to work, but it'd be great to have them show up in the GUI.

I'm not very used to doing open source things, but I potentially could implement this, if given permission of course. It doesn't sound like a big hassle and it'd enrich many of our experiences with the extension.

(Or mine at least ;) )

@firedfromlife
Copy link
Contributor

Personally, I am just a contributor myself.
As far as if you are unfamiliar with open source, the process is simple.

  1. Create a fork of the project
    • image
  2. Create a new git branch for the feature you want to work on.
  3. Once you are done with the feature commit and push the changes to your fork.
  4. Submit a pull request.
    • It will then get reviewed by the maintainers to and potentially added to the main branch.

Lastly, I think this feature would be very nice to have, but I think it could be implemented in multiple ways:

  1. Custom child classes of the DialogicCharacter.
    • Likely easier to implement, slightly more complicated for the end user.
  2. Using the existing custom_info Dictionary.
    • Maybe harder to implement, probably easier to use.
  3. Supporting both.
    • Hannah Montana (Best of Both Worlds)

I think the third option would be best. Option 1 allows for basically just scanning the class and you can check variable types, pretty easy to generate UI based in that. custom_info on the other hand would likely require some amount of metadata to be stored with the values (datatype for sure, maybe what kind of UI element?). This would for sure want some standardization. @lenny991 This would likely not be a small thing to implement.

@Jowan-Spooner what are your thoughts?

@lenny991
Copy link
Author

lenny991 commented Aug 3, 2024

Hey, I've been implementing the custom_info dictionary for this morning. Godot kept crashing when changing the script of a .dch object. I've already created the dictionary which can now create, save, load and edit string values. All I now need to do is have multiple types, I think the wisest way to handle that is with something that works like Godot's own UI for the dictionary, where one can pick a type for the value. I think it'd be best to keep the dictionary's keys as just strings.

Here's a little screenshot,
image
I used the glossary add icon.

(Räätälöity = Godot automatically translated "Custom" to finnish :D)

So far it's been quite simple to implement, as I can just save the value as a Variant and then the value of the object can be checked in the editor, which then will create the fields.

@lenny991
Copy link
Author

lenny991 commented Aug 5, 2024

Hey, here is my branch: https://github.com/lenny991/dialogic-char-info

I dunno if you maintainers care to add this feature but it is fully implemented here. If it is approved though, I'll open a PR. Just drop me a mention.

It's definitely not perfect, lacks arrays and dictionaries (which probably would be quite easy to add), but I'll hold off on that until this gets approved, if it does. Also the right click menu can only be accessed by right clicking on empty space somewhere in the property. I'm thinking this could be changed to be so that right clicking on the name would have this effect.

I'll attempt to make a little jam game with this, to see if it's actually working well. It's not tested all too much. The editor parts should work quite well though.

ezgif-4-a1508e3e20
(also in the gif some of the names are weird, that's because Godot automatically translated some things into my language)

Also also have to mention, now that I start the branch in a new project I am seeing parser errors so I'll still have to investigate this. (and definitely have to work on this further a bit before any PR, as this still lacks a real way to get the data of characters through code)

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

No branches or pull requests

3 participants