High score very weird problem
http_gamesalad
Member Posts: 1,340
Well I was testing out my app and when game is over it usually works perfect but sometimes I get this problem
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
Comments
The problem IS with your coding. Attributes don't just randomly ignore rules that are set up correctly.
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
@tatiang it's loaded on my splash screen
Okay.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
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.
@AJaymz is the game.gameover checked or unchecked boolean?
@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.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
@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.
@Thunder_Child & @ajaymx what if I combine both of your suggestions together? Will it still work?! Double protection
@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.
@AJaymz so you don't recommend me doing this?
@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.
@AJaymz Let me test it out on my ipod 4 gen & give you feed back! I have a lot going on at once tbh..
Great! Would like to know what u figure out.
@ajaymz just tested it out & got 153 points. I noticed a lot of things
@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
@http_gamesalad you said it started to lag, is that with the every 0.1 second timer?
@AJaymz No, it didn't lag to much .. it played pretty well. It was when game over happened when I noticed some lag
@http_gamesalad hmm something not right. Hard to see what's going on without seeing code
@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.
@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
@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
@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?
@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
@http_gamesalad Take out all the timers and...