High score very weird problem

http_gamesaladhttp_gamesalad Member Posts: 1,340
edited March 2015 in Working with GS (Mac)

Well I was testing out my app and when game is over it usually works perfect but sometimes I get this problem

Image and video hosting by TinyPic
AT first I thought is was my coding but I've watched the high score videos on youtube like a million times to make sure something isnt off about my coding and it was the same as the videos. I'm not sure why the score would be higher than the high score.

Again I thought the problem might have been because I set it up in my score actor so I moved it to my controller actor (which controls basically the whole game) .. I never got that problem again and I thought it was fixed.. till now.. this issue happens most when I beat the high score by 20-40 points or so .. the high score glitches or lags .. I'm not sure what to do

Image and video hosting by TinyPic

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2015

    The problem IS with your coding. Attributes don't just randomly ignore rules that are set up correctly. :p

    That screenshot is helpful but doesn't contain enough information. I don't know how/where you're loading the high score, for example. If possible, upload your project file (.zip it first) to a file-sharing service and post the download link here. If you prefer, you can send me the link in a private message and I'll see if I have time to look at it for you.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @tatiang it's loaded on my splash screen

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Okay.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • AJaymzAJaymz Member, PRO Posts: 164

    Try this:

    Rule- When game.GameOver is true AND game.Score > game.Highscore
    - Change game.Highscore to game.Score
    -save attribute game.Highscore

    (Then in whatever actor you have adding to your score)
    -when game.GameOver is False.
    - put rules for adding to score in this rule.

    That way your score will only be added if game is still playing and and risk any score being added if you get points same time as game over. And your highscore will only take effect at GameOver. This is how I normally do it.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @AJaymz is the game.gameover checked or unchecked boolean?

  • Thunder_ChildThunder_Child Member Posts: 2,343
    edited March 2015

    @http_gamesalad ...I used to have this problem on several games that score changed often and quickly.

    I fixed this by adding a timer to control both my score and change attribute high score at intervals of .1sec

    Make an actor called Score Keeper. Put the following rules in it and place this actor in any scene having anything to do with your scores.

    Every .1 save game.score

    Every .1 if game.score is greater than game.highscore change attribute game.highscore to game.score.

    Every .1 save game.highscore

    Every .1 load attribute highscore

    You pretty much have to have a way that your score changes faster than .1secs for this to become an issue again after this method...but it can still happen should between death and a bad guy kill worth 1500 points happen within .05 secs.

    Hope this helps. Helped me.

  • AJaymzAJaymz Member, PRO Posts: 164

    @http_gamesalad unchecked at start. Have it checked when game over is true. Or use whatever attribute your using to say that your game is over.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Thunder_Child & @ajaymx what if I combine both of your suggestions together? Will it still work?! Double protection ;)

  • AJaymzAJaymz Member, PRO Posts: 164

    @http_gamesalad know that running a timer constantly every .1 seconds may be heavy on performance. Don't know exactly what all you have going on in your game.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @AJaymz so you don't recommend me doing this?

  • AJaymzAJaymz Member, PRO Posts: 164

    @http_gamesalad I personally don't. But if you don't have a lot going on in your game at once then probably won't be a big hit on performance.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @AJaymz Let me test it out on my ipod 4 gen & give you feed back! I have a lot going on at once tbh..

  • AJaymzAJaymz Member, PRO Posts: 164

    Great! Would like to know what u figure out.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340
    edited March 2015

    @ajaymz just tested it out & got 153 points. I noticed a lot of things

    1. Once my score was higher than 70 points or so the app started to lag
    2. When game over happened it wanted to glitch out
    3. When the score and high score showed it showed 153 together but the way the app was acting and if I didn't set up the timer that @Thunder_Child suggested and the boolean you suggested I'm 100% sure it would have done the same thing. I can make this assumption because game.score > game.high score I tell the app to spawn a "best" actor . When the score and high score = 153 it didn't spawn the actor

    @Thunder_Child its the app "Flop Drop" that you helped me test so maybe I pop the balls faster than 0.5 seconds .. that sounds super fast BUT I'm pretty fast at this app

    Image and video hosting by TinyPic

  • AJaymzAJaymz Member, PRO Posts: 164

    @http_gamesalad you said it started to lag, is that with the every 0.1 second timer?

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @AJaymz No, it didn't lag to much .. it played pretty well. It was when game over happened when I noticed some lag

  • AJaymzAJaymz Member, PRO Posts: 164

    @http_gamesalad hmm something not right. Hard to see what's going on without seeing code

  • AJaymzAJaymz Member, PRO Posts: 164
    edited March 2015

    @http_gamesalad Not sure if you meant "no" it didn't lag too much or "no" you didn't use timer. If u did use timer, try it without that because I couldn't imagine saving and loading an attribute every .1 seconds. That would definitely lag.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @AJaymz I have my ipod does for shut the app a lot now... wondering if it's cause my ipod is that old or cause of the .1 seconds

    Image and video hosting by TinyPic

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @AJaymz @Thunder_Child I just noticed something... As I told you I scored 153 points but I just saw it didn't even save my high score as 153 even though it displayed 153 (by force pretty much cause of all the timers & the boolean) it saved my high score as 43 points... so it would have said score 153 points , high score 43 ! .. which makes no sense to me

  • http_gamesaladhttp_gamesalad Member Posts: 1,340
    edited March 2015

    @ajaymz & @Thunder_Child where would you recommend me putting this rule? In my score actor, high score actor or in my control actor .. along with my load attributes? My load attributes were originally saved in my splash screen actor but I move it my controller actor which is on my home screen (Initial screen)

    I checked my high score actor & saw that the same rule was set up and turned on.. do you think this might be the problem?

  • http_gamesaladhttp_gamesalad Member Posts: 1,340
    edited March 2015

    @AJaymz btw how gameover boolean is set up is

    Game.gameover = 1
    Change attribute game.gameoverBoolean to true

    Otherwise:

    Change attribute game.gameoverBoolean to false

  • AJaymzAJaymz Member, PRO Posts: 164

    @http_gamesalad Take out all the timers and...

Sign In or Register to comment.