We have a list of states (basically an excel which is imported as a data table) which checks the state of the blueprints in the scene. There are 20 actors(= blueprints instances) which each consist the same set of 6 components (meshes). The user can disable (hide) or enable (show) the 6 components on each of these 20 blueprints instances in the scene. When the user is ready, a button is pressed and the datatable should check which blueprints (instances) have been updated (meaning, the visibility of their components have been changed).
Each combination (Scenario ID = blueprint ID; component 1 + state; component 2 + state;…) matches with a line in the data table eventually returning a specific Scenario ID.
At the moment the components and their parent blueprint instances are all identified using a tag (in the properties of the blueprint/component). When performing a lookup, we compare the values in the datatable with the tags from the instances and components using the HasTag node and then check the visibility property.
However, we are running into performance issues when the table is consulted. One of the reasons we think is the fact that comparing strings inside the datatable with tags (strings) is pretty slow and we would like to change it into numbers. For example, blueprint instance = 1 which has component A = 1, component_B = 2.
**
What suggestions do you have to improve our performance in this setup? Or how would you do this differently?
What’s your opinion on using tags to identify individual components, what other methods could we use and how (e.g. use integers, one way or another)?**
Thanks in advance for your help or suggestions! It’s much appreciated.
If all the actors have the same number of components and the state of each component is determine by hide/show, then consider binary, where if row name would be the decimal representation of the hide/visibility of the components:
So, if the visibility of the 6 components of actor X is: 000111 (show: components 4,5,6 | hide: components: 1,2,3), then the corresponding row would be: 7.
Thanks EvilCleric. You suggest to use one variable (type: integer) with 6 numbers of which each number represents the state of a component of that blueprint? Is that right?
So whenever a user sets a component to visible, I should update this integer by altering the visibility value (e.g. 001000 → 001010).
Here is a possible implementation example (to simplify and improve efficiency, you can consider the use of bitmasks, id each component with a power of 2 number, and so on).
You have an actor with 6 static mesh or other type of components, and you want to calculate some value that indicates which components are visible or not:
To calculate the value, we consider a binary number where each digit corresponds to the visibility flag of each component. To calculate its corresponding decimal value, we just use powers of 2:
Hi EvilCedric, that would be a major improvement indeed. Thanks a lot for your screenshots. That will help tremendously. Feel free to post this as an answer so I can assign your text as answered (and give you a +1).