Is Javascript really that much faster than Events?

From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • I just tried the top-down shooter example done using Javascript and it felt way faster, snappier, and more responsive than the same template done with events.

    Is Javascript really that much faster than Events?

    I know Javascript is a fast programming language (not as fast as C++, but still really fast comparatively), but the difference I felt when playing the version programmed in javascript was mind-blowing. It felt like a completely different engine!

    I like when games feel snappy and responsive like that. Are there any measurements showing the difference between pure Javascript coding as opposed to pure Event system coding? Thanks. :)

  • You can measure everything you want in the debugger or in the dev console and compare the two.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Spoiler - events are javascript.

  • it felt way faster, snappier, and more responsive than the same template done with events.

    It could be just different settings for speed, acceleration, rotation etc. in two templates. You can definitely make very snappy and responsive games with events.

    JS may be faster in some cases, when you need to process a large amount of data for example.

  • It varies. Events are an interpreted language that’s run with JavaScript. There is some overhead, but it’s mostly just chunks of JavaScript.

    You won’t notice the performance difference unless you’re doing some taxing algorithm. And even then it may be something else that’s causing the slowdown.

    Still I once implemented an isometric sorting algorithm in just events. It was cpu bound. Unsatisfied with how many objects it could handle before slowing down I made a plugin that implemented the same algorithm and got it to handle ten times as many.

    But like was said it probably was just some different values used in ghost shooter. That example isn’t cpu bound.

  • Interesting.

    With a long background in animation and UX design, I'm very sensitive to frames-per-second, responsiveness and overall feel and speed of an application. That's why I chose Construct in the first place, it achieved a higher frame rate and just felt smoother than any other game builder I had tried at the time.

    That being said, I did notice a huge difference in the snappiness of the javascript code as opposed to events. It felt like a completely different engine and I had never felt that kind of responsiveness from this engine before.

    It made me want to program a game entirely out of Javascript to achieve that kind of responsiveness.

    It's interesting that you got something to perform 10x better using Javascript code rather than events alone...

    I also program iOS apps using XCode and Swift and even then, I always find myself wishing the responsiveness was better on the touch screen. It's not quite instant. (I've seen it measured as high as 300ms in the worst cases.) It slightly slower on android. I just like really snappy responsive design. :) Javascript seems to achieve that with this engine. :)

  • That being said, I did notice a huge difference in the snappiness of the javascript code as opposed to events. It felt like a completely different engine and I had never felt that kind of responsiveness from this engine before.

    I tested two templates for Ghost Shooter (event-based and JS-based), and noticed no difference. As others have mentioned, events in C3 are interpreted to JS, so for most of them there shouldn't be any difference whatsoever.

    In other words, re-creating functionality of C3 standard plugins and behaviors with JS would be a waste of time, because the engine already does this for you.

    I only use JS when I need features that don't exist in C3, or when processing huge arrays, for example image data of a large drawing canvas.

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