Score keeping

PaxtonPaxton Member Posts: 89
edited June 2014 in Working with GS (Mac)

Hi everybody! I am figuring out the final things before my first release. Now, I stumbled across another issue.

I have an endless runner game, whose score is based on how long you stay alive. Currently, I have a rule (timer-> every 0.5 seconds -> gamescore+1). It works well, BUT: I get horrible performance, and I strongly believe that using timer for scorekeeping is the culprit.

How would you go about keeping the score without the timer function? Thanks!

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    I can't believe one timer is causing your horrible performance. Test it by simply turning off the behavior and see if your performance dramatically increases...

  • PaxtonPaxton Member Posts: 89
    edited June 2014

    @jamie_c said:
    I can't believe one timer is causing your horrible performance. Test it by simply turning off the behavior and see if your performance dramatically increases...

    I tested. If I turn off the score keeping stuff (including the timer), performance is buttery smooth. In my current configuration, you get 1 point for every 0.5 seconds of staying alive. If I set it to give the player 1 point for every 0.1 seconds, the performance gets even worse - that is why I feel something is dodgy with the timer.

    In the scene, there are 2 actors displaying the score (display text behavior): one is the 'current score' and the other one is your saved high score. If your current score becomes greater than your saved high score, the actor showing the high score will display the same score as the one showing the 'current score'.

    Thoughts? Thanks.

    PS: there are no other resource-intensive things. Project size is 597 kb.
    Edit: i still get very rare and barely noticeable stuttering when iAds change. Test device is 5th gen iPod touch.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    I've attached a sample file with a 'timer' based on scene.time. You could try using something like this. Note that the actor is un-locked in the scene, you have to do this to get access to the scene attributes.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited June 2014

    sorry, the file didn't attach. Here it is....

  • PaxtonPaxton Member Posts: 89
    edited June 2014

    @jamie_c said:
    sorry, the file didn't attach. Here it is....

    Thanks! I will have a look at it and get back to you. This gets me thinking, perhaps a "score" behaviour with multiple options (with options based on time, distance traveled, enemies killed etc.) would be a nice feature request for the next GS version o:)

  • PaxtonPaxton Member Posts: 89

    @jamie_c‌ thanks for your effort Jamie, but it didn't work... I still get stuttering (a bit less than before, though) - however, the change in formula led to a heap of other bugs in the game.

  • natzuurnatzuur Member Posts: 304

    That's odd. I have a game with probably 50+ timers, I don't ever see lag from those specifically. You should run xcode instruments to gather some more data about what is being taxed and get a timeline of fps drops from core animation to see if it correlates with the timer.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited June 2014

    Yeah, it sounds to me like you have bigger problems than just the single timer. I'd clean up all the code and make sure everything is a tight as possible. Like I said in the first post, one single timer should not make your game stutter.

Sign In or Register to comment.