Family performance issue

Discussion and feedback on Construct 2

Post » Mon Aug 20, 2012 3:51 pm

I am working on a game where objects collide with water and create a splash (i.e. spawn a one-shot particle object).

Originally I had a single object with the splash behavior, but I wanted other objects to create splashes as well. So I created a "Splash" family and added objects that should splash. I then applied the splash behavior to the family instead of the individual object.

This was the only change I made, and the splashes work correctly, but the framerate drops to an unplayable level. Works fine when the individual objects have the behavior.

Any ideas why this would happen? I want to use a family so I don't have to repeat code.
B
17
S
5
G
3
Posts: 19
Reputation: 3,451

Post » Mon Aug 20, 2012 5:51 pm

Hard to say without showing a .capx. The change you made does not sound like it should have affected performance at all. It might be coincidence, e.g. a new background process starting on your computer that starts to use up resources, and it made you mistake the change as causing a performance drop.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610

Post » Tue Aug 21, 2012 3:29 am

I think I found the problem - some other behaviors originally in the separate objects needed to be shifted to the family, I think there may have been some conflict there.

Anyways, thanks for the fast response - the program is great and getting better!
B
17
S
5
G
3
Posts: 19
Reputation: 3,451

Post » Tue Aug 21, 2012 4:19 am

When you set a behavior to a family, if one of the family's object have that behavior already, then that object will have two times the same behavior.
I think that can cause some problems... Am I wrong? maybe the individual objects should take the previos behavior or the new behavior, not both.
B
29
S
6
G
5
Posts: 148
Reputation: 5,084

Post » Tue Aug 21, 2012 2:15 pm

@GamerGon - there is a bug where you can add two behaviors with the same name using a family, but it's fixed in r100.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610

Post » Tue Aug 21, 2012 5:08 pm

@Ashley, are you sure it's a bug?
If a family uses a behavior, and then an object in that family uses the same behavior, only the one behavior should be added, and the parameters of the instance (in other words, the more specific) should override the parameters of the family - I think this gives enormous flexibility that's very hard to achieve otherwise!

Unless of course that's what you mean by "fixed".
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Tue Aug 21, 2012 5:46 pm

@Fimbul - it was to do with having for example a 'Bullet' behavior in Sprite1, a 'Bullet' behavior in Family1, then adding Sprite1 to Family1. It ends up with two behaviors named 'Bullet', which causes some errors. Instead it prevents you from adding the object to the family until you rename one of the behaviors.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610

Post » Tue Aug 21, 2012 6:12 pm

@Ashley are you sure? In r99 when I add a family behavior it renames like Physics2 in every family member if they already have Physics behavior added. Then, the family member would have "Physics" and "Physics2".
B
29
S
6
G
5
Posts: 148
Reputation: 5,084

Post » Wed Aug 22, 2012 5:11 am

For those curious I'm using r95 and it was a Physics behavior that was duplicated.
B
17
S
5
G
3
Posts: 19
Reputation: 3,451


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 19 guests