Gazing for Advice on Improving GameSalad Performance

jessyyywilliamjessyyywilliam Member Posts: 1

Hello Everyone 😊,

I've only recently joined this community and am in the process of creating my first game, a 2D platformer. Although I've made some significant progress, I'm beginning to see performance problems, particularly when using mobile devices.

I was hoping the more seasoned players in this forum could offer some guidance on how to make my game operate more smoothly.

The following details relate to my project and the problems I'm having:

Frame Rate decreases: In situations with a lot of action, I've noticed that there are noticeable frame rate decreases when there are numerous actors on screen.

Memory Usage: On devices with lower specs, my game seems to use a lot of memory, crashing the system. I have no idea how to properly profile and optimise memory use.

Actor Spawning: I believe that using a lot of actor spawning and destruction is a factor in the performance issues. Exist any best practices for acting managers to steer clear of this? ο»ΏπŸ€”ο»Ώ

Graphics Optimisation: There are a lot of intricate sprites and backdrops in my game. What are the best ways to optimise visuals without making too many quality sacrifices? ο»ΏπŸ€”ο»Ώ

Sound Management: I too experience occasional lag caused by sound effects. What is the best way to handle audio files such that they don't affect performance? πŸ€”

It would be really beneficial if you could give any advice, sources, or ideas. I would also be interested in knowing about any GameSalad plugins or specialized uipath tools that are very helpful for performance optimization.

Thank you πŸ™ in advance.πŸ™‚

Comments

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,129

    I need to find our old tips thread / internal tips documents but here's some things:

    • Reuse actors that don't have complex state rather than spawn / destroy. You can instantly move them off screen / to another part of the screen by changing their position.
    • Use particles in creative ways. For one project our internal team use particles for parallax background elements. The idea is that the images just needed to move across the screen and required no logic. Since particles can take an image, just set the image, spawn rate, and speed to do what you need to have background elements move by. Useful for everything from star fields to fireworks to mountains.
    • Turn off physics.Movable and graphics.Visible when you don't need them. That prevents unnecessary rendering and physics calculations. This is great for things like actors with nothing but control logic.
    • When rendering text of something time based or that changes a lot, use function to reduce the number of updates (like round). Text rendering is relatively expensive if the text changes since we redraw all of the text, so reduce the change if you can.
    • Be sure to take advantage of the Music / Sound dichotomy. Music (m4a) is decoded as a stream by hardware. Sound (ogg) is decoded by CPU. So if you have a long track, make it music. If your game doesn't have background music and you have one-off large sounds, use Music. You can only play one music track at a time, but if you want to stream it it's probably a long sound like music anyway.
    • Also while you do need to meet a minimum sound spec for HTML5 because of our transcoder, if you are mobile only, use smaller sound files with low compression. Sound start delays are because of the time it takes to decompress them, so if it's faster to decompress, there will be a smaller delay.
    • If you can get away with playing the sound as the scene starts (like a white noise sound by combining a lot of sounds or just having some of the more common sounds introduce themselves) then do that so that when the sound is required later in a more time-sensitive manner during gameplay it's already in memory.
    • Ensure your images are in the nearest lower power of 2. This reduces texture memory. If your image is 1025x100, then it will use a 2048x2048 texture. Take the "hit" and make your image 1024x100. My rule of thumb is about 25%. If it's about 25% higher than the nearest power of 2, I'll experiment with resizing it down to see if there are any issues.
    • In that same vein, your images don't always have to be 3x the actor's pixel size. If your images are in the background, then it might be acceptable to make them 2x and have them slightly blurry.
    • Simplify actor behaviors. If you spawn any given actor a lot, make it's logic as simple as possible. Move any logic not specific to the instance into a common actor.

    Hope those tips help.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,129

    Helpful guide for powers of 2 starting at 32:

    32, 64, 128, 256, 512, 1024, 2048, 4096

  • uptimistikuptimistik Key Master, Member, Sous Chef, PRO Posts: 291
    edited June 14

    Would love to see what you're building @jessyyywilliam


    Frame Rate decreases and Memory spikes: Reduce spawning, remove physics (self.moveable) and use interpolate increase particle use. I've done some special effects at high speed without slowdown using this  Pay attention to audio/soundfx usage here. Use .ogg as much as possible, and also check to see if sounds are being played twice or more on collisions. Uncheck run to completion if the sound does not need to be used until the end.

    Controller actors: This takes a bit of planning but definitely helps- having various actors that perform specific functions instead of tons of code in one actor.

    Timers: If it's a repeated action, try using the loop behavior instead. It's faster and more accurate.

    Tables: Tables are your friend. Store inventory, game states, image references, sound references etc.


    I'll fill out some more as I have more time

    GameSalad Templates and Custom Development at the Official Marketplace: http://gshelper.com

Sign In or Register to comment.