Mikal's Forum Posts

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads

    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

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

  • marcelogouveia Looks good, it's nice to have a good variety of animals.

  • marcelogouveia If this is for mobile, I would recommend doing a quick performance test and make sure it's ok for mobile with how many characters you expect to have on screen.

  • If you don't have the Spine tool you can use this tool to update the skeleton.json to 3.8 (I tried it and it worked with your fox file.)

    Just cut and paste the JSON to the first window, click convert and then copy the output back to the original skeleton.json file

    gritsenko.github.io/c3_spine_plugin/formatter/index.html

    Example from preview of your fox (idle animation), I also added a Z sort between Spine Character and objects (crates.)

    Example project w/ the fox character and converted JSON.

    SpinePlugTestFox.c3p

  • marcelogouveia

    To use the plugin you need to update the Spine output files to version 3.8+. I checked your files and they look to be Spine 3.6.x Do you have the Spine tool to load the *.spine files and update the output to 3.8?

    If you can update the output to 3.8, then I suggest the following:

    • Download the plugin and sample project and test and review the project and events
    • Add one of your character's files ((skeleton.atlas, skeleton.json, skeleton.png) to the sample project.
    • Add a new Spine Plugin Object and associate it with the character's files to the sample project.
    • Look at the skeleton.json to set the skins ('default' in your fox example) and an initial animation (I see 'idle' in your fox example.
    • Run project and check it out.