I have been having trouble figuring out exactly what I need to ask in reference to code rather than design, but I think this is the closest to describing what I’m looking for:
How can you allow selection from a list of specified data types, which provides a variable of that type?
I’m trying to create a DataAsset for creating conditions. For each condition, you select a subject with a data type for the parameter, a conditional for how to read that parameter, then either a value to compare to or a second subject with data type(does not have to be of same type) to compare to.
I’m not necessarily asking about flags for hiding/showing, as I have heard of others discussing metadata flags, but rather for help with designing a flexible framework for my data.
Examples:
-
Enemy strength > Self speed
-
Subject + DataType + Conditional + Subject + DataType
-
Which would provide an enum representing the subject, a variable to capture the relevant data, and an object/struct which would provide a means of comparison, (repeat first two)
-
Enemy equipment has shield
-
Subject + DataType + Conditional + value (of DataType selected)
The closest framework I have to achieving this is:
-
Enum EDataType to represent every data type available to conditions
-
Static TMap with key of EDataType, value of FDataTypeStruct
-
For individual entries I’d provide a derived struct which contains a variable for the type we desire
Unfortunately when evaluating these conditions, I’d have to figure out which struct I’m looking at in order to find the relevant data, and then access the method to retrieve that data (specific but not unique to the struct).
I’d prefer not having to create multiple structs for every data type, or even potentially creating structs to account for deviations, though I’m not sure it’s possible to create this flexibility without hardcoding it in.
If possible I was going to use an overloaded Get(datatype& param), so I’d simply need to provide a datatype to that Get(), it would select the correct overload and set the value of that OUT param, which would be part of a condition struct/object to maintain relevancy to other data in condition for the duration of the evaluation.
I was going to try and copy how blueprints create new variables (since they provide access to all types and then a value of that type once compiled), but blueprint scripts are contained in a virtual machine and I don’t know how/if I can access the actual code.
If there is a simple solution to this that I overlooked in my ignorance(self taught so I missed a lot of basics and am still figuring them out, sorry), please slap me with it. I’ve been wracking my brain on this for the past 3 days after I took a week trying to figure out an abstract design of the framework, so my brain and I may be a bit frizzled.