Mikal's Recent Forum Activity

  • I used this great template to put something together.

    Due to all the dead links, I couldn't tell if people had already done something similar.

    I used the tilemap as a mask for an image using a new effect which put a color key where the tilemap was transparent and the image where the tilemap tile was present. To add back a 'background' behind the image, I added another image on 'top' which used the color-key as a kind of inverse chroma key. This way we can a get a pixel-accurate image destructible.

    I know this might have already been done, but it was fun for me to try it based on the original template, thanks for sharing it!

  • Working with the WIP Spine plugin for C3, testing, checking for ACEs needed. Also some destructible terrain (via tilemap and a couple of effects for the images.) Tobor destroy them!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for commenting Ashley.

  • I've been doing some work on the webgl aspect of the Spine plugin and also doing a lot of C3 effect porting and have been looking for a good tool to help with effect / webgl debugging with Construct. I found spector.js to be very useful (The Chrome extension.)

    I have had to use the 'manual' capture mode to capture Construct webgl commands to review webgl usage and effect order and results. The spector.js 'frame' capture option does not seem to work, in discussing with the spector dev, it looks like the requestAnimationFrame in C3 is not handled how they expect. Could someone from the C3 dev team please look at the last couple of comments on this issue I posted over at the spector github (they asking about why it appears to be RFA appears to be async. Note, my test case used non-worker mode - so no offscreen canvas.) I think they are willing to help on their side if they understand C3 webgl render a little better.

    github.com/BabylonJS/Spector.js/issues/115

    Thanks!

    (With the help of spector.js as is, the Spine plugin is starting to look reasonably stable in terms of coexisting with the C3 webgl render.)

  • I would check out advanced random plugin first since that will be easier to use.

    That being said, I just put this JS into a script file into C3 and it worked, is there something missing there?

    gist.github.com/banksean/300494

    I called it with this script in an event and checked the console and saw some results:

    + System: On start of layout
    -> Run JavaScript: var m = new MersenneTwister();
     var randomNumber = m.random();
     console.log(randomNumber)
     randomNumber = m.random();
     console.log(randomNumber)
     randomNumber = m.random();
     console.log(randomNumber)
     randomNumber = m.random();
     console.log(randomNumber)
     randomNumber = m.random();
     console.log(randomNumber)
     randomNumber = m.random();
     console.log(randomNumber)
     randomNumber = m.random();
     console.log(randomNumber)
     randomNumber = m.random();
     console.log(randomNumber)
    
    [C3 runtime] Hosted in worker, rendering with WebGL 2 [AMD Radeon Pro 580 OpenGL Engine] (standard compositing)
    scriptsInEvents.js?id=jzqsfa9isho:10 0.3431817612145096
    scriptsInEvents.js?id=jzqsfa9isho:12 0.5235268464311957
    scriptsInEvents.js?id=jzqsfa9isho:14 0.8710040617734194
    scriptsInEvents.js?id=jzqsfa9isho:16 0.6369211783166975
    scriptsInEvents.js?id=jzqsfa9isho:18 0.3085083137266338
    scriptsInEvents.js?id=jzqsfa9isho:20 0.5256941944826394
    scriptsInEvents.js?id=jzqsfa9isho:22 0.6346792092081159
    scriptsInEvents.js?id=jzqsfa9isho:24 0.6408087760210037
    
  • Did you follow each of these steps? I have had a lot of experience with this and I still miss some steps sometimes.

    construct.net/en/make-games/addons/84/greenworks/documentation

    Also, the latest version of the plugin is for 0.33.3-r2 is there a reason you are using an older version?

    Uses the following versions:

    NW.js: 0.33.3

    Steamworks SDK: 1.42

    Greenworks: 0.14

  • The effect allows you to deform a quad image using four relative vertices within the object.

    Based on: https://iquilezles.org/www/articles/ibilinear/ibilinear.htm by Inigo Quilez

    The four points of the quad deform are the X,Y parameters for the effect. The parameters are relative to the size (width, height) of the original quad / image. 0,0 is the top left. 1,1 is the bottom right.

    The effect then maps the original texture of the object (usually a sprite) to the deformed quad.

    The deformed quad will not be rendered outside the bound of the original quad.

    However, a couple of helper functions detailed in the examples allows a quad to be resized and rendered anywhere in the layout with any size vertices (including flipped and convex.)

    Check out the effect and example project w/ the helper functions, if you do something interesting with it, please post a picture in the thread.

    Addon and examples

  • I agree it's not ideal. I understand about the gl state save and restore (and the perf cost.) I'm using a library to do it (which allows for a large amount of gl state save (perf hit), but also has a method to specify state to save, to trim back for min required and for better perf.) I am not done yet, because somewhat as expected, some Spine renderer state or context or gl call is not allowing the C3 render to show up (and I don't expect help from Scirra with that.)

    github.com/stackgl/gl-state

    My thought is to render Spine to a texture buffer (in C3 context) created through the C3 SDK CreateDynamicTexture(), instead of direct to C3 FB. I will not be using the UpdateTexture() call, instead, I'll be rendering to the texture directly. I will be doing this all through a C3 object's Draw(renderer) call, so I can render to the texture, then call SetTexture() and then Quad4() to keep things synchronized. This way I can hopefully continue to use the full power and integration of C3 (effects on Quad, size, position, rotation actions, behaviors - which is the goal.)

    This actually worked really well with the ElementQuad addon I created, which did render to other canvas and then UpdateTexture() - it was just the issue of slow UpdateTexture() on mobile which made it not a good solution for mobile (and perhaps some desktop GPUs which use heavily tiled render (Intel perhaps?) I could add effects and behaviors to ElementQuad, it is a nice combination of C3 and another renderer (for non-mobile.)

    Using IWebGLRenderer would be great also, as you said - I think it would be a big code rewrite, but I'm going to dig through the Spine-TS code a little more and see if I can find an abstraction layer which matches (I also need to match up C3 texture management and Spine-TS texture management/atlas - which I think CreateDynamicTexture may help with, since it seems like that does not become involved with the general C3 spritesheeting algorithm.)

    It feels like we are close to getting something good working, so I'm going to keep working on it (Igor made a nice plugin version, much better than my original template, so it could be used devs easily.)

    Thanks for the comments and discussion.

  • Ashley Thanks for the comments, so no magic bullet, I'm not surprised after my research, but I wanted to check, in case I was missing something (I also want to use C3 SDK to keep plugins more easier to maintain.)

    In parallel, I have already bitten that bullet. However, I want to check with you on this, because it's using mesh deforms and a lot of webgl effects and it's complicated (10k lines of code as I mentioned, using meshes, custom shaders, etc.) - so Spine-ts is rendering directly to the canvas using webgl. However, you cautioned against this due to C3 controlled batching, etc.

    Before I start asking questions - is this what you meant by render directly?

    (Current status - I have the Spine render to C3 canvas working, but I'm debugging save/restore state, calling EndBatch(), etc. to make it co-exist with C3, I may render to texture instead of direct to C3 Canvas FB and hopefully the rendered texture will be usable w/o a big perf hit for render to C3 canvas using C3 SDK to render the Quad to C3 canvas, Set up a new texture, etc.)

  • Ashley This is working very well on Desktop setup and Igor has actually created a nice Spine Addon which uses this new method. I have found it to work well on Desktop.

    However, on mobile (specifically iOS/iPhone), the UpdateTexture() takes a long time, specifically the gl.texSubImage2D() call. After some research, this is not surprising due to the PowerVR GPU tiled rendering method and also the GPU's BGRA pixel format.

    I am wondering how this is handled for the case for the Text plugin? Is it just reliant on the developer to not update Text plugins that often on a mobile system, or do you have another optimization for cases like a timer that might update a Text plugin every frame?

  • This is still work in progress.

    Based on this and Spine-TS, Igor has created a nice plugin which works reasonably well on Desktop, but is slow on mobile (lots of CPU consumption), this is likely due to how textures are being updated on mobile vs desktop, investigating possible fixes.

    gritsenko.github.io/c3_spine_plugin

  • I'm not sure of the answer yet, but I did run across this discussion for anyone else interested in this topic which looks related:

    github.com/Scirra/Construct-3-bugs/issues/3150

Mikal's avatar

Mikal

Early Adopter

Member since 22 Apr, 2016

Twitter
Mikal has 103 followers

Trophy Case

  • 8-Year Club
  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • x10
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

19/44
How to earn trophies