Vivek Agrawal Posted August 17, 2015 Share Posted August 17, 2015 Hello, So I have been working on a continous side scroller game with parallex background and ledges for the player to jump on.i have made backgrounds as tilesprite and put autoscroll on it. the game is jerking a bit from time to time, small lags in some intervals. can anyone suggest what might be the possible problem? here is the link to my game: http://gamegurus.com/demos/RunningMan Thanks Vivek Link to comment Share on other sites More sharing options...
drhayes Posted August 18, 2015 Share Posted August 18, 2015 Does it jerk in all browsers, or just Chrome? Link to comment Share on other sites More sharing options...
Vivek Agrawal Posted August 18, 2015 Author Share Posted August 18, 2015 i have tried chrome firefox and safari, jerks in all of them Link to comment Share on other sites More sharing options...
tips4design Posted August 18, 2015 Share Posted August 18, 2015 For me it works pretty good (I don't see any obvious frame drops). Link to comment Share on other sites More sharing options...
Vivek Agrawal Posted August 18, 2015 Author Share Posted August 18, 2015 hmm its weird, another person told me it looks good, but 3 people also have told me that they experience jerking once in a while, i am running the game in default settings, anything i can/should change to improve experience for everyone? Link to comment Share on other sites More sharing options...
wayfinder Posted August 19, 2015 Share Posted August 19, 2015 I can definitely see jerking. And sometimes it'll be really smooth for a quarter of a second, I can understand your frustration seeing that it's possible but doesn't happen. Sorry, I can't be of assistance in the actual problem though Link to comment Share on other sites More sharing options...
Vivek Agrawal Posted August 19, 2015 Author Share Posted August 19, 2015 is there any phaser settings i can try? like change from canvas mode to webgl, anything else you can suggest which might solve the issue Link to comment Share on other sites More sharing options...
Nikow Posted August 19, 2015 Share Posted August 19, 2015 Do you limit the max fps of your game ? At 30 for exemple ? And try to put the automatic scrolling of your bg on the render function ? Link to comment Share on other sites More sharing options...
Vivek Agrawal Posted August 19, 2015 Author Share Posted August 19, 2015 Do you limit the max fps of your game ? At 30 for exemple ? And try to put the automatic scrolling of your bg on the render function ?hi no to both actually, havnt limited the max fps of the game, will try that out and bg is getting scrolled using autoScroll function of tileSpriteand other things like coins are getting scrolled by velocity can you please explain what did you mean by scrolling in render function? Thanks Link to comment Share on other sites More sharing options...
tips4design Posted August 19, 2015 Share Posted August 19, 2015 I don't think you can limit the fps of Phaser Link to comment Share on other sites More sharing options...
Vivek Agrawal Posted August 19, 2015 Author Share Posted August 19, 2015 yea i confirmed that, cant limit the fps of Phaser, anything else that i can try? i dont understand why such simple game is jerking Link to comment Share on other sites More sharing options...
Jackal16 Posted August 19, 2015 Share Posted August 19, 2015 Setting desired fps does seem to be limiting it for me. Link to comment Share on other sites More sharing options...
drhayes Posted August 19, 2015 Share Posted August 19, 2015 I did a real quick CPU profile of your game and the garbage collector took ~2.9% of your program's execution. That seems kinda high to me and would explain the jerkiness. It might be time to profile your game yourself and see if you're allocating a lot of objects every frame or something similar. Things to look for: making new objects (literals, arrays), using lots of anonymous functions, etc. Link to comment Share on other sites More sharing options...
Nikow Posted August 19, 2015 Share Posted August 19, 2015 hi no to both actually, havnt limited the max fps of the game, will try that out and bg is getting scrolled using autoScroll function of tileSpriteand other things like coins are getting scrolled by velocity can you please explain what did you mean by scrolling in render function? Thanks I think you can try to put all the scrolling functions like velocity and tilesprite scrolling in the render function of phaser and not in update. Link to comment Share on other sites More sharing options...
Vivek Agrawal Posted August 20, 2015 Author Share Posted August 20, 2015 I did a real quick CPU profile of your game and the garbage collector took ~2.9% of your program's execution. That seems kinda high to me and would explain the jerkiness. It might be time to profile your game yourself and see if you're allocating a lot of objects every frame or something similar. Things to look for: making new objects (literals, arrays), using lots of anonymous functions, etc. i am using object pooling for most of the major objects, any way to check what things are getting collected by garbage collector? Link to comment Share on other sites More sharing options...
drhayes Posted August 20, 2015 Share Posted August 20, 2015 Not that I know of, no. I've always done this kind of thing by hand. The heap allocations profile isn't as helpful as I'd want it to be, but that might be a good place to start. Google's got a good list of things to look out for: https://developers.google.com/speed/articles/optimizing-javascript?csw=1 This too: https://developer.chrome.com/devtools/docs/javascript-memory-profiling Link to comment Share on other sites More sharing options...
Recommended Posts