Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Random fps drop


MarcoWorms
 Share

Recommended Posts

Hi there, today I have a complicated task. I study game design and this semester I have a subject called "Mods". The Mods teacher asked us to make a megamen-clone-like game in Unity, but I told to him i wanted to make it in javascript and he said it's OK. Until now I've learned many things that I've never done with phaser before, like using Texture Packer and Tiled, I'm getting happy with the result but the FPS just randomly drops and goes back to normal. I haven't found any reason for that, I've browsed many FPS drop issues here but none of those seems to be the problem I have.

 

Link to the game: http://worms.io/megamen

 

Source: https://github.com/MarcoWorms/marcoworms.github.io/tree/master/megamen

 

So, I'd like to know if there is any tool to debug this (or if I just did something stupid).

 

The original task had a month to complete, but he only told me yesterday that I could use JS. The deadline is friday, the game needs to have a menu, 4 levels, walljumping and shooting. I think i can handle all this, this weird FPS drop is really the only problem I have that I feel my skillset can't solve. Thanks for your time  ^_^

 

EDIT: Solutions that didn't work:
-Making the Atlas power of 2
-Making the tileset smaller (tried a tileset with about 50 16x16 tiles and still the same)

Link to comment
Share on other sites

I am not experiencing any frame rate drops. I'm using Chrome and the FPS meter rendering from their dev tools. I also recorded the buffer usage, cpu, gpu and cache to get a look at the performance and all seems to be well. Please bare in mind, that mostly, gpu lockups and frame rate drops are caused by a LOT more than just your game. Sharing screen on skype will take 70% of your fps.. youtube video open will certainly not help. Hell, even facebook open as now the videos start playing automatically on your feed.

 

Your best bet is going to be to set some benchmarks. Say, three different browsers, 3 different machines, record all the scripting, rendering, painting and any other gpu intense times and layer them over to get a better idea of what's going on.

 

My gut feeling however, is that this may be caused by conditions that phaser has no control over. 

Link to comment
Share on other sites

Do you create any objects in the game update loop?

 

also out of interest what is win1Layer? to me it would seem unecessary to check for collisions with something that the player isn't even near. although I think possibly Phaser will do that check for you with it's collision algorithm.

 

also checking all tiles between 1 and 500 for collision in that layer is probably redundant... 

this.map.setCollisionBetween(1, 500, true, 'win1Layer');

isn't it just the pumpkin tile that the player hits to win?

 

that said... perhaps phaser just does this collision setup during create()  runtime, adding required bodies to the physics world.  Since it only finds the 1 tile in the layer, maybe it only checks that one tile at runtime during update()

 

maybe someone who knows the physics system better can answer

Link to comment
Share on other sites

sorry ignore me... whilst the (1,500,...) isn't necessary, it's just a create() thing..., it won't affect your update() from what I can see, as it just keeps an array of collideable objects in memory that it finds in the map

https://github.com/photonstorm/phaser/blob/master/src/tilemap/Tilemap.js

 

and as for the sprite vs tile layer collision, it seems to check just the sprites directly around the player 

https://github.com/photonstorm/phaser/blob/master/src/physics/arcade/TilemapCollision.js

 

collideSpriteVsTilemapLayer:

 

so while you could try manually checking for the player being close to the win tile, to avoid calling the collide() otherwise,  you won't be improving on it *that* much by doing so

Link to comment
Share on other sites

jmp909

 

sorry ignore me... whilst the (1,500,...) isn't necessary, it's just a create() thing..., it won't affect your update() from what I can see, as it just keeps an array of collideable objects in memory that it finds in the map

https://github.com/photonstorm/phaser/blob/master/src/tilemap/Tilemap.js

 

and as for the sprite vs tile layer collision, it seems to check just the sprites directly around the player 

https://github.com/photonstorm/phaser/blob/master/src/physics/arcade/TilemapCollision.js

 

collideSpriteVsTilemapLayer:

 

so while you could try manually checking for the player being close to the win tile, to avoid calling the collide() otherwise,  you won't be improving on it *that* much by doing so

 

Hey there, so, I added this win layer simply because i don't know how to interact with the object-type tiles yet (and I don't have time to learn it since i need this done by Friday) but i totally agree that I chose a poor way to do that. As for the FPS problem I hope it doesn't happen in the university's PC, i will test it there tomorrow and post what happened here after.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...