Issue with side scrolling game

0 favourites
  • 13 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • We've been working for about two months on a basic side scrolling game, with character movement up and down and parallax in the background.

    However, now that we are at a demo stage and started testing, we found issues with the scrolling movement. We tested on the following browsers: Chrome, Firefox, Opera, Explorer and Safari. In chrome, the game runs fluidly, with up to 60 fps and no issues at all, but on all the other browsers, there are "stuttering" issues. We can notice slight stutter in the parallax effect and any object that we place in the background or foreground, as if there is a frequent micro delay.

    After extensive research and reading through several threads on these forums, we tried some performance optimization tips, but with no positive results.

    Next, we registered with Ludei, as we also saw in their promos that cocoon solves most performance issues. However, after going with cocoon and testing an android version on a Samsung Galaxy cellphone and Google Nexus 7 tablet, the same stuttering issues are still present.

    Finally, we stripped the game down to almost nothing, just the character, a static background and one image of a plant in the foreground, and the same issue persists. You can check the stripped-down version at the following link (http://www.tenbolts.com/fish_game).

    As an additional test, we went back to the template that comes with Construct 2 (flying along) and we noticed that the same stuttering is present there, too. You can check by exporting the flying along template as is to html5 and running in browsers to see that the green blocks at the top and bottom do not have a completely fluid movement in all browsers, except chrome where it runs perfectly.

    This has us really baffled and we are at a dead end on how to solve this issue in order to have a fluid running game.

    Any thoughts and suggestions will be much appreciated.

  • Yes, I am experiencing the same stuttering problem that you mention on my own tests, with a platforming game in mind. I only tried Firefox and Chrome on PC though, no other devices, but since even a very simple scene with a few events seems to cause stuttering, my guess is that less powerful devices will render similar results.

    In my experience, Firefox delivers almost half the frame-rate of Chrome, the second being almost constantly fixed at 60 fps. Almost. And there I believe lays the problem:

    For some reason, every few seconds Chrome drops one or two frames below 60 and that results visualy as stuttering. I don't remember if that was always the case with Construct 2, I haven't using it lately and with all the stuff that had being added and with internet browsers updating all the time, I feel kinda lost.

    In your game (by the way, I really liked what I saw, great job!) the stuttering is most noticeable at the beginning when the scrolling speed is low, after a few speed-ups I couldn't really notice anything.

    I feel like this problem needs to be confirmed and if so addressed as a priority, in fast moving games with delicate controls it really distracts the experience.

  • Rendering perfectly at 60 FPS means regularly hitting v-sync intervals in the monitor with very high precision. At 60 FPS these come about every 16ms, which is a pretty small amount of time to be hitting accurately. I don't think this is specific to Construct 2 or HTML5, because our old DirectX-based native engine had the same problem. I think sometimes the OS does some background work or the timers just aren't quite accurate enough and you drop a frame. In Javascript there is the added problem of garbage collection, but modern collectors are pretty good (as you note in Chrome it's nice and smooth).

    I don't think there's anything that can be done about this to totally resolve it. Still I think it's a fairly minor jump if it's just one frame that's dropped, and overall the motion is pretty smooth.

  • I was doing some testing along these lines a month ago and figured it was mostly garbage collection to blame.

    Things did seem to improve when I made as little garbage as possible.

    What I did was create all objects before the game started, and never destroyed ANYTHING. I kept everything I wasn't actively using just off screen, then moved them into position when they were needed, and moved them back off screen when they had been "collected". That way, while the game was running, no new memory was being allocated to create objects, and none was being released to destroy them.

    I didn't test on very many devices, and haven't had time to dig any deeper into it since then, but it definitely seemed to help!

  • We've been working for about two months on a basic side scrolling game, with character movement up and down and parallax in the background.

    Any thoughts and suggestions will be much appreciated.

    I was working on a game that had 2-3 levels of parallax that would freeze the game on Firefox at the beginning (1-2 seconds in), but not freeze on Chrome nor on the IP server mobile testing. Then after refreshing Firefox, the 2nd play would not freeze. I just assumed Firefox had HTML5 issues. Since yours is a Tap game, probably for mobile, have you tried setting up your C2 to test on your local IP server and use your mobile device to browse in?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you for all the responses. Sad to hear that it is such a difficult problem, though, especially with platformers. We will be trying out the suggestions provided by AllanR and lokken, hope it helps.

  • AllanR - the engine is already very carefully designed to minimise garbage creation in all parts, to the extent that creating and destroying whole instances does not allocate any memory, it recycles previously created instances. So keeping objects offscreen should not be necessary, even if you destroy them the next instance will be created from the same memory as the last destroyed one.

  • AllanR an interesting approach you went literally the opposite way I did on one of the games I'm making (where I was generating too many objects and had to destroy them all)... maybe recycling the objects like you did may help with the stuttering on my game but i'd have to re-"code" most of what I'm doing. Maybe I'll try using that alternative for next game.

    Ashley - update - hmm... so what could cause the stuttering. I'm using 2 BG's going back and forth with them, and making 4 platforms while falling (which is causing the player to jitter a bit ocasionally) I'm experiencing the same stuttering in cellphones too.

  • tenbolts btw your game looks very nice and so do the layouts

  • I agree, tenbolts, your game looks great - and runs pretty smoothly on my iPhone 5.

    Ashley, well, that is good to know, and doesn't surprise me too much - because everything else in Construct2 is "very carefully designed".

    It is possible that my results were more imaginary than anything else. I started with someone else's project that was not working very well, and I cleaned up the code, added parallax scrolling, completely changed the way the background was looping, etc. By the end it was working much better - but still not perfectly smooth. Some day I want to try Cocoonjs (and other wrappers) to see how much that helps (or not)...

  • Thanks for the compliments on the game. We'll be posting a demo probably quite soon. Also good to know that it works fine on iphone 5, so we'll look into testing from 4s upwards and perhaps make it our target devices.

  • We want to thank everyone who provided their invaluable feedback and support to overcome some of the issues we encountered so that we could complete our game, which is now available on the Apple iTunes App Store.

    Check out the gameplay trailer at

    Subscribe to Construct videos now

    Finn & Thale is now available on iTunes at https://itunes.apple.com/us/app/finn-an ... mpt=uo%3D2

  • Very nice! Congratulations for a impressive game and the intro is very well made.

    But I have to say that the epic intro/presentation in the youtube video builds up the expectations of the game and you are prepared for something huge and then you see the game and realize that it is a type of flappy bird clone.

    But that is just my thoughts on the video. The game itself looks really fun and addictive and far better than flappy bird and all the clones out there

    Will it be available for Android in the future?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)