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

If you end up with 600 of almost anything, it probably means there’s a better way of doing things :slight_smile:

It might be better to represent this in some sort of data structure.

While it might be tempting to use structs, I would advise against that. Structs can be a bit of a nightmare, and would make the situation worse.

What you basically have here are skills ( on or off ) and connections with cost.

You could do the whole thing with just a set of arrays:

  1. Skill array ( possibly enums )
  2. Bool array ( true if a skill is enabled )
  3. Connections, which could be done using a map ( dictionary )
  4. Something for the costs also, I’m not sure how that fits in right now ( I don’t get where the cost is in the structure )

Then you need to re-write your algorithm to cope with the new structure. Loops could pop up quite a lot.

This is just one way of doing it, there are many I assume. Very possible, but you’d need to be quite neat :slight_smile:

1 Like