Ashley's Forum Posts

  • - You said it brings improvements to memory management - does that mean we as users would get more control of loading and unloading things like textures from memory?

    Mainly I was comparing it to a major limitation of asm.js, where by default you get a fixed amount of memory, and that's it. This is a pretty major shortcoming for a game engine since nobody can easily tell how much memory they'll need in advance, or if it might still exceed that in rare cases. Also you can't just set it really high, because it always uses that much memory, even if it is only using less. I think you can enable memory growing in asm.js, but last I looked it had a bunch of caveats and reduced performance. AFAIK WebAssembly aims to solve this problem properly, where memory can automatically grow (and possibly shrink) to match the requirement and not impact performance.

    Anything that can be done with textures can already be done with WebGL, it's not really related.

    [quote:2yrvin8h] - When you talked about the possibility of rewriting the event system in it, how far would that extend? Would that cover behaviors as well? Would people be able to make third-party extensions using it as long as they had the tools?

    I don't know really, this whole project is still just an idea. I would lean towards no, all plugins and behaviors would be written in normal JS, because it's so much easier (JS is easier than languages like C++ and the development process is far simpler without needing ahead-of-time compilation, especially if you get in to debugging). However there is still uncertainty about what the WebAssembly <-> JS transition performance overhead is, which could kill that. Individual plugins and behaviors could still use asm.js/WebAssembly if it benefits them, like Physics already does. Another open question about WebAssembly is if it can elegantly handle multiple WebAssembly programs in the same page.

    [quote:2yrvin8h]- In particular I'm interested in collisions - I have a lot of scenarios where using collision cells is either difficult, unfeasible or complicates my code, so any speedup there would be helpful.

    Collision cells are an automatic internal engine feature and it doesn't need you to do anything different, so what exactly is difficult/infeasible/complicated about that?

    [quote:2yrvin8h] - Rendering - I acknowledge my ignorance on the subject, but since webGL is written in javascript, it seems plausible that it could help with the performance impact of the draw calls or other such elements of preparing the scene for rendering, even if it wouldn't speed up rendering itself?

    Yes, it could speed up draw calls, but I don't think it's worth it - usually draw calls are not a bottleneck, in cases they are there are still ways we can optimise it in normal JS, and draw calls are issued by plugins which are typically written in normal JS.

    [quote:2yrvin8h]- Physics - because webAssembly needs to be compiled to from another language like C similarly to asm.js, would it be a comparatively simple task to compile the physics for webAssembly to get the 20-30% speed boost (if, of course, it's really that much faster)?

    Right now nothing involving asm.js/WebAssembly seems straightforward, because they are not really mature technologies yet so it's easy to run in to roadblocks. So probably not. But I doubt there would be a huge improvement anyway, asm.js is pretty good as it is.

    In short, this is still just an idea, there are a lot of details and uncertainties to be figured out, particularly around third-party plugins.

  • All WebGL shaders run every time the image is drawn, usually every frame.

  • Answer your own performance questions with measurements

    although I will add:

    • there's no official behavior that can change the color of an object, I guess you're looking at a third-party addon?
    • if you have a lot of objects and many overlap, applying the effect to the whole layer can be faster, since it only processes everything once. Otherwise overlapping areas are processed more than once. On the other hand if you only have one or two small objects, it would be a waste to apply the effect to the whole layer, since it will have to process a larger area than necessary.
  • Option 1 sounds like what we describe in remember not to waste your memory, so go for that.

  • Create another sprite on top with a Square collision box pin it to the object

    This is our officially recommended workaround to needing multiple collision polygons, and uses the existing collision engine which is well-optimised, so I think you may as well do that.

    [quote:2jq29n0f]For me et least on developing for mobile Zordering is one of my main resource hogs at the moment, so I would like to bring it down further to allow for other good stuff instead.

    Have you tried the new "Sort Z order" action in the latest beta? That should be significantly faster than previous approaches.

  • What's wrong with the built-in collision system? It does that kind of check internally, but even faster, because it uses collision cells.

    • Post link icon

    I've answered it so many times I am just super tired of typing it out over and over again. I think I need to write up a definitive blog post on our position on this.

    For example, we see a lot of "mobile performance sucks in C2", and then it turns out their game hammers the GPU fillrate, so it would not be faster in a native engine!

  • No - and it's not to do with copyright either!

  • Make sure the server sends it with a UTF-8 encoding.

  • You need to make sure you use all the same settings and plugins as is specified in config.xml when exporting for Cordova from C2. Also it only works with CLI 6.0+.

  • Send me your .capx to with clear instructions on what to test and I'll give it a spin on one of our iOS devices and see if it can be optimised. Often this turns out to be overuse of WebGL shaders or hitting fillrate limits - neither of which would be solved by using a native engine!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • React Native is not really anything that would help with Construct 2 games. It's designed for publishing apps, and AFAIK has no provision at all for a canvas-based game with WebGL and Web Audio support, so is probably simply not applicable.

    It's funny you mention specifically physics and imagery as "performance limitations", since those are the two areas that should be almost identical to native performance: physics uses asm.js by default now, so should be close to native CPU processing speed on that, and graphics are rendered by the GPU in the same way a native app would use it, so no performance loss there either.

  • I tested this on an iPad Air 2. Both options work, but for some reason the Sprite option makes Safari prompt "This page is trying to open a new window" with options to "Allow" or "Block". I think if you block it, it never asks again, so you might think it's failing. However I found a workaround: if you use "on any touch end" followed by "is touching Sprite", it can open the popup without prompting.

    I think this is related to Safari change to do with what counts as a user input event. When iOS 9 came out we had trouble with audio no longer unmuting (Safari needs a user input event to allow audio playback). They blocked "touchstart" from unmuting, but it still worked in "touchend". So we moved unmuting to "touchend" and it fixed it.

    So the three approaches are:

    "On button clicked" - triggers in a "click" event - Safari allows popup

    "On touched Sprite" - triggers in a "touchstart" event - Safari 9+ blocks this

    "On any touch end" - triggers in a "touchend" event - Safari allows this (combined with a "Is touching object" you can get the same effect as "On touched sprite" but triggering at the end of the touch instead of the start)

    So you should be able to work around this already with the "On any touch end" approach.

  • Closing, please see the bug report guidelines.

    • Post link icon

    Construct 2 has major, transformative features that are missing in other products. Imagine working without sub-events.