Ulbast 3 Report post Posted July 28, 2017 Hi, I present you my game made in Phaser, here u are: redplanetgame.prv.pl I've finished it 3 months ago. It's a platform game, to collect all goals and kill enemies. When I was creating it, it worked fine, I mean, on full fps, but when I reach the end it drastically slowed down. I started few topic about this problem. I think, it's too many bullets or sth.(or my weird structure of code). When u inspect the browser, on bottom u can see all of my phaser code I've used. It's this: <script type="text/javascript" src="functions.js"></script> <script type="text/javascript" src="create.js"></script> <script type="text/javascript" src="update.js"></script> <script type="text/javascript" src="game.js"></script> <script type="text/javascript" src="jquery-3.2.1.js"></script> My question is: how to speed up whole game? Now it's seriously problematic. Another weird thing is that on many computers it works fine, on few it doesn't run completely (black screen instead of game), on other it freezes after few seconds, and in one the space+left arrow is not working xD Quote Share this post Link to post Share on other sites
Arcanorum 44 Report post Posted July 31, 2017 Rendering is usually the big killer when it comes to performance. This should show you some ways to improve it. http://phaser.io/tutorials/advanced-rendering-tutorial Quote Share this post Link to post Share on other sites
samme 719 Report post Posted July 31, 2017 https://developers.google.com/web/tools/chrome-devtools/rendering-tools/js-execution Quote Share this post Link to post Share on other sites
Ulbast 3 Report post Posted August 3, 2017 Thanks for your answers. Rendering from atlas is somehow complicated for me, the clearest , official tutorial have no basic explanation of it. But I've found a thing, that could be crucial here. Too many collisions handlers. Well I need them to control whole game, to call all essentiall functions, but they sloooooow game from 60 to 30 fps. game.physics.arcade.collide(bullets, layer, resetBullet); game.physics.arcade.collide(grenades, layer, resetBullet); game.physics.arcade.collide(ebullets, layer, resetBullet); game.physics.arcade.collide(chest3, chest5, chesting); game.physics.arcade.overlap(bullets, ebullets, resetBullet); It's for bullets to destroy chests, bullets with themselves and chest with chest. If I delete this, FPS goes from 30 to 60. But I need this. How can I do it? It's interesting, because the bullets aren't even created and they are slowing game Quote Share this post Link to post Share on other sites
ldd 21 Report post Posted August 4, 2017 from my experience, and plenty of other people's experience, it is 'bullets against bullets' that is causing your problems. If you can, disable that type of collision. If you absolutely must have bullets against bullets or other things, consider making less collisions anyways (maybe bullets only collide before 1 second has passed away, or only if your level is high, etc) In general, avoid collisions as much as you possibly can. Quote Share this post Link to post Share on other sites
samme 719 Report post Posted August 5, 2017 There's a problem with all of your "blocks" arrays. overlap(ebullets, grenblocks, collision_handler); E.g., in grenblocks, indices 1 through 302 are undefined. Phaser treats Group vs. undefined as Group vs. itself. So it will collide the ebullets against itself 300 times, sorting it each time, all for that one overlap call. If you use an array, it has to be dense: [ 0: Sprite 1: Sprite 2: Sprite ] Better yet, use a separate Group instead. Quote Share this post Link to post Share on other sites
Ulbast 3 Report post Posted August 6, 2017 Decreasing the value of collisions of bullets vs bullets and changing blocks into one type solved a thing, 60 fps now! Thank you guys! 1 ldd reacted to this Quote Share this post Link to post Share on other sites