Mikal's Forum Posts

  • From latest beta:

    JSON plugin: script interface to access JSON data

    Thank you Scirra, will try it out!

  • Here's an idea, create an object that includes a1 and a2 and then use currentbox to access them in the object using the 'key' currentbox. To make my example work, I also added a2 to the family.

  • New plugin to play GIFs (with control on a per frame basis, speed, pause, play, etc.) You can also apply effects and the usual general object ACEs.

    kindeyegames.itch.io/gifplayer-construct-3-addon

    If you try it out, please leave feedback here or in the addon comments.

  • Added TextureWrap to my Construct Effects Itch page.

    kindeyegames.itch.io/effects-for-construct

    Use with 'nearest' filtering. Create a texture offset and texture wrap on objects such as animated sprites. Similar behavior to the Tiled Background object, but also allows for animations. Also includes scaling texture up and down with wrapping / tiling. Bilinear or Trilinear filtering will have a seam on the texture edges.

  • Agree, this would be really great! I also am always doing stringify and parse for scripting and C3 functions / events.

    Right now I pass into C3 Functions that call scripting JSON.GetAsCompactString and then in the scripting I must parse, then for output from scripting back as a C3 return value meant for a C3 JSON object, I must again do JSON.stringify and then on C3 side, must do a JSON -> parse.

    If we had the scripting control for the C3 JSON object. Instead we could pass in JSON.UIDs as parameters for the function, in scripting we can select the object and read the JSON values and then we can also update another JSON object (or the same JSON object) as an 'output' of the function.

    Yay! Local project folder is back after I updated to Chrome 83. Thanks to Ashley and the Chrome team. This is a great feature for Git / version control.

  • There are a lot of tutorials and examples for Babylon and three.js by themselves.

    With C3 scripting in events, the integration is pretty good, you can call Babylon functions and scripting can call C3 functions.

    Try it out...

    Another example. Adding C3 Warp Object effect on the Babylon render:

  • Nice work, I see a lot of demand for this in the forum and discord, video tutorials and example projects will really help folks trying to use it (easy for me to say, I've only done example projects for my own plugin :) ) Good luck!

  • Yes, I know about Spritesheets and their complications.

    I think my solution may be to use rcTex coordinates for the subset of the spritesheet texture, place the full texture on an offscreen canvas and use that canvas as the 'data' for UpdateTexture.

    Here's an example. I will do a couple of changes:

    - gl.readPixels needs to read from the rectangle subset based on rcTex subset of the spritesheet

    - UpdateTexture() can use a Canvas directly, so we don't need to create the img from it, can return the canvas instead.

    function createImageFromTexture(gl, texture, width, height) {
     // Create a framebuffer backed by the texture
     var framebuffer = gl.createFramebuffer();
     gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
     gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
    
     // Read the contents of the framebuffer
     var data = new Uint8Array(width * height * 4);
     gl.readPixels(<change based on rcTex and texture width to get lower x>, <change based on rcTex and texture height to get get lower y>, <change based on rcTex width and texel width>, <change based on rcTex height and texel height>, gl.RGBA, gl.UNSIGNED_BYTE, data);
    
     gl.deleteFramebuffer(framebuffer);
    
     // Create a 2D canvas to store the result 
     var canvas = document.createElement('canvas');
     canvas.width = width;
     canvas.height = height;
     var context = canvas.getContext('2d');
    
     // Copy the pixels to a 2D canvas
     var imageData = context.createImageData(width, height);
     imageData.data.set(data);
     context.putImageData(imageData, 0, 0);
    
     var img = new Image();
     img.src = canvas.toDataURL();
     return img;
    }
  • In the context of a plugin with an animation:

    Is it possible to enable wrapping of a texture, instead of edge clamp?

    With spritesheets, it represents a little more difficult (though it may be possible with an effect and manual wrapping of srcOriginStart to/from srcOriginEnd.)

    With CreateDynamicTexture() it seems possible with using opts of isTiled:true and tileType:repeat. The question I have is it possible to use an existing texture (imageInfo.GetTexture()) to UpdateTexture(data, texture, opts)? imageInfo.GetTexture does not seem to be directly one of the 'data' types for UpdateTexture(), is there another way to get a compatible data type from an existing animation frame / texture?

  • Example of Babylon and C3 (Plane is 3D Babylon model rendered with Canvas and ElementQuad plugin, the rest is C3 Sprites, note that plane can be in front of some C3 objects (e.g. background), but behind others (e.g. trees.)

  • There are a number of different ways to mix another javascript 'engine's' 3D render with the C3 render (which mostly appears as 2D render, but typically is actually 3D webgl render with a fixed camera and lookat point with they same x,y, but different Z, so it appears '2D'.)

    You can render using three.js, Babylon, etc. to a different canvas and put that canvas in front of or behind the C3 canvas with transparency.

    You can also render to a different canvas and use that for a C3 object's texture, which makes it easier to place the object in C3's Z order.

    Generally it requires another 3D 'engine' like three.js, modelviewer (which I just saw another dev cleverly use), Babylon, etc. to do the 3D render and then a method to include it in the display.

    Here's a C3 & Babylon example I did a while back

    construct.net/en/forum/construct-3/general-discussion-7/babylon-3d-simple-js-147886

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That was an interesting problem.

    The issue is that the '[]' are interpreted as BBCode! On the text object disable 'Enable BBCode' and the text will show up properly in the text box and then you can debug from there...

    Good luck!

  • Jase00 Good point, if this happened at a different point in time (e.g. while I was in the middle of the last game jam where we were using folder save and git for the project), it could have been pretty difficult! I know it's experimental, so we are signing up for bleeding edge items, but it would be nice for us folks on the edge...

    Also I think it could have been to discuss a work around (e.g. to open a project folder, zip the project folder, change extension to *.c3p and load the *.c3p, you can do the reverse to get back to a project folder (e.g. to check into git.) Something to think about for next time something like this occurs.

    How about an in editor alert/notifications that can be cleared, with important messages like this (and you can sign up for: stable, beta, experimental feed?)

  • See the last post in this thread by Ashley.

    construct.net/en/forum/construct-3/general-discussion-7/local-file-folder-saves-chrome-147071/page-4

    Hopefully it comes back soon, it's very useful for git / version control.