Are long nesting rules a bad idea?

I want the points the players score for each correct answer to double every 10 times they answer a question correctly. So, for example, the first 10 correct answers, they'll score 1 point each time. The next 10 correct answers will earn them 2 points for each answer, the next 10 earns 4 points each, the next 10 earns 8 points, etc.

To do this, I've created a long nesting rule. i.e. when correct answers are >10 and <21 change game.score to game.score +2 otherwise when correct answers are >20 and <31 change game.score to game.score +4 otherwise when correct answers are... etc. I think this particular rule has 14 "otherwises" in it.

Are long nesting rules bad for performance, or are they a decent way to to something like this? Will these type of rules slow down my game? I also have a similar nesting rule for another aspect of the game.

Comments

  • beefy_clyrobeefy_clyro Member Posts: 5,394
    I've used deep nested rules plenty of times and never really noticed a big hit! As always, it depend on what else you have going on! I'm guessing this is quite a static, quiz type game? In which case, I highly doubt you'll get any problems!

    Needless to say though, get the GS viewer on a device and do a preview to see what frame rates you are getting etc
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    I have nested rules like 20-30 deep with no issues in reality it's more efficient. The game doesn't read all the rules in it. It stops as soon as one before comes valid.

    The hard part is on a all screen the area you have to work with gets really small cause each rule nested in another shrinks the space you have to select your options. Eventually it become.s impossible.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    You can work them up in groups of like 5 and them best them all together though and it should be fine.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Constrain Attribute game.questionValue to pow(2,(floor(game.questionsAnswered/10)))
  • whompywhompy Member Posts: 27
    Ok, thanks everybody. I knew there had to be a mathematical way to do this, thanks @tatiang!
Sign In or Register to comment.