Regenerative walls

Show us your works in progress and request feedback

Post » Thu Feb 19, 2015 12:18 pm

@Coin-coin le Canapin I think you should rewrite this to use tilemap for everything. Your slowdowns are probably to do with having separate sprite instances for each block.

As a quick fix, you could try replacing the 'pick by evaluate' condition in your 'getblocksinradius' function with something like 'block is overlapping explosion' (collision testing is probably more efficient than evaluating an expression for each block instance).

But still I think you need to be using only a single tilemap, not lots of sprites. If I get time later I'll make a capx to test this...
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Mon Feb 23, 2015 10:29 am

Hi !
Thank you for your advices :)
I was well aware of this issue and I rewrote my engine using tiles only. It was way faster but it made the blocks regeneration difficult. I tried to store their timer in an array but it was kind of glitchy.

So I tried another way, by keeping using blocks but storing them in an array as using sprites provided me more flexibility.
It's quite effective : http://canapin.com/construct/tolilo/07/
I also made new block frames so my map is more "precise".

The issue I'm facing now is that when there are a lot of projectiles on the screen, it starts to slow down when looking for collisions with blocks.
My guess is that because on the "projectile collision with block" event, it iterates over all the blocks. If there are 10 projectiles on the screen, it iterates over 10*4000 blocks.

I have two ideas.

1) Instead of looking on collisions with blocks, I could compare the projectile with block coordinates in my array. But that would be kind of complex, especially with blocks which don't have a square hitbox. Plus, I would like to put a behavior physic on blocks (not movables) and projectiles, and I'm pretty sure it will have terrible performances.
2) Going back to tiles and try to :
a) make my array containing timer work
b) using invisible sprites containing a timer for each destroyed tile all over the holes created, and remove these sprites when the timer ends
And hoping that the physic behavior will work smoothly when using tiles instead of blocks.

If you have an advice regarding these solutions, I'm interested in. :)
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Tue Feb 24, 2015 1:19 pm

I would do this: for each projectile, test if it's current array/tilemap/grid square contains a block; if a block exists, then do an overlap test (with only that block) so you can check for the triangle shapes.
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Tue Feb 24, 2015 1:39 pm

Image ImageImage
B
168
S
50
G
164
Posts: 8,239
Reputation: 105,597

Post » Tue Feb 24, 2015 2:06 pm

Amazing, thanks !
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Previous

Return to Works in Progress/Feedback Requests

Who is online

Users browsing this forum: Usvatron and 0 guests