Is it any good idea to put 600+ "if branches" (no casting just for some simple variables) on 1 custom event ?

You could do it in a way that represents a tree.

Skill 1 { id = “Skill1”, bIsEnabled = false, required [ ] }
Skill 2A { id = “Skill2A”, bIsEnabled = false, required [ “Skill1” ] }
Skill 2B { id = “Skill2B”, bIsEnabled = false, required [ “Skill1”] }

You can check IDs in a loop until the requirement isn’t met. This way you only make checks until they’re not needed anymore.

You can also invert this concept and store the connections in the skill:

Skill 1 { id = “Skill1”, bIsEnabled = false, connections [ “Skill2A”, “Skill2B” ] } and have a list of starting points (the first element of each skill-tree) and make the checks from those, either with for loop or recursively.

Also, ifs (branches) and nesting are very bad things when done in big quantities. IF statements are the arch-enemy of CPUs, so any method you can find to reduce the number of branches/IFs is good.

1 Like