Stuttering with ads

I had a similar problem before, but it is more pronounced in this game. Basically if I run the game on android device without ads it seems to run fine and smooth. when I put ads in (admob), it starts to stutter after the ad plays in the gameplay.

It seems to be when sound effects are playing for the first time after the ads play. I have a very simple sound system - I load all my effects at the start of the game and then just play them. Its as if all the audio is being disposed of and has to reload again after an ad plays (which is not what is happening in the code).

Any idea what may be causing this? how to fix?

I stopped playing sound and it reduces the stutter, but its still there. this is so annoying - what could playing the ads be doing that causes a side effect on the rest of the code? is it swapping images/sound out of memory then back in? should I reload everything after an ad plays?

ok - it seems not to be related to the sound - I have traced it back to explosion animations - I have 8 of these and they are 2048 in size images. I load them using newImageSheet. but it seems after an ad plays it has to reload the image sheet the first time I create a new sprite with each explosion. so the first time I play explosion 1, I get a stutter - the next time I play that same explosion - no stutter…until I play another ad.

I remove the explosions and no more stutter after ads. but it looks boring…

I load other textures using newTexture and they are not affected.

I tried reloading the image sheets after the ads show, but that didn’t work.

Can I make an image sheet from a texture loaded with newTexture? can’t seem to see a way in the docs.

Any other ideas?


Well sort of - I create a sprite or each type and run the animation on level startup, offscreen. somehow this seems to reload everything at the start and no more stuttering - there must be a better way to do this.