My gamemode has a lot of rules, but it was working fine until I added two new heroes. Every hero has 9 talents. Any tips to help me optimize so I don’t have to remove any character?
Try to categorize these talents into major branches, like active, passive and/or utility for example. Create simplistic rules for these branches and if they are dependent per hero or per player state variables, you can filter them not only in each condition list per rule (thats my assumption why you have so many rules, you don’t need rules for any possible case) with if-elseif-else block within the action list, that concises repeatitive taks into lesser rules, though these rules may have big action lists and reduce readability in the gui of the editor, but that is a small cost you would need to take to optimize your code. At any point in future i would recommend using high level languages like OverPy or OWSTW if you are familiar with text based programming, they offer more features in maintaining large code bases and data layouts, for example it is a bit easier (not entire perfect) to deal with multidimensional arrays or relational associative connected data, for example we can use dictionaries (in other programming languages known as maps) to work with.
This actually optimizes the mode? I would have thought it would make the mode worse optimized due to all the if-then-elses.
Its a doubled edged sword and only runtime test or test sessions provide a greater picture of performance, the point is that the kind of action you execute, especially with reevaluation options and their frequence of how much they will execute, how your control flow other than if-elseif-else branches are layed out and are used to do more or less complex tasks within a peroid of time. Simplistic tasks with the basic control flow directives may lead to less stress on performance when executed less frequently. At some point where you need to implement more complex stuff, you’d still have the option to break them down into smaller rules, to optimize performance again. The case on if-elseif-else is also they are part of the action list of a rule, and will weight only when the rule is triggered if the condition list evaluates entirely to true, so the setup of your conditions is also factor of how your mode will perform, due the statements in a condition list are checked and evaluated, depending on the event type of a rule, even more frequently than the actions do, conditions can have also more or less complex tasks to process at a time. There is no golden rule to optimize but some techniques to provide some optimizations with your code. For example to concise some simple task into one complex, and break high complex again into small parts, depending on when to execute. The when and how is determined by the type of event, condiiton checks and your initial abstract concept of your mode.