Suggestion for a custom data feature
Posting the suggestion here because the forum has much better formatting.
Here is the link to the actual suggestion board please vote for it if you like it.
https://construct23.ideas.aha.io/ideas/C23-I-266
Mockup of the feature in action
Mockup of setting a value in a custom data type
These mockups show how everything could work, and I mean COULD, I'm not hell-bent on this exact implementation.
With the custom data feature I try to address a constant annoyance I have with C3, handling of data. Specifically handling of data that is more than just a single float/string/boolean value.
To explain my 1st mockup, the idea is that you create a Custom Data structure with a unique name as a global identifier. You create a new custom data structure -> you set the name -> add variables -> the variables get a default value. Once you created a custom data structure it shows up as option in (instance)variables with the unique name you choose (lets say it's "my_data_type"). If you set the variable to "my_data_type" it will apply the default values you've set. Double clicking it opens a window pretty much exactly like the window where you add/edit normal instance variables, where you can edit the values of "my_data_type" (but not the actual structure/ which data types are in it with what names or their default value).
The 2nd mockup shows how to set a value in a custom data type in the event sheet. The content of the custom data type is actually not shown in the expression window because it would clutter it too much, just the name for the instance variable that is holding the custom data. Opening up the instance variable with the custom data is similar to normal instance variables but you get a 2nd drop down to specify which value from the custom data you want.
Requirements no matter how the final implementation ends up looking like.
- Storing of more then just a single value in (instance) variables, a collection of data.
- Being able to handle this data collection like any other variable, it can be easily copied to different variables of the same type ( set "my_data_1" to "my_data_2" ), it can be set as parameter in functions/custom actions ( function( my_custom_data, float, string ) )
- Ability to create the data structure in the editor
- Easy access to the data ( variable = player.my_custom_data.value, auto complete can suggest possible variables because the structure of the collection of data is known ( In the mockup the custom data "hero_stats" has hero_type/health/strength/intelligence/immunities ) )
Things to avoid
- No double picking
( pick player -> pick dictionary with UID ( player.my_data_UID ) -> do something with data )
- No conversion of data
( variable = rgb( 255, 255, 255 ) -> variable = random number -> how do I get only red out of this???, OR dictionary -> function( dictionary.AsJSON ) -> pick dictionary -> dictionary load from JSON string )
- No need to remember names or numbers
( like dictionary keys or array indexes, dictionary.get( ??? What's my key again?), array.get(?,?,? gotta open up the data sheet again and look up the number ))
- No AJAX to load data
One thing that would be amazing is nested custom data, but idk how much more difficult this makes the implementation, so I rather have the feature without it than not having it at all. I did however include nested custom data in the mockup to show how that would look like.
One last thing worth mentioning is that there would be another way of achieving all this, if it was possible to save instances themselves in variables. I imagine that would be much more difficult to implement, but maybe I'm wrong, idk. If we could stuff Sprites into variables and be able to access their bits like "player.sprite_instance.instance_variable" then that would be even better. But I imagine that's harder, would we also be able to access behaviors on it then like "player.sprite_instance.8Direction.MaxSpeed" or things like "player.sprite_instance.AnimationFrame"?!
Okay if you read all that you must be interested, so please go over here and vote for the suggestion.
Vote here!
And leave a comment with your feedback below, thanks.