Background affecting frame rate

QuinnZoneStudiosQuinnZoneStudios Member Posts: 452
edited November -1 in Working with GS (Mac)
Hey once again Saladeers,

Glad to see all the success being had on the iPad front. You are all brave pioneers ;)

Anyway I was wondering what people had discovered regarding backgrounds. I have a wide scene that's 320 x 8000. With the just the score HUD and character in I get around 50fps testing on the GS viewer for 3G iPhone.

With a 480 x 320 png-8 web optimized non moving background it drops to just under 30 fps. That's around a 20 frames per second difference. With all my playable elements in there it drops to around 27 fps with the background (44 FPS without), enough to notice the difference when playing on the actual 3G iPhone.

I'm assuming there's not much else can be done, other than having a simple, smaller background? Halving in size to 240 x 160 an double sizing it back up in game could look pretty bad though I guess but I'll take a look for giggles.

I was just amazed that an optimized screen size background would chew up 20 FPS. I wonder if anyone else has encountered or solved this issue?

Thanks and happy Wednesday!

Comments

  • CatOnAKeyboardCatOnAKeyboard Member Posts: 39
    Since your scene is so large, it creates a lot of overhead for the GS engine. Unfortunately, the GS engine still processes everything that is present in a scene, including stuff that is offscreen. Even though your image is optimized, GS still has to render a 320x8000 image every frame, which is the root of your performance issue.
  • QuinnZoneStudiosQuinnZoneStudios Member Posts: 452
    Here's the thing though. When I didn't replicate the background, when the camera followed the character off the single image onto white space within the same scene, the frame rate went back up to the higher numbers. Once it was off screen it was okay. When my character went back onto that image again, the frames dropped.

    Guess I'll have to not have much background. I hope this isn't the case on the iPad. Won't be easy to know just yet as the simulator is running slow it seems.
  • CatOnAKeyboardCatOnAKeyboard Member Posts: 39
    That makes sense. If any piece of the image is on the screen, then the whole image is being rendered then? Meaning if no part of the image is on screen, no part is being rendered, although GS won't "forget" about actors offscreen like an old SNES game might :O
  • design219design219 Member Posts: 2,273
    When an actor get a certain distance off screen, it is destroyed. I don't remember the number, but it may be calculating the center of the actor, so it could be that the instance it is off screen, the center may be in that destroy distance and the actor is gone. ... or not.

    _______________

    Tickle Stones http://itunes.apple.com/us/app/tickle-stones/id363484260?mt=8
    Food Fight! (free) http://itunes.apple.com/us/app/food-fight/id352646643?mt=8
  • CatOnAKeyboardCatOnAKeyboard Member Posts: 39
    "When an actor get a certain distance off screen, it is destroyed."

    Unless you define a rule that does such a thing, this is simply not true :O
  • design219design219 Member Posts: 2,273
    Oh, hmmm, my bad. I could have sworn I remember Code Monkey saying something to that effect months ago.
  • CannonFodderCannonFodder Member Posts: 230
    Hi mike, i am getting around the same frame rate drop too from my background.
    Mine is 480x320 also. I don't think it has anything to do with your scene size, as my scene is set to the exact size of the background. Would be nice to know if there is something we have missed. As we seem to be the only ones having this issue lol.
  • QuinnZoneStudiosQuinnZoneStudios Member Posts: 452
    Yeah LPG...
    I even tried a smaller background and scaled it up but I still had similar results (except that it looked like hell) so it must be the fact that it still has to fill and render the space pixel for pixel.

    So either I have to live with it or redo all my backgrounds as little minimalist actors. Be a shame to give up the iPhone iPod market just because of this.
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    like design219, i too remember (think it was codemonkey) saying that actors a certain distance away do get destroyed, even without a rule
  • design219design219 Member Posts: 2,273
    Thanks beefy, glad to know I'm not losing my memory. Now, we need Code Monkey to confirm if that is true.
  • CannonFodderCannonFodder Member Posts: 230
    I am in the same boat mate. The game runs at 60 frames a sec without a background then with it runs at 40 frames a sec. Like you said it must be a rendering issue but still seems a little excessive. Just Intrested in how every one else gets around this?
  • quantumsheepquantumsheep Member Posts: 8,188
    What's your background of?

    I've got a project based on CodeMonkeys joystick thingy.

    If you look at that demo, you can see that in the 'two sticks, large area' part, the background is made up of 1 tile of 31x31 that's repeated over and over somehow. It *appears* to use just this one tile and runs pretty well.

    If you had a 'ground' background using the above method, you could possibly add 'landmarks' to your level as separate actors.

    Make sense?

    QS :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • adadoadado Member Posts: 219
    Maybe make sure your large background isn't using transparency!? If it is large and has unnecessary transparency, maybe that adds overhead computing blending when not necessary.

    On a related to your issue:

    I just removed the faded galaxies background from StarKeep gameplay scenes and only got a frame or two per second boost. It was 512x512 and I would randomly rotate it per scene to vary up the galaxy positions.
  • CannonFodderCannonFodder Member Posts: 230
    Thanks for the tip QS it's a space scene so I could use a tile effect I just really like my background lol. I will have a play around and see what happens, thanks mate.

    @Adado that's strange that such a large image only made your game drop a few frames a second mmm. I will have to do a few more tests when exporting the image from Gimp. I am sure I have not enabled transparency also but I will have a look,
    thanks.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Stunt Squirrels! uses a tiled 512x512 space graphic for the bonus levels. The bonus level is 2048x2048. I didn't notice any significant frame drop...

    It is an 8-bit .png, with no transparency, compressed down as good as I could make it.
  • CannonFodderCannonFodder Member Posts: 230
    Thanks for that FMG. I will open the image back up and make sure it's fully optimized.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Also, Stunt Squirrels plays at 30-40 fps anyway, so maybe I just didn't notice it!

    When I initially made the game, it didn't have a background - or any artwork. But when I added them, I certainly didn't notice a horrendous frame drop...
  • QuinnZoneStudiosQuinnZoneStudios Member Posts: 452
    Good to know all this for sure.
    The biggest issue I'm noticing when playing back on my 3G is more to do with how many actors/rules are being juggled. Watching the viewer it seems a frame rate close-ish to 25-30 FPS isn't that noticeable but when I have too many props with physics it stutters quite badly, even though the frame rate is still showing close to 25 FPS.

    I think my answer is to make shorter levels and find a balance between game play and processing. Tests and more tests is the way to go.

    Should be a happy medium somewhere.... or at least a miserable extra large - lol!
  • CannonFodderCannonFodder Member Posts: 230
    Just did some tests no matter what i do the frame rate drops from 65 to 45. The game runs fine on my 3GS so hopfully it will run fine on a 3G with the background.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    @LPG - If your space scene is larger than 480x320, you should make your bg image 512x512.

    This follows the "power of 2" rule that images use. Each image is allotted a space in memory to hold it. It is always a power of 2. So your 480x320 image actually requires a 512x512 chunk of memory to hold it.

    If you want to send me your image, I can check if it is compressed as much as possible. joe at firemaplegames dot com
  • CannonFodderCannonFodder Member Posts: 230
    The scene size is 480x320 but thanks for the tip. I will sent you the image now thanks Joe .
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Hey,

    I just sent the image back to you...

    Your image was a 24-bit .png and it was 143Kb

    I saved it out as 8-bit, since it doesn't need transparency.

    It is now 49Kb
  • CannonFodderCannonFodder Member Posts: 230
    HI, just put the background into the scene it still only shaves off 1 or 2 frames a second, but its better than it was, plus its now 100kb lighter.
    Thanks for the help its appreciated.
Sign In or Register to comment.