eddieone Posted September 14, 2016 Share Posted September 14, 2016 On certain computers, ones that wouldn't seem like they should lag, movement in my game is slow. When using `game.time.desiredFps = 30;` it also happens. My question is, how can I drop frames instead of making players swim through mud? Instead of looking ugly, it becomes unplayable. I tested this for p2, it also happens with that physics engine. Link to comment Share on other sites More sharing options...
alex_h Posted September 15, 2016 Share Posted September 15, 2016 Have you tried profiling with chrome dev tools to confirm that the physics really is the bottleneck? Link to comment Share on other sites More sharing options...
eddieone Posted September 15, 2016 Author Share Posted September 15, 2016 I have, to me it seems to be related to rendering. Though, it's not entirely clear yet. I'm going to try and remove a bunch of stuff to isolate if it is text or something like that. Still though, it would be nice to be prepared for slow devices. Link to comment Share on other sites More sharing options...
alex_h Posted September 15, 2016 Share Posted September 15, 2016 I had a similar situation a few weeks back where a game was running really slow on some older iPads and low spec devices. I also first assumed it was the physics, but when I profiled with chrome found it was rendering graphics API shapes that was killing the processor. When I removed the Graphics display objects the game ran perfectly on those problem devices. Solution was to detect non-retina iPads and disable the graphics API features for those platforms. Isolating stuff like you mentioned is definitely the way to go in your case. Link to comment Share on other sites More sharing options...
eddieone Posted September 15, 2016 Author Share Posted September 15, 2016 Thanks for the tips. I haven't experienced the lag myself, I can only simulate it. Though, we have one machine with 6 core i7 and GTX 960, it's getting lag. I'm still collecting data, I'm hoping to pinpoint why some are getting 30-40 FPS on decent machines and others get solid 60 FPS. I read some where non bitmap text could cause slow downs, that that is my first choice for isolating the problem. We have a decent amount of text. Link to comment Share on other sites More sharing options...
alex_h Posted September 16, 2016 Share Posted September 16, 2016 PIXI.Text is automatically flattened to a single texture by default, which makes the whole text field display object no more expensive to draw than any other sprite. Text is probably not the culprit I reckon. Link to comment Share on other sites More sharing options...
eddieone Posted September 20, 2016 Author Share Posted September 20, 2016 We had 2 people report 30 FPS. After removing most text, they reported 55-60. Could be less tabs open or something. Still text or not, there is a massive flaw with Phaser having physics tied to frame rates. It will cut off a huge chuck of the possible audience. There is an old issue on github that explains it very well. https://github.com/photonstorm/phaser/issues/798 Link to comment Share on other sites More sharing options...
eddieone Posted October 14, 2016 Author Share Posted October 14, 2016 I had to buy a netbook to figure it out but I found a way to get what I wanted. The following code will drop physics frames if you will and allow a player on a slow machine to almost move as fast as someone with 60 FPS. So instead of being ugly and slow, it's mostly just ugly now. I mean visually browsers will try to compensate by lowering quality. // Put this in create or somewhere game.time.advancedTiming = true; game.physics.box2d.useElapsedTime = true; // Put this in render game.time.physicsElapsed = 1 / game.time.fps; Link to comment Share on other sites More sharing options...
Recommended Posts