Destroy The same type object that collide with another...

Get help using Construct 2

Post » Fri Mar 17, 2017 12:23 am

99Instances2Go wrote:There is no other choice then 'doing it like that'.

It is not the amount of instances (of objects for that matter) that weight on performance in the first place, it is the amount of instances that you give a personal (each instance different) 'touch'. Like moving them in different directions based on conditions, test for collisions (also a personal thing) and overlaps, giving them all a personal pathfinder ..... etc.



Cool Thank you, and sorry I forgot to say that I use the instances in family are static so the player can check collision against them and I was having big Fps drops, but when I deactivate check collisions works normal, and I wasn't sure if by adding choose instance (0) was the problem, Thank anyway for your time
B
41
S
25
G
87
Posts: 309
Reputation: 48,096

Post » Fri Mar 17, 2017 12:42 am

Is the collision check in a root event (not a sub), and is it the 1st condition in that event ?

Do you use a tilemap for static things ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Mar 17, 2017 1:42 am

99Instances2Go wrote:Is the collision check in a root event (not a sub), and is it the 1st condition in that event ?

Do you use a tilemap for static things ?


Is in the root event but I do spawn the static objects, im not sure if I can use tilemap for spawn objects,
I will leave one picture so you have an idea: also is there any other alternative instead of checking collisions like maybe is in a very close distance? that have better performance?

Image
B
41
S
25
G
87
Posts: 309
Reputation: 48,096

Post » Fri Mar 17, 2017 2:23 pm

Anonnymitet wrote:Image

That destroys only one of the two colliding objects. But you can achieve the same thing with many different conditions as well.

it works very well.. thanks alot !
B
8
S
3
Posts: 46
Reputation: 708

Post » Fri Mar 17, 2017 10:27 pm

@ tarek2

No, you can not use a tilemap as a replacement for randomly spawning those sprites.
I asked because a tilemap is also a pretty optimised object.

I asked this other questions because C2 has the collisions well optimised.
https://www.scirra.com/blog/ashley/6/co ... on-in-r155

You lose that optimisation if the collision/overlap check is not the first condition in a root event.

Still assuming that we speak about static objects. If you drop the collision cell optimisation, you better bring something in place that is almost as fast. And the only thing (that i am aware off) that is fast enough to beat that optimisation is the Line Of Sight.

But lets compare. Only testing reveals something in C2.

This is a bunch of STATIC objects and one moving sprite. Look in the debugger, and see the collision checks running out of control. Yet, the performance drop is minimal. Well, on my laptop. It is kinda fast, dont know on your device.

https://www.dropbox.com/s/9y6q7s6c4wy73 ... .capx?dl=0

Now, lets bring those collision checks under control. Using LOS.

https://www.dropbox.com/s/zzz5ifttiom7b ... .capx?dl=0

Neglectable collision checks now. You see ? Yet the performance is almost the same. What we won by getting those collision checks under control, we lose by bringing them under control. CPU wise.

Conclusion: Static objects do not kill performance. That is because they have no 'personal ambitions'. If you have a performance drop, it is not because the amount of objects/instances. It depends on how many objects you apply how many 'personal actions' on in 1 tick.

Well, that is my experience so far. I am still no expert though.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Mar 18, 2017 1:08 am

@99Instances2Go Is true on my laptop the end results is the same each one of them at 70 to 75 Fps, however is on the mobile were normally I have the big drops, and you are right must be something else because those two test runs cute well on my mobile at 55 to 60 fps and not that high Cpu usage and is far way more objects on the layout than I had normally in my game around 400 only, so definitely I have to check everything again to see if I can find the source of the problem, but you gave me really good indication where to look, thanks a lot for the awesome explanation, test capx and for taking the time to help me, I learned many good things, I really appreciate it

Take care bro :D
B
41
S
25
G
87
Posts: 309
Reputation: 48,096

Previous

Return to How do I....?

Who is online

Users browsing this forum: SEGamestudio and 4 guests