Pode's Forum Posts

  • bjadams : can you share a .capx ?

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

  • 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.

  • R0J0hound : nice demo !

    Laurent : only if there's a WebLG implementation on that mobile platform (so, for example, not iOS).

  • Ashley : I don't think so. I think the author of ShaderToy is Inigo Quilez.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • delgado : since it's not possible to fire the display of the native keyboard from webgl, apart from inserting DOM textboxes on your page, you need to recreate a "fake" keyboard onscreen via C2.

  • Ashley : by the way, I sent a mail to Matt Greer, and he answered me personnaly to give the authorization to publish all material from his website. He says that everything put there is public domain, and that he's going to add that mention everywhere on his work.

  • I have posted a new WebGL shader to the dev subforum : http://www.scirra.com/forum/topic59130_post364062.html#364062

    You can now have dynamic lighting effects in 2D games !

    <img src="https://dl.dropbox.com/u/1412774/LightingDemo/demo.png" border="0">

    (The yellow sqaure is the light source).

    The work is ported and modded from the work of Matt Greer (http://www.mattgreer.org/post/4dynamicLightingShadows.

    A demo : https://dl.dropbox.com/u/1412774/LightingDemo/index.html

    Check the dev thread to know how to make your owns : http://www.scirra.com/forum/topic59130_post364062.html#364062

  • I decided to port Matt Greer's work with 2D dynamic lighting for 2D games to C2 (I modded a bit the original shader to conform to C2's IDE).

    The yellow square is the ligh source.

    The work is described here : http://www.mattgreer.org/post/4dynamicLightingShadows

    The idea is to use a Sprite, like this one :

    and put another one on top of it, with normals "baked in" :

    (don't forget to put everything not colord in that normal image to transparent !)

    You can then apply the effect to the normal image, to get the effect you can see in the top screenshot.

    The parameters of the image are the "Image Color" (you need to set all 3 channels to the same color for the moment), higher-value = darker shadows.

    You can set the light direction with the same values as in the example.

    The (x,y,z) vector set the postion of the light over the texture.

    lower Z = ligther shadows.

    You can set the value for the (X,Y,Z) position of the light like in the example :

    Here, the light is going to follow the mouse, always facing the center of the image.

    For that, I use a invisible Sprite, in red in the following screenshot, in the center of the scene. The light is always going to face it.

    You can, if you want have several "Points Of Origins" in your scene, and change the POI the light is facing dynamically in your game, to have nice effects !

    The demo : https://dl.dropbox.com/u/1412774/Lighti ... index.html

    The effect (decompress it in the 'effects' folder !) : https://www.dropbox.com/s/kw6myraxljvek9h/pode_dynamic_lighting.zip?dl=1

    The .capx : https://www.dropbox.com/s/o990ez8k972tm6a/LightingDemo.capx?dl=1

    If you cant find your pode stuff on the scirra forum you maybe find them here:

    https://github.com/Pseudopode/construct2_plugins_behaviors

  • Sheepy : strange, newt has a more recent build, and it's working...

  • newt : I need to show you more respect, you seem wiser than me <img src="smileys/smiley2.gif" border="0" align="middle" />.

  • I now at least two "writers" of the old times that got around the "no swearing rule" in publication, and used it for their best : Herg� (for Tintin) and Terry Pratchett (in Discworld).

    In Tintin, Captain Haddock (at least in french) curses all the time, but in a "old fashion" way of doing it. He uses a string of old & latin words, which aren't swear words in themselves, but works well together : "Bashi-bazouk, bald-headed budgerigar!, australopithecus, amphitryon, pleasure-boat admiral, carpetseller, iconoclast, platypus, troglodyte, ectoplasm, freshwater pirates!"

    In Terry Pratchett's Discworld, Foul Ole Ron, the beggar can use non-sens phrase to say things like that (fgor example : "Bugrit, millennium hand an' shrimp..." <img src="smileys/smiley2.gif" border="0" align="middle" />). Pratchett got that kind of phrase by using automati combination of lyrics and chinese restaurant menues. You can get some pretty creative phrases with that !