Is there any performance benefit to using scripting in some cases?

  • Just curious if there is any performance benefit in using scripts in some cases.

    For example, loops, and iterating through many instances.

    Would be interesting to see a blog post of benchmarks similar to what has been done previously.

    in the ghost shooter js example, there is a set of utility functions.

    Would it be possible to call a js utility function in an event condition? Something like that would be very useful i think.

  • I think the easiest way to test this would be to benchmark the two versions of Ghost Shooter against each other (though I'm not sure if they're 100% the same game)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well the test needs to be on something that is normally cpu intensive in events, for each for example. Or something that is less performant in events, like say moving a object out of a solid.

  • It completely depends on what you're doing and what you're comparing it to.

    Running events has relatively high overhead compared to JS code, so if you have event-heavy code doing things like intensive calculations with lots of loops, the equivalent JS may be faster.

    On the other hand, some parts of the Construct engine are extremely well optimised, and have been carefully honed over the years with all our long experience of performance testing JS code. If you write your own scripts to do your own code instead of using the engine, it could well be significantly slower, unless you put in the same effort we have. One example off the top of my head is if you ignore Construct's collision engine and write your own custom one in script, it could well be significantly slower. Not only could it be slower in absolute terms (slower when doing the same work), but it could be slower in algorithmic terms (as in getting exponentially slower as your game gets bigger, whereas Construct's engine is highly scalable and can keep doing about the same amount of work no matter how much bigger the game gets).

    As ever performance benchmarks are the only way to know for sure.

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