Better to separate rules or nest them in each other?
![ShaneS429](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Just a general question. Say you are doing a comparison or seeing if an attribute = 1 of 5.
Is it better to nest the rules within one another such as
Is *attribute* = 1?
YES - Do some action
Otherwise - Is *attribute* = 2?
YES - Do some action
Otherwise - Is *attribute* = 3?
etc.
OR Separate all the rules?
Is *attribute* = 1?
YES - Do some action
Otherwise - Do nothing
Is *attribute* = 2?
YES - Do some action
Otherwise - Do nothing
Is *attribute* = 3?
YES - Do some action
Otherwise - Do nothing
Splitting them up seems like it would be easy for me to read, find appropriate rules, but if they are separated, wouldn't the game be checking each rule each time the game runs the update cycle?
But using technique 1, if the attribute has to equal 5, it would have to run through each other rule anyway.
Any benefit in terms of processing or fps for either way?
Is it better to nest the rules within one another such as
Is *attribute* = 1?
YES - Do some action
Otherwise - Is *attribute* = 2?
YES - Do some action
Otherwise - Is *attribute* = 3?
etc.
OR Separate all the rules?
Is *attribute* = 1?
YES - Do some action
Otherwise - Do nothing
Is *attribute* = 2?
YES - Do some action
Otherwise - Do nothing
Is *attribute* = 3?
YES - Do some action
Otherwise - Do nothing
Splitting them up seems like it would be easy for me to read, find appropriate rules, but if they are separated, wouldn't the game be checking each rule each time the game runs the update cycle?
But using technique 1, if the attribute has to equal 5, it would have to run through each other rule anyway.
Any benefit in terms of processing or fps for either way?
Comments