Rojo3d. 3D engine for Construct 2

3 favourites
From the Asset Store
Casino? money? who knows? but the target is the same!
  • I often forget about how things work in the stuff I make. I’m just decent at figuring it out should I have time and access to a computer to try stuff out. But I haven’t been on a computer for weeks now.

    Anyways I don’t recall what values the the layers parameters take. Is it a number? A hexadecimal string? A binary string? I’d have to check, either by trial and error or looking at the tooltip text that shows up when selecting that field.

    I’m guessing If it’s working for only 8 then it’s in hexadecimal since 8 hexadecimal characters is 32 bits.

    I guess you could build the string up as binary first and convert it over to hex. Or maybe the action lets you supply a number instead of text you could use a number you set with the setbit() expression. I honestly don’t recall though. This is all off the top of my head.

    The way you explained it to me back then wasn't perfectly clear to me. You said 32 would be hex for clarity. But to me hex is an alien planet. You did add that I can use binary. I tried that and entered all 32 layers in binary manually and it worked. But when I do a loop to fill up variable and then put it in to the collisionLayers it only works with 8 numbers and not more. And that's quite weird, that's why I'm assuming it might be a bug, or I'm doing it wrong.

    If there would be a chance to figure it out, it would be cool. For time being, I've digged out your old smooth collisions with image points example and used that and works well on my little test. On top of that, since im working in 3d, I check ELSE if the actor is in between Z and Z+depth of object if actor isn't above it, so I'm assuming this will actually perform well with walls collisions as well as between actors.

    https://drive.google.com/file/d/1EbzmEPYIFnwwhYxfRTp3qZOA6weT5waR/view?usp=sharing

    You are absolutely amazing with it, and I'm not. I'm better then I used to be, and created planty of prototypes throughout the years, but I feel my limitations quickly. I'm more of a creative type. But with everything you have put out till now, it does makes things so much easier. So thanks a lot.

  • megatronix

    I’m still running off memory here.

    I’m pretty sure the layers take either a number or a base16 string(hex). Or just hex in the properties toolbar. I forget if it let you use base2 strings which would be 32 ones or zeros in a string.

    Anyways I’d say try using a number with setbit() with your events to set the layers. Something like:

    Var layers=0

    Repeat 32 times

    Some condition

    — set layers to setbit(layers, loopindex)

    Anyways that’s my the idea at least.

  • megatronix

    I’m still running off memory here.

    I’m pretty sure the layers take either a number or a base16 string(hex). Or just hex in the properties toolbar. I forget if it let you use base2 strings which would be 32 ones or zeros in a string.

    Anyways I’d say try using a number with setbit() with your events to set the layers. Something like:

    Var layers=0

    Repeat 32 times

    Some condition

    — set layers to setbit(layers, loopindex)

    Anyways that’s my the idea at least.

    Thanks. Will check it out.

  • R0J0hound Hi, do you think you could fix that disappearing shadow issue?

  • Sorry, probably won’t be able to do anything with this for the foreseeable future.

  • is it possible to add multiple lights and back face culling to make the inner mesh invisible?

  • (Ignore my bad English, but it's because I speak Portuguese so I'm using google translator to speak)

    I made an example in this video with skysphere and some enemies walking around. your engine is really cool. even if a lot is done manually it is really good. I was using a separate layer and a duplicate of rojo3d in the same layout, then I could leave a layer just for the skysphere and another one in front for the whole scene. I noticed that the higher the draw distance, the more the shadow gets buggy and disappearing when I went to test it with the skysphere. then separating the layers and duplicating the rojo3d, I could put the short draw distance in the scene, and the skysphere one with a very high draw distance.

    see the example video:

  • I made a template with your engine:

    https://bruxabranca.itch.io/imp-puncher-template

  • BruxaBranca Yes, it is a nice plugin, but unfortunately shadows are broken and disappear depending on camera angle. Would be nice if it would get fixed.

  • R0J0hound

    Hi, I'm having a problem with creating a mesh and I wander if you could help me.

    Since transparency is causing a lot of glitches depending on the angle of the camera, so I figured I need to create a mesh that is in a shape of the sprite I want to display as billboard. But I can't figure out how to get my code to work. I have imagepoints corresponding to verts I want to create, but after looping trough them I'm getting a broken mesh. If you could help out that would be great.

  • So, creating the mesh is something you’d probably do just once. Like:

    Start of layout

    — vertex (100,0,0)

    — vertex (100,100,0)

    — vertex (0,0,0)

    — save as mesh “triangle”

    Now it looks like you have a bunch of imagepoints that make up the polygon border of the image. You need to convert that to triangles. One simple way to do that is to do a triangle fan.

    Something like this. P is the imagepoint you want to start the fan from, best if you use a concave point. Ipx and ipy is sprite.imagepointX/y, and count is sprite.imagepointCount. I just didn’t want to type that all out.

    Var p=1
    Var i=0
    Start of layout
    — repeat count-2 times
    — — set i to p
    — — vertex(ipx(i), ipy(i), 0)
    — — set i to (loopindex+p)%count+1
    — — vertex(ipx(i), ipy(i), 0)
    — — set i to (loopindex+p+1)%count+1
    — — vertex(ipx(i), ipy(i), 0)
    — save as mesh “triFan”

    Notice it matters what imagepoint you start with. See below. Also this won’t work for all shapes, but hopefully will. For any shape that doesn’t work with a triangle fan, you’d need full blown triangulation of polygons.

    Also I guess I didn’t specify uvs. For any imagepoint you can convert it to uvs with

    U=(Sprite.imagepointX(i)-sprite.bboxLeft)/sprite.width.

    V will be similar but with y, top and height.

  • R0J0hound

    Brilliant. As you wrote this is probably only for squarish type shapes. Still it will be useful to have. I'll be implementing it.

    On the further note, IK you won't probably do anything more with the plugin, but there are aspects that if improved would make it a perfect 3d plugin (for me, in order of importance):

    - Camera view in the distance should be a flat plane and not sphere, so that all objects in the viewport appear and vanish together.

    - Shadow matrix should be independent of camera view or layout angle. Camera view is changing the layout angle making shadows shrink and expand.

    - blend modes for meshes

    - Opacity for meshes

    - Normals

    - per poly collisions

    I did look in to the plugins code, but I'm too weak at coding for it.

    Still, I am very thankful for this plugin. It finally allowed me to realise potential of c2 and my ideas ( never was happy that c2 is only 2d, and made several dozens of prototypes, some with your help, but never fully engaged with it to work on a complete game )

    Best

    M

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The plugin is at the point where some design choices early on make it hard to change things without breaking stuff. Plus the event system's speed and limits make it hard to allow the amount of flexibility I'd like without being overly verbose and complex. Anyways, that's partially personal opinion. Construct makes some complex stuff simple and some simple things overly complex.

    As for your wishlist:

    *The view distance is just an artifact of how the fog is implemented. There are pros and cons of either. Rewriting the plugin to have alternative options for everything would be an option i suppose.

    *As I recall I try to fit the shadow frustum to just fit around the view frustum for maximum shadow detail. It's not perfect because some things off camera aren't being included due to some approximations on my part. There are alternate ways to do it, such as fitting the shadow frustum over the whole scene, but the tradeoff is giant scenes would have low res shadows. But I agree more work would need to be needed with shadows but it turned into just fiddling with settings to see what works well which was too time consuming.

    *blend modes would be nice.

    *opacity is already doable. You just have to turn on "transparent yes" in the object settings. The caveat is it's done per object. So it just draws objects back to front. Per polygon would be better, but more complex to do with how the renderer is implemented, also it still would have cases where the sorting would be off. Best would be an algo called "depth peeling" but it's slower.

    *normals are already in the plugin. As long as an obj file has normals in it you'll have normals, which is used for smooth shading. If you mean normal textures, then no, only one diffuse texture is used.

    *Collisions and raycasts are highly requested things. I have a good idea how to do them but I don't find I enjoy finding a way to make it usable in the limits of construct's event system.

    Overall, I may work on this more, but I'm more inclined to work on other things first if I find the time and motivation to code.

    -cheers

  • The plugin is at the point where some design choices early on make it hard to change things without breaking stuff. Plus the event system's speed and limits make it hard to allow the amount of flexibility I'd like without being overly verbose and complex. Anyways, that's partially personal opinion. Construct makes some complex stuff simple and some simple things overly complex.

    As for your wishlist:

    *The view distance is just an artifact of how the fog is implemented. There are pros and cons of either. Rewriting the plugin to have alternative options for everything would be an option i suppose.

    *As I recall I try to fit the shadow frustum to just fit around the view frustum for maximum shadow detail. It's not perfect because some things off camera aren't being included due to some approximations on my part. There are alternate ways to do it, such as fitting the shadow frustum over the whole scene, but the tradeoff is giant scenes would have low res shadows. But I agree more work would need to be needed with shadows but it turned into just fiddling with settings to see what works well which was too time consuming.

    *blend modes would be nice.

    *opacity is already doable. You just have to turn on "transparent yes" in the object settings. The caveat is it's done per object. So it just draws objects back to front. Per polygon would be better, but more complex to do with how the renderer is implemented, also it still would have cases where the sorting would be off. Best would be an algo called "depth peeling" but it's slower.

    *normals are already in the plugin. As long as an obj file has normals in it you'll have normals, which is used for smooth shading. If you mean normal textures, then no, only one diffuse texture is used.

    *Collisions and raycasts are highly requested things. I have a good idea how to do them but I don't find I enjoy finding a way to make it usable in the limits of construct's event system.

    Overall, I may work on this more, but I'm more inclined to work on other things first if I find the time and motivation to code.

    -cheers

    Thanks for the answer. I meant normal maps. Shadows are not usable in first person view unfortunately, because they shrink the moment the object casting the shadow is at angle and behind the camera. Transparency is also not very usable in many cases because it does glitch often and also if I recollect correctly mesh with transparent texture will show back faces and also becomes more white, and I didn't find an option to set object's opacity other than either trough transparent texture or transparent layer ( maybe I've missed it? ). But that's ok, for now, I work within limitations. Since I'll be doing proper mesh for each sprite type, then for shadows I might end up just doing the old school circular gradient or something. But I hope something will inspire you soon to work on it. Cheers M

Jump to:
Active Users
There are 4 visitors browsing this topic (0 users and 4 guests)