Stop Falling/Generation Optimization?

0 favourites
  • 10 posts
From the Asset Store
Template for dungeon/maze generation, using wave function collapse
  • Alright. So I've been working on a mining game. Something I'm really excited about making. Thing is, I can't quite figure out why I fall through the ground blocks. (Although, the fact that he can jump up blocks, although not intentional, I do like.)

    I'd also like to figure out how to make it so... I can have a bigger layout, that also generates these blocks, BUT... isn't using moving objects. All in all, there might be a way to generate them with an array... But I'm not too sure on how arrays work. If someone could maybe help me figure that out, that would be great.

    I'd still like the grassblocks to be destroyed when the dirt block under it is, and for the sand to fall down when there is no block under it.

    Anyway, here's the Capx.

    Any and all help, like always, is appreciated. If you have any ideas on how I can optimize it, that would be great.

  • Just for your info, as it is, I'm currently only getting 5 FPS, which makes it pretty unusable :(

    There are some guys on here who are wizards at procedural generation who may be able to help you out.

  • Wow! Only 5fps? That's crazy slow. It goes a lot faster for me. Specially when all the tiles settle.

    What I believe slows it down, is the detector object setting it's position to all the blocks.

  • Hate to do this, but my post seems buried, and I can't seem to figure it out on my own!

    So, Bump!

  • OK, a few things to note about the general block falling.

    Physics objects are optimized so that they consume little or no resources when not moving - I believe physics would be a much better option for what you have in mind.

    If physics still does not work, try making your own simple physics. It won't be that hard... I think you will still need one detector but I believe it will be a lot less performance intensive. Just move downwards by an increasing amount to fall accurately.

    For generation, I think you need to be prepared for a lot of maths. Look up Perlin Noise.

  • See, I have the detector object. I used what Rojo had helped me with earlier. Thing is, I want to generate way more blocks now.

    When I use the engines physics. The blocks don't move the way I want them to, they kind of go all over the place. If there was a way to only make them fall within an 8x8 grid, then that would be great, but otherwise, I don't think the in engine physics will work for me.

    And yeah, I was considering looking up Perlin Noise. Just wanted to throw a post up, see if anyone had already had anything figured out.


    Oh right, and there's still the issue of the guy falling through the blocks, and not falling through some of the holes, any ideas on that?

  • I was able to make a good speed up by using an array to store the UIDs of the Blocks at each grid position. That allows for direct selection of a block at any grid position. With that it eliminated the need for a detection sprite since with the array it's simple to select one grid below.

    I also removed the platform behavior and used events to take advantage of using an array.

    A final optimization could be to only have block objects on screen exist to reduce the total object count.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, I thought of an array for this problem just the other day, but forgot to post it.

    However, R0J0hound, it seems that in your example the blocks do not have gravity...

    Random level generation will be very hard, you will need to get VERY comfortable with arrays.

    Not impossible, but challenging.

  • The sand blocks do have gravity, but to speed things up only the sand blocks around the player are moved.

  • Ahhh! Wow, thanks a bunch. I've been busy trying to figure out my own way with arrays, and with a lot of help from a friend, we managed to well... Make it generate but, R0J0, you're amazing. :D Thanks so much for your help.

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