Problems with lag

LockPix.GamesLockPix.Games Member, PRO Posts: 3

my game runs fine on the Game Salad arcade but when it's played on a device it doesn't run as smoothly, how do i fix this?

Comments

  • SLOCM3ZSLOCM3Z Member Posts: 797

    @LockPix.Games said:
    my game runs fine on the Game Salad arcade but when it's played on a device it doesn't run as smoothly, how do i fix this?

    Do you use a lot of timers? People say that they cause problems

  • SLOCM3ZSLOCM3Z Member Posts: 797

    Also... huge rules... crazy amount of attributes... HUGE images... anything could be the problem. Sound playing a lot like shooting... spawning actors with lots of rules...anything could cause it

  • IceboxIcebox Member Posts: 1,485

    I'm surprised that it is fine on arcade but not on device , i thought its always the other way around . turn off your animations and try playing your game you must test it until you find where the issue is , my game was lagging from coins animation only, once i removed the animation it went smooth.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    I'm surprised that it is fine on arcade but not on device , i thought its always the other way around

    Device could be old with very low specs... what is the device, OS, memory, etc?

  • SocksSocks London, UK.Member Posts: 12,822

    @jdlcrater said:
    Also... huge rules... crazy amount of attributes... HUGE images... anything could be the problem. Sound playing a lot like shooting... spawning actors with lots of rules...anything could cause it

    I'm not sure a crazy amount of attributes would impact performance, an attribute doesn't place a strain on the processor.

    Sound playing a lot - like a rapid fire sound from a gun playing every 1/10th of a second (or whatever) also shouldn't really be an issue as - if executed properly - would still only be 1 sound playing at anyone time.

  • SocksSocks London, UK.Member Posts: 12,822

    @LockPix.Games said:
    my game runs fine on the Game Salad arcade but when it's played on a device it doesn't run as smoothly, how do i fix this?

    You've provide zero details of your project, so you will just get a load of random guesses as to what the issue might be, Icebox suggests turing off your animations, but of course you may not have any animations, jdlcrater speculates that you might have lots of timers, but that could also be wrong, and if you wait long enough someone will ask you whether you are using tables (which you might or might not be) . . . . and so on.

    These are all good suggestions, some of them might even be right, but they are all just guesses, having people guess what is involved in your project is pretty much the slowest way to resolve issues.

  • IceboxIcebox Member Posts: 1,485

    @jamie_c I meant in my case , dealing with samsung galaxy tab 3 , I only had this problem with this device , but when i test it on iphone 5s , ipad , galaxy s4 and s5 , it works fine. Arcade is usually the slowest performance , even slower than older devices in my case, thats why im surprised that it works fine for him on arcade but not on his device

  • SLOCM3ZSLOCM3Z Member Posts: 797

    @Socks said:
    I'm not sure a crazy amount of attributes would impact performance, an attribute doesn't place a strain on the processor.

    Sound playing a lot - like a rapid fire sound from a gun playing every 1/10th of a second (or whatever) also shouldn't really be an issue as - if executed properly - would still only be 1 sound playing at anyone time.

    Attribute just sit there right? Doing nothing until they're called? And the reason I said the sound might be a problem is because I had the issue with playing a gun fire sound every .08 seconds...

    @Socks said:
    These are all good suggestions, some of them might even be right, but they are all just guesses, having people guess what is involved in your project is pretty much the slowest way to resolve issues.

    @LockPix.Games Socks is right

  • IceboxIcebox Member Posts: 1,485

    @LockPix.Games Socks is right , you should include details , but what I would do is test the game whenever I do something new, for example i told you about the animation how it slowed it down but it was only with many actors animating at the same time , sometimes interpolating position or size slowed down my performance once i removed it , worked fine. Other times timers slowed it down , rotate behaviour slowed it down , having too many moveable actors on screen slowed it down. But this is all on an old samsung galaxy tab 3 , when i work on other newer devices i dont face these issues. So it also depends on the device ur using.

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2015

    @jdlcrater said:
    Attribute just sit there right? Doing nothing until they're called?

    Yeah, basically, they aren't scanned as such, not until that are called into action, so in theory we could have 12,000 attributes and they wouldn't really impact performance.

    @jdlcrater said:
    And the reason I said the sound might be a problem is because I had the issue with playing a gun fire sound every .08 seconds...

    That shouldn't really be an issue, unless there are some underlying set-up issues:

    For example: you might have a gun sound that is 1 second long - and this is being triggered every 0.08 seconds, and 'Run the Completion is checked . . .

    . . . the result is that at any one time 12 sounds are playing simultaneously, because by the time the 1st bullet/fire sound is about to finish playing (0.96 seconds after it was triggered) another 11 have been triggered and are currently playing.

    Who knows, perhaps if you've not edited the bullet/fire sound yourself (in an audio editor) it could be longer than a second, it's not unusual for a sound FX like a bullet/shoot sound - although short - is sat in an audio file two or three seconds long . . . most uses of sound FX outside of game making are not concerned with file length so don't expect them to be trimmed down for efficient game making.

    Just checked in Logic X's sound FX library, one bullet sound example I found was 6 seconds long (mostly reverb tail), a GS user might throw a file like this into their project and then trigger it every 0.08 seconds without realising they are asking GS to play 75 audio files at once !

    That's an extreme example, but even a poorly trimmed sound effect, rapidly fired, could easy amount to 20 or 30 sounds playing simultaneously.

    That's the kind of set-up oversight I mean, it would be easy to miss, after all who is going to notice a couple of seconds of silence on the end of an audio file ?

    The solution is obvious enough, correctly trim the sound down to only the part you need/hear, in your case the first 0.08 seconds, another trick is to simply loop the sound rather than rapidly trigging it, so as long as you hold down the fire button the sound loops. I've got a few projects where sound is being played even more rapidly than 0.08 seconds and they all play fine, after all if set up right you are simply playing a single sound.

  • SLOCM3ZSLOCM3Z Member Posts: 797

    @Socks said:
    That shouldn't really be an issue, unless there are some underlying set-up issues:

    For example: you might have a gun sound that is 1 second long - and this is being triggered every 0.08 seconds, and 'Run the Completion is checked . . .

    . . . the result is that at any one time 12 sounds are playing simultaneously, because by the time the 12th bullet/fire sound is about to finish playing (0.96 seconds after it was triggered) another 11 have been triggered.

    Who knows, perhaps if you've not edited the bullet/fire sound yourself (in an audio editor) it could be longer than a second, it's not unusual for a sound FX like a bullet/shoot sound - although short - is sat in an audio file two or three seconds long (most uses of sound FX outside of game making are not concerned with file length).

    Just checked in Logic X's sound FX library, one bullet sound example I found was 6 seconds long (mostly reverb tail), a GS user might throw a file like this into their project and then trigger it every 0.08 seconds without realising they are asking GS to play 75 audio files at once !

    That's an extreme example, but even a poorly trimmed sound effect, rapidly fired, could easy amount to 20 or 30 sounds playing simultaneously.

    That's the kind of set-up oversight I mean, it would be easy to miss, after all who is going to notice a couple of seconds of silence on the end of an audio file ?

    The solution is obvious enough, correctly trim the sound down to only the part you need/hear, in your case the first 0.08 seconds, another trick is to simply loop the sound rather than rapidly trigging it, so as long as you hold down the fire button the sound loops. I've got a few projects where sound is being played even more rapidly than 0.08 seconds and they all play fine, after all if set up right you are simply playing a single sound.

    Wow. Okay. Thanks for that :) I had the sound at .05 seconds... which would cause the choppy "bug" I was experiencing and I had it as .ogg. Would the .ogg cause a problem? I really don't know which sound file would be the best.

    @Socks said:
    Yeah, basically, they aren't scanned as such, not until that are called into action, so in theory we could have 12,000 attributes and they wouldn't really impact performance.

    Whoa. So unless someone has 12,000 or 40,000 or whatever higher that could cause a problem. But I don't think ANYONE would need that many unless it is a very complex logic system.

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2015

    @jdlcrater said:
    Wow. Okay. Thanks for that :) I had the sound at .05 seconds...

    Not sure what that means ? Do you mean the sound was 0.05 seconds long ? Or that you were trigging it every 0.05 seconds (the one you said was being triggered every 0.08 seconds) ?

    @jdlcrater said:
    . . . which would cause the choppy "bug" I was experiencing . .

    That would be impossible to say without knowing the length of the audio file.

    @jdlcrater said:
    and I had it as .ogg. Would the .ogg cause a problem? I really don't know which sound file would be the best.

    GameSalad only uses two audio formats, MP4 for music and Ogg for sounds - you can of course import audio in different format - which GameSalad then converts to either MP4 or Ogg depending on whether you choose Music or Sound - it's a good idea when working on sounds externally to GameSalad to save/export them in an uncompressed format like WAV or AIFF (rather than MP3 and so on), you don't want compress on the way out of your audio editor and then compress again when importing into GameSalad - as you will likely comprise your audio quality.

    So . . . the format you were using was fine, but without knowing the settings, again, it would be impossible to say whether this was an issue - the Ogg file could have been stereo at 48kHz at a bit rate of 320kbps - or it might have been a tiny mono file at just 22kHz with a bit rate of 48kbps ?

    GameSalad's audio import is automated so you have no control over the quality of its conversion process, and it can often result in less than great sounding Sound files (music suffers much less from the conversion process) - to circumvent this you can import sounds in the correct format to bypass GS's conversion process (if you import Ogg files or MP4 files they will not be converted) - MediaHuman's Audio Converter is great for this - and it's free (Windows and OSX)

    http://www.mediahuman.com/audio-converter/

    @jdlcrater said:
    Whoa. So unless someone has 12,000 or 40,000 or whatever higher that could cause a problem.

    Even with 40,000 attributes I doubt there would be an impact on performance.

    @jdlcrater said:
    But I don't think ANYONE would need that many unless it is a very complex logic system.

    Unless they had finally slipped over the edge of reality and into the realm of the mentally unhinged, apparently this is now a standard question asked by clinicians when assessing a patient's metal wellbeing.

    "So, tell me again, how many attributes did you say your game had ?"

  • SLOCM3ZSLOCM3Z Member Posts: 797

    @Socks I had the sound length at .05, playing every .08 which made the very slight pause, I remember reading that GS does a lot more than .ogg and .MP4 somewhere which is why I have had trouble with what to use, or I just read it wrong (completely possible) and thanks for the converter.

  • SocksSocks London, UK.Member Posts: 12,822

    @jdlcrater said:
    Socks I had the sound length at .05, playing every .08 which made the very slight pause.

    Then there would be a 0.03 gap between the sounds, which means GameSalad is only playing one sound (at least one fire sound) at any one time, so my example above is not relevant here, your issue must be something else.

    Playing a sound every 0.08 seconds shouldn't cause an issue at all.

    @jdlcrater said:
    I remember reading that GS does a lot more than .ogg and .MP4 somewhere which is why I have had trouble with what to use, or I just read it wrong (completely possible) and thanks for the converter.

    They are the only two formats used by GS, of course you can import other formats, but these will be converted to Ogg or MP4.

  • SLOCM3ZSLOCM3Z Member Posts: 797
    edited October 2015

    @Socks said:
    They are the only two formats used by GS, of course you can import other formats, but these will be converted to Ogg or MP4.

    "Gamesalad allows the uploading of MP3, WAV, M4A, and OGG sound files."-Cookbook But they will be converted to .ogg or .MP4. Thanks

  • SocksSocks London, UK.Member Posts: 12,822

    @jdlcrater said:
    "Gamesalad allows the uploading of MP3, WAV, M4A, and OGG sound files."

    Yep, and I don't think it's limited to just MP3, WAV, M4A, and OGG, you can also import AIFFs, CAFs and so on.

    For best quality and control I export (from Logic) WAVs and use MediaHuman to make my Ogg files, for example GameSalad converts stereo files to mono when creating Sound files, so you might have a great stereo explosion which you want to keep stereo, so you'd convert your WAV (or whatever) to Ogg in MediaHuman - bypassing GameSalad's converter - which gives you full control over stereo/mono, sample rate, bit rate . . . etc.

  • SLOCM3ZSLOCM3Z Member Posts: 797

    @Socks said:
    For best quality and control I export (from Logic) WAVs and use MediaHuman to make my Ogg files, for example GameSalad converts stereo files to mono when creating Sound files, so you might have a great stereo explosion which you want to keep stereo, so you'd convert your WAV (or whatever) to Ogg in MediaHuman - bypassing GameSalad's converter - which gives you full control over stereo/mono, sample rate, bit rate . . . etc.

    Thanks :)

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2015

    @jdlcrater said:
    Thanks :)

    And finally a quality guide ! :)

    Stereo / mono ? That's down to you, whatever you think you need.

    Sample rate ? 44.1kHz for pretty much everything, no need to go above 44.1kHz as the majority (if not all?) mobile devices don't go above 44.1. Lower sample rates might be ok for some sounds, or if you really need to save on file sizes, but try not to go below 22.05kHz unless you are going for a crunchy lo-fi sound - and sample rates below 22.05kHz may well cause issues with not being supported.

    Bit rate ? 128kbps is a good starting point, this is pretty much 'full quality' in the compressed audio world, and there is little point going higher on mobile devices, you can get away with lower bit rates in certain situations, but I wouldn't go much lower than 64kbps.

    How do you tell if your bit rate or sample rate is 'right' ? Listen to it ! If it sounds good to you then it is good, even if you ignore to above suggestions and end up with some mono sounds at 22.05kHz / 32kbps and they sound great in your game, then they are great !

Sign In or Register to comment.