megatronx's Recent Forum Activity

  • I still got no sucess, the origin point is centered at the 3rd program. It seems to lose this information when I import into C2...

    The object size at the 3rd program is (16, 16, 16)

    When, inside C2, I change to (64,64,64) the Z scale gets messed up and I will find myself 'flying' and the object will be bigger but not enough to fill the gap...

    When I try to change the Z origin to the bottom or top it it still to have the same problem when I change value... I'll try to change the 3rd program, but I don't it might be it...

    Or just create the box in c2 with vertices. One of ROOj examples have the code for the box.

  • R0J0hound

    I am having some issues with rendering, can you help me?

    The problem:

    - I have a mesh of a cube.obj (16, 16, 16) (X, Y, Z) (created using a 3rd program)

    - When I change Z to a higher number using events, I start to "fly", it's like with the object was pushed down by 8 pixels and there will be a gap between me and the object "floor".

    Do you what might be the problem?

    Probably an origin point problem. You have to place it more precisely in your 3d program.

  • MegaMente Br

    Here's the tuto code.tutsplus.com/how-to-use-tile-bitmasking-to-auto-tile-your-level-layouts--cms-25673t

    I've implemented 8directional version.

    This is the code to put in to BIT variable I'm using for my project, but you will have to customise it cause I'm using variables. It checks if the tile at xy is same as the current tile, and if so it ads a number.

    varTileType = (Tilemap.TileAt(x, y)

    ((Tilemap.TileAt(x+1, y) = TileType)*16) +( (Tilemap.TileAt(x, y +1) = TileType)*64 )+ ((Tilemap.TileAt(x-1,y ) = TileType)*8 )+ ( (Tilemap.TileAt(x,y -1) = TileType)*2) + ( (Tilemap.TileAt(x+1, y+1) = TileType)*128 * ((Tilemap.TileAt(x+1, y) = TileType)) *((Tilemap.TileAt(x, y+1) = TileType)) )+( (Tilemap.TileAt(x-1, y +1) = TileType)*32 *((Tilemap.TileAt(x,y+1) = TileType)) *((Tilemap.TileAt(x-1, y) = TileType)) )+( (Tilemap.TileAt(x-1, y -1) = TileType)*1*((Tilemap.TileAt(x-1, y) = TileType))*((Tilemap.TileAt(x, y-1) = TileType)) ) + ( (Tilemap.TileAt(x+1,y-1) = TileType)*4*((Tilemap.TileAt(x, y-1) = TileType)) *((Tilemap.TileAt(x+1, y) = TileType)) )

    Then you need to create array with 256 cells. Each cell coresponding to the table below should have a tile number.

    ( first number is the array cell column and second number is the tile number )

    { 2 = 1, 8 = 2, 10 = 3, 11 = 4, 16 = 5, 18 = 6, 22 = 7, 24 = 8, 26 = 9, 27 = 10, 30 = 11, 31 = 12, 64 = 13, 66 = 14, 72 = 15, 74 = 16, 75 = 17, 80 = 18, 82 = 19, 86 = 20, 88 = 21, 90 = 22, 91 = 23, 94 = 24, 95 = 25, 104 = 26, 106 = 27, 107 = 28, 120 = 29, 122 = 30, 123 = 31, 126 = 32, 127 = 33, 208 = 34, 210 = 35, 214 = 36, 216 = 37, 218 = 38, 219 = 39, 222 = 40, 223 = 41, 248 = 42, 250 = 43, 251 = 44, 254 = 45, 255 = 46, 0 = 47 }

    Then all you have to do is to have appropriately placed tiles on the tilemap's tileset.

  • R0J0hound

    I have a question, but actually re another subject. I have a problem figuring out how to do something with bitwise auto tiling and diagonal tiles. SO I have those diagonal tiles, which half is of a tile type, and another needs to be selected according to neighbouring tiles of another type, and I can't figure out how to do it, so If you have any suggestions it will be appreciated.

  • Now, I could translate correctly, you are having issues with player Z colliding, right? In my template I did the way Construct 3 3D Platformer Template did and it's working pretty well. But I think you can also make Z collisions with Height map, you pre-render the map outside Construct 2 and get it's height map, and use some javacript or a plugin that can read colors, then you detect what Z Elevation the player should be depending on the Z Map Height.... It's hard to explain... did you get it?

    Sure, but if you read my response to ROOJ you'll see what I'm after. And for the terrain Z I'm using noise+tile type :)

  • megatronix

    Always nice to hear the plug-in being used. Time and motivation are the main obstacles of most of my projects. But anyways.

    I’ll look up that program. There’s always interesting ways different programs do things.

    Which load action? There’s one to load an image file, one to grab a sprite texture and one to load an obj file. Obj files are a simple text based 3d model format. You could probably generate a file from the vertices. Just save the xyzuv of the vertices to an array as you add them. Then you’d add two lines for each vertex in the file: “v x y z”&newline&”vt u v”&newline. Then you’ll need to add the faces. Every three vertices define a face so this would generate the face data:

    Var i=0
    Repeat int(vertexCount/3) times
    — set i=loopindex*3+1
    — append “f “&(i)&”/“&(i)&” “
    — append (i+1)&”/“&(i+1)&” “
    — append (i+2)&”/“&(i+2)&newline

    Collisions are a can of worms. Storing all the xyz’s of the vertices is the first step. Then if you transformed the object using that mesh at all you’ll need to transform those points too. Basically xyzVector *scaleVector *orientationMatrix+positionVector. After that, each group of three vertices define a triangle. And after that… I guess it depends on what kind of collision detection you want. There are a lot of algorithms different algorithms and I can’t do them justice off the top of my head. Tri vs Tri could be done with SAT, MPR, GJK or maybe calculating the line where the two planes making up the triangles intersect, clipping the line by the edges of both triangles and if there’s anything left it’s a collision. Those first three algorithms work with all the points of convex solids and will give some collision info such as normal vector and where.

    I don’t think I’m scratching the surface though. In general to make things faster you’d use a simpler collision mesh instead of the visual one, or approximate it with simpler primitives like spheres, bounding boxes, oriented boxes, capsules, height maps etc. However in the construct realm I think the simplest solution is just do all the collisions in 2d and have the 3d just be a visual. You can look at any 3d collisions people are doing in c3 for some ideas too.

    The process for implementing any of that is to find an algorithm online somewhere and adapting that to events. I can only give an overview here atm.

    Thanks for extensive reply. Your plugin is very cool addition to c2. Shame it is not completed, but I decided some time ago that I will just make what I can within its limits.

    Currently, since I am currently developing tile system for tile map use, my plan for collisions is to simply check neighbouring tiles and based on that place temp wall sprite tile here wall tile is. However, I was thinking of dropping this idea and replacing it with proper polygonal collision based on vertexes. Then I could use tilemap only for world creation. I will get back to the subject once I get to that point.

    I also would like to implement 2 shading features using vertex coloring: 1. AO, and 2. Static shadow system. The shadow implementation in the plugin is unfortunately not working as intended, so alternatively I am thinking of making my own simpler system. But I do think calculation pre drawing the polys would have to use the Array too since the system would have to reference other tiles being in the direction towards the light source. Although maybe this could also be done just with tile map I'm now realizing, thought somehow would have to consider the foliage and other elements on the map that would be spawn using noise values. But any thoughts on that?

    As for mesh building, I actually went with a simple system where I have a set of frames with image points. I place the sprite on a tile, set its parameters according to the tile and then just draw tris once after another using imagepoints. Its pretty good solution. But should work faster once the vertexes are being read from an array.

  • Hey MegaMente Br

    I did some work in project and I had an idea: Do you think it would be possible to "update" the plugin using any AI Bot for programmers? I will ended trying anyway, but because I have almost no knowledge in javascript I just wanted to ask you... :)

    P.S.: I think the "Template for 3D" project it's half way there, and I think with this template it will even possible to recreate games like Fall Guys, Fortnite and Minecraft... (but those games would be almost be a voxel-style game with custom 3D objects)

    I mean, I am having a bit of issues with optimization, but I am positive about it.

    Here's a tip. If you have more then 2000 objects loaded you will experience fps problems. Ideally around 1000 objects is where you will keep your performance smooth. So you will have to create an array that will keep positions of all objects in map and then pick from a pool of free objects first free one, tag it as busy and load a mesh in to it and position it. Once it is not in view you can unload the object and place it back in the free pool array.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want to try an ai coder then go for it. I wouldn't be interested in trying since it would create more work for me to verify made working changes and if it broke it I'm not interested in debugging it.

    I'm happy you've found enjoyment in using this plugin, but at this point I'm not likely to revisit it at all. I'm more likely to make a stand alone tool independent of Construct since most of what I want to do in Construct requires workarounds and once I made such a tool I'd probably disappear from here rather quickly.

    I'm using your plugin still. I am in the middle of programming map systems. I agree about the amount of wark-arounds. Those are painful, since many of those systems could have been implemented from the get go. But regardless, with so many years doing prototypes in c2 I've learned it to the degree I am making my own 3d game in free time and I don't want 11 years to go to waste. I'm creating everything from vertexes instead of importing objects. This way I can create large map and save it as single object and enjoy really good performance. But I would love to see your tool, which would borrow the best aspects of construct but would improve on it, add things, and allow to make 3D games easily, have 3d editor, dynamic vertex shading etc. There is a program called Manu being developed. It is very promising but the way you program in it is a bit hit and miss. But check it out.

    I have a couple of questions: 1. I'm thinking of storing each map vertex in 3d array to use it for collisions, but to be frank I have no idea how I'd have to go about it, other then I know I'd have to nest arrays inside arrays for performance sake. Any Idea how to do do vector calculations with that? Or in general how I can calculate a vector from 4 vertexes? 2. Do you remember what LOAD action exactly do in your plugin? I haven't tested it, but I wonder if I create 3d meshes and then download the state of the plugin, will loading that state recreate the meshes, instantly and I won't have to generate them with code?

    Thanks!

  • You mean something like this?

    Repeat 4 times

    — dx= round(cos(loopindex*90))

    — dy= round(sin(loopindex*90))

    Yeah, I'll try that. Thanks.

    Had nearly the same one but without round that's why it wasn't working.

  • It's been and while. I forgot how to check array at -1,0 1,0 0,-1 0,1 with one loop?

    I was using sin and cos but can't get it right. I need to test neighbouring tiles at 0, 90, 180 and 270 deg from the central tile. Help appreciated!

  • Well depending on how you’re doing the noise you will have a function noise(x,y) which you can scale and offset with noise(x*scale+offsetX, y*scale+offsetY), or maybe you’re just setting random values to a 2d array.

    Anyways let’s say for example you want a 2d grid with a point every 32 pixels. Just have a 2d array of z values.

    You can get the nearest point’s z with

    Z = Array.at(round(x/32), round(y/32))

    Or if you want a linear interpolation between the points it would be:

    Z = lerp(

    lerp(array.at(int(x/32),int(y/32)), array.at(int(x/32)+1,int(y/32)), x/32-int(x/32)),

    lerp(array.at(int(x/32),int(y/32)+1), array.at(int(x/32)+1,int(y/32)+1), x/32-int(x/32)),

    Y/32-int(y/32))

    Or something like that. Google bilinear interpolation for other explanations. You can also do bicubic interpolation but that’s more involved albeit gives curved interpolation. Or you could use cosp instead of lerp.

    Anyways, it’s a bit harder to reason about 3d problems from descriptions.

    Thanks for reply. Tried the lerp first, but couldn't get it to work. However went back to original idea using noise value and fixed what was wrong with the function. :)

  • R0J0hound Maybe you could help me with something. I am trying to figure out how to set Z for the characters properly. I was trying to get z it from noise but it's too chaotic for some reson and the camera is going up and and down while moving in quite extreme ways. SO I stored noise peaks in array and atm I am only dividing player x and y by tilesize and then lerping from players z to array z very quickly. But I think that if I'd set players z from quad's 4 Z vertexies it would work better, but I have not much idea how to do that. I think I'd have to check first if player is within that quad with X and Y and Z and then set players Z based on distances to the edges Z's? If you could advice, please do. Best M

megatronx's avatar

megatronx

Member since 25 Sep, 2008

Twitter
megatronx has 1 followers

Connect with megatronx

Trophy Case

  • 16-Year Club
  • 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
  • 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
  • Email Verified

Progress

23/44
How to earn trophies