About the jerkiness on the movement...

  • skelooth , if C2 wasn't fantastic for the most part, we wouldn't have had this conversation It's because it does what it does so good, that what it doesn't do, or fail to do, stand out!

    Also, I don't think Colludium compares apples with oranges with the GTA reference, it's just that it's simply expected from any modern platform to be able to perform some basic staff. And you can't have anything more basic than smooth movement. Imagine a super-duper high end TV with 3D, bells and whistles, perfect blacks, a gazillion shades of gray and colors that make nature shy for her lack of chromatic pallet etc, but every few seconds it skips a frame or two... Would you be able to ignore that? For me it will make watching the movie unbearable, even more because it depicts everything else so great!

    Lunatrap , do you mean Colludium 's example, mine or both? I understand that you've come a long way in your game development, do you encounter this problem in your game?

    Joannesalfa , Tokinsom , thank you for your input. I myself had reported and unintelligently whined about this in other topics too (that and wanting a dedicated and proper masking system!). I brought this forward now, because I am about to get serious and invest time in game development, while in the past I was just testing, fiddling and learning C2 (I still do). So, something so basic and, in my gamer eyes, distracting, really pulls me off and discourages me to begin with, because I won't accept that my final project will intrinsically have this behavior, regardless of optimization and resource restrains.

    Again, I am not trying to flame C2, Scirra or C2 is an amazing software, I am having a great time using it, it's very creative to work and learn with it and in every opportunity I have I spread the word about it in my social and professional environment. That is exactly why I feel so passionate about this issue, it's a deal breaker for me, I just can't accept it as a normal byproduct of HTML5, JavaScript, or whatever technology. It shouldn't exist in an interactive multimedia environment. It breaks the immersion, the experience that otherwise we try very hard to create. So, I need to know, is it something that can be fixed? Will it be fixed?

  • skelooth, I think part of the problem is one of my expectations compared to yours - I understand that you don't see this staccato game play as a problem, but my expectations are that all game movement from C2's engine should be as smooth as every other html5 game I have seen... Especially the first 20 seconds, when a new player is likely to decide whether or not to quit a game.

    I am also just embarking on my first 'proper' and hopefully 'for sale' project - and I made the GTA reference, as so eloquently put, because I am not sure I will receive favourable reviews if this cannot be fixed. If more demanding games like GTA play smoothly on the same hardware then my simple platformer will always appear to be at fault. I am already being very careful to avoid the unnecessary creation/destruction of objects mitigate this. However, and especially during the first few seconds of a layout, this problem doesn't seem to be manageable just by being careful with events. I want to avoid having a 15 sec 'loading' splash or showing a message like "some users may occasionally see stuttering game play (just ignore it)".

    A couple of Ludum Dares ago I created a platformer and received a couple of comments that the game play was jerky, even though the effect was far less apparent than the demo I linked to earlier in this thread - so it's not just my imagination that this is a problem. I'm expecting to put a lot of hours into my game, but if C2 isn't up to the job then you might be right - maybe I'm trying to use the wrong tool for the job (or maybe I should limit myself to 640x480 or similar with no scale up to full screen). I have tinkered with Unity a little bit over the last couple of years and Unity's 2D optimisations are really quite brilliant; but C2 is far easier to use and I intend to stick with it for long term because I hope that this issue can and will be fixed.

    I have no idea how Ashley has implemented garbage collection in C2 (assuming that is the culprit) and I have no idea how difficult a job it might be to fix. But there is definitely room for improvement and I live in hope, and if you don't ask you never get.

  • I've looked in to this in the past and I think it's JIT compilation in the Javascript engine. It seems to vary depending on the browser and system. As usual you should test on every browser available to identify issues which are browser-specific. In this case while generally very smooth, sometimes it's a bit janky in Chrome and Firefox. But surprisingly IE11 is rock solid and I basically never see any issues there.

    I'd point out this isn't "HTML5's fault", because HTML5 is simply a specification, and it's not like the specification says "browsers must pause for a frame every N frames". It looks like a quirk that Chrome and Firefox are subject to at the moment and I don't think there's any reason it can't be fixed. There's no reason something like this has to be inherent to browser games.

    Some random thoughts that I think support the JIT compilation theory:

    • we've done loads of work to reduce the garbage created by our engine (specifically to avoid jank like this ), and it's generally very good at recycling stuff and not needing any significant GC work at runtime. Also modern browser GCs are very good at doing work in lots of little slices instead of having to pause everything while it does work. So GC should not be a significant issue.
    • Construct 2's engine is pretty big in terms of lines of code, since it has loads of features and does a lot under the hood. JIT compilers compile on-demand for faster startup. They have various thresholds for compilation like "if a function has been called 100 times, compile it". This means they don't have to compile everything, which likely includes lots of code only ever called once. However it does mean random bits of code end up getting compiled mid-gameplay at non-deterministic times. The size of C2's engine would explain why other smaller engines might not be so affected.
    • IE11 apparently has a completely parallel JIT compiler, which would explain why it is so smooth: it's compiling functions in the background while the game continues to run, and just quickly swaps in the finished code when it's done. On the other hand I saw a Google engineer mention that V8 sometimes has to compile synchronously (i.e. causing jank, since it has to stop and wait for it).
    • WebGL mode moves more of the rendering logic in to JS code. It usually way outperforms the canvas2d renderer, but since more rendering code is in the JS engine, I guess it could be more subject to jank from compiling that code.
    • after a while (15-30 seconds?) the JIT compiler should have basically compiled everything. This explains why it might be janky for a bit at the start, and then get smoother. If you are only seeing problems on startup, try allowing the game to run for a while to "warm up" (so everything which is called a lot is already JIT compiled), and then it should be smoother.

    However this is solvable: if Chrome and Firefox are as good at parallelising JIT as IE11 is then it should be fine everywhere. Also simply waiting out the warmup period should make it a lot better. Hopefully most games are just showing a menu or intro credits type sequence at that point. I've also heard the V8 team are working on a new compiler called "TurboFan", which I can't find much information about, but parallel compilation would be an obvious improvement to make for a new compiler.

    I had already filed bugs with Chrome and Firefox based on sbperftest since it actually measures jank and dropped frames providing an objective way to measure the problem and provide a yardstick to compare improvements. The bugs I filed don't seem to have gotten much attention yet. So comments and stars on these reports could help them get attention:

    Chrome issue 387675

    Chrome issue 424563 (which I just filed now to point out IE11 does better than Chrome)

    Firefox bug 1028893

  • Heh, filing a bug saying IE11 does better seems to have done the trick - they've already assigned the bug

  • Nice work!

  • Heh, filing a bug saying IE11 does better seems to have done the trick - they've already assigned the bug

    lol xD

  • Dear Colludium , I don't even know what "eloquently" mean!

    Ashley , thanks for the thorough reply!

    So, if I understand you correctly, for the most part (beside the part that C2 has a big engine that needs to be compiled), the problem lays mostly on the browser's side. On the one hand I am relieved that since this might not be inherent to HTML5 gaming it can be improved-fixed, on the other hand I feel helpless and on the mercy of each browser's developing schedule. I have mixed feelings about this and I am leaning towards the uncomfortable side.

    On my system the best viewing experience comes with node-webkit, followed closely by Chrome (38). IE (11) and Firefox (33) fall behind. I don't know how to interpret this, it's just that I have strong feelings against this unwanted behavior and I simply can't accept it for any finished project (well not any project, but certainly not for the ones that have prominent moving graphics). I know that you do your best, on my book this is a priority issue and I hope that the Universe will conspire and address it immediately! (Dear Universe, please, also create out of nothing a masking system that use any Sprite to mask any other Sprite or/and layer. Finally, make C2 have a 2.5d workspace with a "real" camera and z-depth! Oh yes, and a path system! Thank you! Your random blob of molecules, eli0s)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • eli0s, LOL!

    I too feel a tad helpless and at the mercy of 3rd parties to improve their browsers' GC. I'm going to have to shut off sections of my events and see if there's anything I can do to improve things; I suspect, however, that only time will provide the solution for browser games.... Oddly enough, Node performance is flawless - so why should that be if it's based on Chrome??

  • eli0s, LOL!

    I too feel a tad helpless and at the mercy of 3rd parties to improve their browsers' GC. I'm going to have to shut off sections of my events and see if there's anything I can do to improve things; I suspect, however, that only time will provide the solution for browser games.... Oddly enough, Node performance is flawless - so why should that be if it's based on Chrome??

    I have been fiddling with HTML5 and HTML5 canvas for years, and to be honest, adoption of html5 has been extremely fast. It was only a year or two ago that I still had a browser with no webgl support. Mozilla is working on an HTML5 mobile operating system, and all of the big players are banking heavily on HTML5, IE, both Apple and Google are pushing it.

    So if it's not supported soon, it will be. V8 is only 6 years old (young for a language runtime/compiler) and things didn't start really moving until chrome started getting significant market share. Net result is we've seen a lot of HTML5 adoption in the past 4 years or so. A *lot*. For websites, for mobile, for apps, for OS's even.

  • Yeah, HTML5 has always been "at the mercy of" each browser maker, but they're generally actually doing an amazing job and improving things really fast. This is just the latest quirk really - wind back 3-4 years and all you had were software-rendered canvas2d with crappy audio support, so things are always getting better. Remember Chrome and Firefox are both on rapid release schedules so if/when this is sorted out, the fix will be out to everyone in short order. And IE with its slower release/update rate doesn't appear to be affected (at least here), so that's less of a worry (if IE was affected then it would definitely be a long outlook to get it fixed).

    BTW perfect Vsync is actually pretty hard to achieve - I remember some similar complaints with Construct Classic, which was native C++/DirectX 9 (and note did not have any garbage collection). They were just very small occasional skipped frames. I think ultimately with an OS which is task switching on maybe a 10-20ms frequency, having to very precisely render at 16.7ms intervals to vsync properly, is a high bar to reach, and realistically the odd frame is going to get skipped.

  • eli0s: I tested your example in Chrome, IE, FF, Opera, and the nodekit preview.

    • Nodekit preview: it runs completely smooth EXCEPT for a jerk that occurs every 7 seconds or so at a regular interval.
    • Chrome 37: it runs completely smooth EXCEPT for a jerk that occurs every 7 seconds or so at a regular interval.
    • Chrome 38.0.2125.104 (I updated after testing in v37): much jerkier than v37. There is still the regular interval jerk every 7 seconds, but also smaller erratic jerks were introduced after updating to the latest version. Quite worrying.
    • Firefox 33: initially quite jerky with bouts of smoothness, then after some time it becomes quite smooth BUT jerks that are similar to Chrome occur, and these are quite erratic and ugly looking. Worse, at times the player completely disappears for a while, only to re-appear later (can last a second or two). When the jerks occur at the same moment the collision is supposed to occur between the player sprite and the wall, the sprite overshoots the wall, and disappears!

    This is not only a visual issue, but potentially can break your game completely. This happened one time in Opera as well.

    • Opera: jerky when it loads up initially, then settles down in a regular smooth and jerky movement cycle that takes ~.3 sec smooth, jerk, ~.3 sec smooth, jerk. Every 15 or so jerks there is a larger jerk at a regular interval, just like Chrome.
    • IE 11: runs completely smooth EXCEPT for that jerk again that occurs every 7 seconds or so at a regular interval.

    To see if the browsers needed more 'power', I assigned the highest priority to the execution of each browser in Windows. No difference (except that almost 10% of cpu power was utilized, compared to at most 2~3% at the default priority. (Done with Process Explorer.)

    Now, to test if this regular larger interval jerk is caused by something specific to Construct, I also tested this javascript Gauntlet found here: http://codeincomplete.com/games/

    I get similar jerks in all the browsers.

    Then I decided to test Shank2 (2d scrolling beat'm up). Smooth, BUT again that larger interval jerk DID occur even in Shank2 (which plays at full screen).

    Finally, I tested Rogue Legacy, and yes, there is that larger interval jerk again. In the course of all the action in both games you do not notice it, but once you are aware of it, it does irritate a bit.

    Anyway, on my system the major jerk is not caused by html5/js or Construct, it seems. In certain browsers jerky movement is introduced, though, and that seems to be browser dependent.

    Lastly, I would be interested in seeing more formal testing done related to this issue. For example, I wonder whether my system's video card may be the culprit as far as that larger interval jerk is concerned. I have not noticed it happening in 3d games, though.

  • Rayek , thank you for your time and effort! In some cases this is even worse than the thing I experience and complain about!!! I tried some of the games at codeincomplete and the stuttering exists for me also. This indeed has to be browser related and it looks like we can't do anything about it. I hadn't had the chance to play Shank2 or Rogue Legacy, are those two HTML5/JavasSript games that run on a browser? Is this the reason that you do a performance comparison with them?

  • here are 2 videos of running the examples, i dotn get jerkiness like the one on eli0s video (the initial jerkiness its becuase the starting of Fraps)

    https://www.dropbox.com/s/q89x7ifq99829 ... 8.mp4?dl=0

    https://www.dropbox.com/s/61s1iu9nkg9hr ... 3.mp4?dl=0

    BUT! i do on my game, wich is quite advanced now, from time to time it will skip a frame and it will lagspike, but this looks too random for me to pin point what is causing it.

  • Rayek , thank you for your time and effort! In some cases this is even worse than the thing I experience and complain about!!! I tried some of the games at codeincomplete and the stuttering exists for me also. This indeed has to be browser related and it looks like we can't do anything about it. I hadn't had the chance to play Shank2 or Rogue Legacy, are those two HTML5/JavasSript games that run on a browser? Is this the reason that you do a performance comparison with them?

    No, I wanted to compare the performance of two desktop non-browser 2d games, because I did not know if that larger interval jerk is browser related, or not. Both Shank2 and Rogue Legacy display a slight jerk every 7~8 seconds when playing.

    So that one is not browser or Construct related. Something in either my hardware or software is causing that one. If/when I find out more related to that issue, I will let you know.

    I also have a feeling it might be video card vendor related up to a point. What kind of video card do you have installed?

  • Lunatrap , at first I was like "whaaat?" but then I realized that the embedded dropbox player destroyed the framerate for some reason, so I downloaded your mp4s, imported them into After Effects and checked them frame by frame. And you are right, after 5 seconds or so there is no stuttering at all! However, your recordings are only 14 seconds long and this phenomenon seems to be of a sporadic and unpredictable nature. Perhaps if you let my example run 3 or 4 circles and on Colludium's example run through the whole layout back and forth (end to end) a few times...? Maybe there just wasn't enough time for the problem to occur in your system.

    Rayek , ok I see. I did play Dust: an Elisium Tale recently (it's an amazing game btw) and it run buttery smooth. I believe that the guy who made it used microsoft xna (?) to build it.

    My video card is an Nvidia GeForce GTX 660 Ti by Gigabyte. The CPU is an old Intel Core2 Quad Q9550 overclocked to ~3.7Ghz and there is 16Gb of ram installed on my system. I also can play most modern 3d titles with no fps dropouts, unless I push the settings to very high in which case I do get low fps, I guess due to CPU bottleneck.

    Ashley , I've just noticed that windows say that my main monitor runs at 59Hz (it's a Dell u2711). There is an option for 60Hz but windows always reverts it back to 59. I did a search about it and I found this article ( http://en.community.dell.com/support-fo ... t/19458185 ) that says that the monitor run at 59.94hz and this is a windows bug. However, I always view my tests on a browser that sits on my Cintiq 12UX which acts as a secondary monitor and runs at 60 Hz. Is it possible that this 59 Hz thing causes syncing issues on my system?

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