Ashley's Forum Posts

  • See the manual section on scripting, specifically JavaScript in Construct. Construct uses JavaScript Modules, where scope works differently to classic scripts.

  • C3 does use a HTML5 canvas for the main canvas, with a WebGL context. But DrawingCanvas is not a HTML canvas, it's a WebGL render target.

  • Getting a Construct DrawingCanvas instance will give you the IDrawingCanvasInstance interface. You can only use the documented methods there. It looks like you're mixing it up with a HTML canvas, which it is not.

  • IIRC the Text object does slightly round numbers to avoid getting results like 44.9999999998, but the debugger always shows the original values.

  • Thanks Ashley for reply , is this affect game performance if i go with High option ?

    Answer your own performance questions with measurements

  • As ever, performance is a complex and often counter-intuitive area, and it's rare that specific advice always works in all cases. The golden rule is to measure performance and make changes based on measurable results. Don't pre-emptively do complicated things: you might actually be making things worse, unless you can measure an actual improvement.

    My advice would be: don't use object pooling, or in fact any kind of complicated optimisation technique, unless you have measurements that prove it's worth it for your specific game. It could vary from game to game as well, so don't assume that you should always or never do something. See also Answer your own performance questions with measurements.

  • Internally angles are dealt with in radians. So all angles in degrees are subject to floating-point precision issues as they are converted to and from radians, and so you shouldn't rely on specific angles. Use conditions like "Is within angle" with a very small angle range.

  • The default multiplayer plugin already includes some turn servers. Stun is what you're looking for

    Actually it's the other way round: there are some built-in STUN servers, which can broker connections, but not link up devices with restrictive NAT. You need to provide your own TURN server, which acts as a relay and so has to retransmit the entire bandwidth used by the gameplay, to ensure devices with restrictive NAT can still communicate.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'd advise to use Construct in a browser instead. NW.js has long had a bunch of issues that never happen in a browser, and browsers now have virtually all the same features as the NW.js version.

  • I just tried it and it seems to work fine for me using an incognito window to test what a new user sees.

  • The blog post The surprising difficulty of resizing images on spritesheet covers this in detail. In short, change the 'Downscaling quality' project property to 'High'.

  • Maybe soon - the WebGPU renderer is nearly complete so I think it can be turned on for experimental usage soon, but you'll need to change browser flags too at first.

  • OK, thanks for the explanation. I think I better understand the usage, and I can see how there could be overhead from the batch updates.

    As ever though we're extremely busy and we get literally hundreds of other feature requests, so we have to be ruthless about prioritisation. I'm very reluctant to do lots of complicated work for one specific case. So I would suggest to start by getting it working with the features available, even if it's slow. Then (if it really is to slow) you can build some benchmarks demonstrating this in a measurable way, and then any improvements can also be measured. (Having been bitten by this before, I'm also very reluctant to do anything pre-emptive for performance; there has to be a way to measure it or you're probably wasting time.) After all, it's not 2012 any more - maybe things are OK even with a lot of changing uniforms, or some of the more simple use cases can already be covered, or when looking at a real benchmark there's other low hanging fruit that can easily improve the situation.

  • I think we're splitting hairs over the name "experimental features". It doesn't matter what it's called, the point is in the context of developer flags, there are default settings, and there are non-default settings. You should expect everything to work with default settings. You should not expect everything to work with non-default settings because it might be unfinished or deprecated.

    If something is broken with default settings and changing to a non-default setting fixes it, it's strong evidence of a problem with Apple's code, and so Apple would need to fix that. The setting in question would be a useful piece of evidence to mention in a bug report to them.

  • On quads vs. triangles, I'm sceptical that it's worth making any changes. Construct's pipeline has been fine-tuned for extreme performance with quads. Just today I tested the M1 Pro and found it can render 750k quads on-screen at 30 FPS. A quad is just two connected triangles, so that means 1.5 million triangles. On top of that, as best as I can tell from the evidence, this is bottlenecked on the memory bandwidth of iterating the JavaScript objects Construct uses to represent objects in the layout. So a single object issuing lots of quads would probably score significantly higher still. I've previously tried to optimise the way quads are issued, and it's made zero difference to the benchmark - presumably because the bottleneck is memory bandwidth iterating JS objects. So I think issuing a degenerate quad is fine: the performance penalty of sending a single extra vertex appears to be dwarfed by the other overheads.

    Further if there is some other triangles mode, it will actually mean breaking the batch to change rendering parameters, since the default rendering mode can only render quads as it's been so heavily optimised for it. So even if we went and did it, I think there is a chance it would actually be slower than sticking with degenerate quads, as the overhead of changing modes could outweigh the overhead of sending a single extra vertex.

    It's also possible to render pairs of connected triangles as quads, avoiding wasting a vertex. Our own engine does that for rendering mesh distortion. Our own engine also issues degenerate quads in a couple of corner cases where it just wants a single triangle. So I don't think there's any case for changing this, especially given the high level of complexity it would probably involve - in Construct, just go with degenerate quads. If you find some benchmark that proves it's unreasonably slow, let me know, and we can take it from there, but I think it's a good bet to say that won't happen.

    On two color tinting, this is a more complicated problem and could involve more performance overhead. However I still want to understand a bit more about exactly how it's used, as it significantly affects the potential solutions. Construct has a special fast-path for simple color-only affects like "Adjust HSL" - those can just be rendered normally with (more or less) another shader program selected. The shader parameters matter though and can affect the batch. However if you do something like set one set of parameters and then render 1000 triangles, it will be fine: it can still batch everything, as it can see the parameters aren't changing. However if you do something like change the parameters per-triangle, then there will be batch thrashing and things like adding an extra vertex attribute could come in to play. So my question is, how do people really use this? Do you need per-triangle colors? Do lots of people really make use of per-triangle colors so this really is something that will affect a lot of cases? The answers to these questions could mean the difference between it basically working fine as-is, to a very complicated overhaul of the entire renderer - something I'm very reluctant to do. So those answers are important.

    FWIW I've been nearing completion of our WebGPU renderer, and it works significantly differently to the WebGL renderer internally, but it still efficiently implements the same interface you get with IWebGLRenderer. This means both that trying to customise the renderer for things like extra vertex attributes is much more complicated, as there are two renderers that work significantly differently to support, and also that there is opportunity to make things much faster in the WebGPU renderer specifically.