Pode's Recent Forum Activity

  • sqiddster : you can try to have a layer under the current one, with all the Sprite duplicated. On that layer, you need to blur the Sprite, change the color of the blurred result, and enlarge a bit the layer (or the Sprites), to make add that outline.

    If it's to slow, you can "snapshot" the game, load that snapshot in a Sprite, and apply that effect to the Sprite.

  • dsarchy : that plugin lacks all the tools added by Ashley on the regular "Audio" object, since I can't add them to my plugin (lack of time). You need to ask Ashley the ability to load an audio file via base64 URL, like he has done for the "Sprite" object.

  • Ashley : OK, thanks for the answer.

    I was thinking about that because when I people were asking for a Mode7 shader, I realised that without vertex shader, it's going to be difficult to do it properly.

  • bjadams : it's great that you found a use for the plugin !

    When I'll have time, I'm going to check the problem with the addition of new gestures.

  • Ashley : OK. I'm a bit sad, because having the possibilty to retrieve effects applied on Sprites would be great for a few things...

    I have another questions about shaders. The Sprite is seens as a quad with four vertices. So there is no need for a vertex shader.

    However, having the possibility to tesselate to quad can open the possibility to apply vertex shaders on the tesselated Sprite. That would help to create crumpled paper effects on a Sprite, or page flip. Are you planning to add a more refined way to deal wth vertex shaders, or is it out of the scope of C2 ?

  • The question is more specifically for ASHLEY.

    For some examples and plugins I'm planning to create, it would be useful to grab a Sprite on which a shader has been applied. I can now easily grab the <img> of a Sprite, when WebGL isn't used. However, I don't know what and where to grab to get that (because you can't easily convert a WebGLTexture back to a <canvas>).

    Ashley is there an easy way to do that ?

  • bjadams : can you share a .capx ?

  • : I'm happy you have a use for the plugin !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • All : there's a few way available to do a Mode7 plugin. However, I can see a few roadblocks.

    The solutions and their problems :

    • skewing the image via Javascript (a perspective transform) : I have some code doing that already. But it's slow, and even slower on mobile and low en desktop. Another point : Chrome isn't antialisaing the <canvas>, Firefox is doing it. That means that when I triangulate a quad to deform it, the seam between two triangle is perfect on Chrome, but leaks some black pixel on Firefox (because of the anti-aliasing).
    • CSS transform : easy to do. The problem : you can't draw on a <canvas> (which is what C2 is using in the end) a DOM element while retaining the various CSS transforms and filters applied to it. If I keep it as a DOM, overlayed over the game (like the Button Object used in C2), I can't respect layers order, the Sprite is always going to float above everything else.
    • WebGL transform : easy and fast. Works only on system with good WebGL support (no iOS and Android). However I pokked around C2's structure, and I have no way to grab the WebGL canvas as a texture. Perhaps

      Ashley can provide me a hint here ?

    • SVG transform : it's a perspective transform, and luckily it's available on desktop, and mobile (at least it works good on iOs, a little more slower on Android). The problem is the same as the one with my SVGCanvas plugin : I can decide to draw the SVG on the <canvas>. Firefox allows it without a problem. On Webkit, there's a browser-wide bug that says the <canvas> is "tainted" when drawing SVG on it, preventing the reuse of the canvas after that (to simplify).

    If I don't draw the SVG inside the <canvas>, it works everywhere, but the SVG layer is going to float above everything else, like a CSS transform, and doesn't respect the layers' order.

    If you don't want to use plugins (Unity, Flash, Java), there are no other way to do a Mode7, apart from pre-skewing your Sprite in your favorite image editor.

    (You can always do it the old way, with hundred of canvases, each one a little smaller than the previous one, to have a skew effect, but it's not good performance-wise...)

  • Schoening : I suppose that when you say "Why is it that these things are best done with plugins that use straight up Javascript instead of using Construct2 directly?", you mean for example doing the Pathfinding with events inside C2.

    As a plugin maker, I can explain some reasons, perhaps Ashley is going to add a few things.

    • C2 is in fact a big game framework, and leike every game framework, you have a main gameLoop(), which contains the various events, and that one is run at each step, 60 times per seconds (in C2, those are the events listed inside the editor, that you add with the mouse).
    • when you use events, you need to conform to C2's mode of working, which is event-based (a paradigm of programming, you can also see reactive programming in the litterature).
    • some algorithm are easier dealt with a functionnal or modal way of developping (something you can do with Javascript, C/C++, Java, etc...)
    • Ashley has baked a lot of checks, memory reuse, smart tricks and the like inside C2's engine. That means that every event you add inside the loop in the editor is going to be efficient regarding the use of graphics, sounds, browser access, memory, etc... However, in a plugin, you often deal with pure mathematic problem (like crawling a graph => pathfinding, face recognition => decisions trees, etc...). Those "mathematical" problems doesn't need all teh tools and gear needed for media handling that C2 provide, but they pass them anyway if you use events.
    • So if you have a JS plugin, you can defer small specialized work to a small JS function, that bypass C2 workline, or in some case (webworkers and all that) can execute parallel to C2's main thread.

    TL;DR : C2 handle all the gamefield that you can leverage in a JS plugin where you concentrate on only a small problem, helping you being faster in that particular case.

  • justifun : I didn't update the plugin after Ashley added some functionnalities to the stock one, bundled with C2. I'm going to check that.

  • Joannesalfa : I was discussing with him via email. As soon as I can, I'll add the shadows, using a heightmap.

Pode's avatar

Pode

Member since 3 Sep, 2011

Twitter
Pode has 11 followers

Trophy Case

  • 13-Year Club
  • Email Verified

Progress

14/44
How to earn trophies