Stop Falling/Generation Optimization?

Get help using Construct 2

Post » Tue Oct 18, 2011 8:46 am

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.

http://dl.dropbox.com/u/45478479/MineGenner.capx

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

B
16
S
3
G
2
Posts: 57
Reputation: 2,078

Post » Tue Oct 18, 2011 8:55 am

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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,841
Reputation: 48,283

Post » Tue Oct 18, 2011 9:21 am

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.Crayron2011-10-18 09:22:48
B
16
S
3
G
2
Posts: 57
Reputation: 2,078

Post » Wed Oct 19, 2011 4:21 am

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

So, Bump!
B
16
S
3
G
2
Posts: 57
Reputation: 2,078

Post » Wed Oct 19, 2011 10:34 am

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.sqiddster2011-10-19 10:35:38
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Wed Oct 19, 2011 2:08 pm

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.

EDIT:
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?Crayron2011-10-19 14:09:14
B
16
S
3
G
2
Posts: 57
Reputation: 2,078

Post » Thu Oct 20, 2011 7:41 pm

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.

http://dl.dropbox.com/u/5426011/examples7/MineGenner.capx

A final optimization could be to only have block objects on screen exist to reduce the total object count.
B
79
S
24
G
53
Posts: 4,728
Reputation: 40,219

Post » Thu Oct 20, 2011 8:49 pm

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. sqiddster2011-10-20 20:50:31
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Thu Oct 20, 2011 9:46 pm

The sand blocks do have gravity, but to speed things up only the sand blocks around the player are moved.
B
79
S
24
G
53
Posts: 4,728
Reputation: 40,219

Post » Fri Oct 21, 2011 9:07 am

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.
B
16
S
3
G
2
Posts: 57
Reputation: 2,078

Next

Return to How do I....?

Who is online

Users browsing this forum: michaelverdi and 27 guests