Jump to content

continous sidescrolling game jerking


Vivek Agrawal
 Share

Recommended Posts

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

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

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 tileSprite

and 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

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

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 tileSprite

and 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

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

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

 Share

  • Recently Browsing   0 members

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