R0J0hound's Recent Forum Activity

  • Thanks.

    No, I've only briefly messed with babylon.js. I don't really have any 3d assets to make much use of it. Besides I think Construct only gets in the way when using it. It's better suited to be used directly without construct at all. The goal in the example here was to work within Construct's renderer, as well as try out interpolating between frames.

    For 3d to happily coexist in construct with it's renderer there are four approaches that i've seen.

    1. use a separate html5 canvas stacked on top of constructs canvas.

    2. still use a separate canvas, but it's hidden and it's copied to a texture that is drawn by Construct's renderer.

    3. Just utilize Construct's renderer to draw the 3d stuff. Limited, but that's what is happening here.

    4. Use custom webgl to render onto the same canvas that construct's renderer uses, but the complexity here is any webgl state that is changed needs to be restored when done. Best done with custom webgl instead of babylon.js, because construct's renderer and babylon.js both work as if they were the only ones utilizing the canvas.

    Anyways, 3d is still one of my many interests. Got a gltf importer partially working. The format makes more sense now, but I shelved it before making it render anything.

  • It was just an example, there's also pngout, pngcrush and for lossy compression pngquant. I haven't tried any of them honestly. Looks like you can fiddle with the parameters to get better results for different images. Likely it's the tech behind these png compression sites, at least that's my suspicion.

  • No idea what png compression c2 or 3 uses but as a user you could manually just do the compression with a tool like

    optipng.sourceforge.net

    Instead of an online tool.

  • Test2:

    uc639addee1bb3cfaef8d651dc4b.dl.dropboxusercontent.com/cd/0/get/Ch4ITsRFdQlnvY4gRePmTn8gV6aN5x0ZZj3Ts_ylhPh05IMTYGTYUtchlryqlH7k55XjlxU5pMi7kRuXpBrtG7ItH0RVyKW-AL7JlK1BR7nUu5Y_w4QBQrJxZgjDw4udqG-2wz9q5bR-oHvxpFuDqtbx/file

    Per pixel collision detection with collision normal calculation.

    Also included some simplish physics to interact. Once the arrays are loaded the balls will never miss a collision as they move a pixel at a time in a loop.

    Tech details:

    The wall sprites are in a container with arrays. When the capx runs some js is run that populates the arrays with the collision and normal for each pixel. Optionally it can expand the collision mask by another sprite.

    Note: The js code probably won't work when exporting so some other functions are included to save/load the pixel arrays.

    -cheers

  • It’s just further reading. Anyways the gist is numbers only can have 15-17 significant digits.

    So you’re running into the limit and it’s rounding.

  • I’d imagine it has to do with how numbers in construct are 64bit floating point numbers that only use at most 15-17 significant digits.

    en.m.wikipedia.org/wiki/Double-precision_floating-point_format

  • Besides using a tilemp with 1x1 tiles, here is a different approach.

    It parses a svg file and uses sprites to make lines around the shapes to use as collisons.

    Added the original image too as a png. Had to fiddle with scale and position to make them line up, so that's not 100% ideal.

    uc556157f499f40c9c1ce11245a4.dl.dropboxusercontent.com/cd/0/get/Ch9T9yasdy3kwIqVS-PI6Htx3kG-BQ2eZN8A7cUkAlVoK7vr3bqNbMm1UBLhHbCsb04WZIrCvWXVYsnrGOcPp0SIxwVCibFkK5zarBJzmOBd25-8bI9EgFpZDV_tmE1y1YxllD-HD7IL3m_1geRfzl9j/file

  • Tomycase

    The plugin was made to utilize the non webgl renderer. Even with webgl on it uses the non webgl drawing of plugins. Things like tilemap sets up itself internally different with webgl. So in short it won't work, although you could try the paster object which takes advantage of webgl and is similar.

    marceloborghi

    That's out of the scope of what I can help with. I'll answer questions about the plugin here and there, but I've since abandoned this. Anyways, you'll have to debug it more to see why it doesn't work. I usually have to test things a bit at a time to find out what works and where exactly it breaks and try to figure out why.

  • It’s roughly the same solution in C2. Only the canvas plugin there makes it too slow to scan the pixels.

    A tilemap with 1x1 tiles is the simplest way to work with physics, chipmunk or even just constructs collision system.

    In c2 I’ve used js to copy the pixels of a sprites image to a c2 array. It dips into the runtime though and won’t work with minifying unless it was made into a plugin. It would look different for c3 but I don’t use that. Besides the canvas in c3 provides access to pixels anyway.

    An alternate to 1x1 tiles with a tilemap is something called image tracing, or basically taking a raster image and converting it to vector. Then you’d set the collision polygon to that from js.

    Or instead of messing with js at all you could take the image of the maze, open it in something like Inkscape, convert it to vectors (it’s a one click thing there), then save it into a simple to parse format like stl.

    Then in construct add events to load the file and create a bunch of sprites stretched as lines to make up the edges.

  • You have to do something along the lines of.

    1. drawing the mask to a canvas

    2. make a tilemap with 1x1 tiles

    3. loop over the canvas pixels and set the tilemap tiles from that.

    At least for C3 i'd imagine that'd work.

  • totoe

    1. In blender you just export as obj, check “animation” and it will spit out an obj file per frame.

    2. In that converter capx you need to add all those obj files to the files folder, set NUMFRAMES to the number of files, and NUMVERTS to the number of vertices.

    3. In the Ajax call you need to change the name of the files. In the capx it says:

    “Fire_elemental_”&zerpad(loopindex, 6)

    But you’d need to change it to whatever the files are named.

    4. Run it and when it’s done you’ll get a json of the array that you can save to a file. You load that and one obj file of the model in the main capx.

    It all was only done with one object in mind at the moment. But in blender it looks like you can specify what to export and such.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think the biggest issue is getting the 3D assets to do stuff with. That and an idea what kind of game to do. :) I get caught up on the tech side of things.

    Reusing the 2d movements in construct is a handy idea but I guess we could also go on a tangent of doing our own collision detection. Javascript does make it handy to make reusable chunks of code over events.

    I guess the next step would be to make it work with multiple objects and come up with some kind of game. Maybe walk around and slap balls around?

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 156 followers

Connect with R0J0hound