Framerate problem getting on my nerves &$#@

YouKnowMeYouKnowMe Member Posts: 74
edited November -1 in Working with GS (Mac)
Hi,
Last week i found a very nice template made by firemaplegames with custom fonts.
first i tested my game without the custom fonts in the gamesalad viewer, it showed 60 frames per second.
then i used 7 custom font actors, the FPSecond went down to 21. Is there a other way to still use custom fonts but keep the FPSecond up?

thanks.

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Your best bet might be to use custom fonts on menu screens and not during game play. 21 fps is fine if you are just checking out your high scores, but obviously you want it higher than that during game play.

    EDIT: you could even have it so it only displays the custom fonts right before you start playing and right after you die. Or you could have a score button that causes the fonts to appear. If you wrapped all the rules (with all those constrains) in a boolean that also made the fonts appear (interpolate alpha) you could try to have the best of both worlds.

    good luck
  • YouKnowMeYouKnowMe Member Posts: 74
    Thanks for the reply. But the fonts are used for the score, so i need it in the game :(.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    I need to update that demo...

    Right now it is set up to use Constrains in the Score Glyph Actor.
    Those will kill your FPS.

    You need to create a global boolean attribute called something like 'updateScoreNow'.

    Whenever something changes the score, set that boolean to true.

    And in the Score Glyph Actor create a Rule, like this:

    Rule
    When all conditions are valid:
    game.updateScoreNow = true
    -----Change Attribute: game.updateScoreNow To: false
    -----Change Attribute: self.Image To: "score_"..floor(( game.currentScore % self.divisor )/( self.divisor /10))..".png"

    That way it only updates when the score changes and it's not constantly taxing the system.
    That should help anyway.
  • YouKnowMeYouKnowMe Member Posts: 74
    Wow that worked perfect! Thank you very much!!
  • chicopchicop Member Posts: 263
    thanks for posting this,
    firemaplegames said:
    I
    -----Change Attribute: self.Image To: "score_"..floor(( game.currentScore % self.divisor )/( self.divisor /10))..".png"

    in your demo it does not have the "score_".. part before floor.. is this necessary to add to that command?

    also how can you see if its using the boolean and not the constrain?

    cheers
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    It depends on what the name of your images are. In this case the images are named "score_#.png"
  • chicopchicop Member Posts: 263
    ok,im very new to coding and trying to figure out what happens tends to get me lost...

    so ive created currentscore integer, tempscore integer and update score now boolean

    on the score increaser instance ive added

    on mouse button down
    change attribute game.currentscore to game.currentscore +10
    change attribute game.update score to true

    then i added the code to the sore glyph

    Rule
    When all conditions are valid:
    game.updateScoreNow = true
    -----Change Attribute: game.updateScoreNow To: false
    -----Change Attribute: self.Image To: "score_"..floor(( game.currentScore % self.divisor )/( self.divisor /10))..".png"

    however all the self.mydigit rules are still in there i take it these stay in there as other wise it would not know which number to display at the right moment...

    however when i click the instance, unlock it and get rid of the old code
    constrain self.mydigit to floor(( game.currentScore % self.divisor )/( self.divisor /10))

    nothing works any more...
  • JamesZeppelinJamesZeppelin Member Posts: 1,927
    One little thing i have found out is that 3 or 4 digits only changing within a couple times per second works fine. Its when you have 5, 6 or 7 running to the 1/100th of a second that kills you you

    For example In a racing game you wouldnt want the time to run like 12:54.567 seconds
    but a timer running in real time at 12:5 seconds runs smooth

    then after you finish you can display the full time 12:54.567 for you final time... or score etc.

    Also keep your images small and square. Something like 32x32 or 64x64
  • chicopchicop Member Posts: 263
    thanks James!

    I stil cant get the other bit to work so il try your way and hopefully the frame rate wont be to bad.
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    chicop said:
    thanks James!

    I stil cant get the other bit to work so il try your way and hopefully the frame rate wont be to bad.

    I was having the same issues with the scores not changing. I thought that probably it was happening because the rules were being read too fast.

    Then I added a timer rule and everything worked as expected.

    Rule
    When all conditions are valid:
    game.updateScoreNow = true
    --Change Attribute: self.Image To: "score_"..floor(( game.currentScore % self.divisor )/( self.divisor /10))..".png"
    --Timer: After 0.1 seconds - Run to completion
    -----Change Attribute: game.updateScoreNow To: false
  • jadjad Member Posts: 135
    where is this divisor attribute, was it taken out?

    EDIT: nvm, figured it out
This discussion has been closed.