Why does Pick by UID has to be instance specific?

Discussion and feedback on Construct 2

Post » Sat Nov 09, 2013 1:05 am

Why oh why oh why?

When it's a completely unique identifier, why does it require you to select which sprites you want to choose the instance? Why not simply a broad "pick by UID" behaviour in the systems behaviours, and you are done?

Would make many different peoples lives much simpler, and save some kittens from being nuked, and by that, I mean help me a lot :)damjancd2013-11-09 01:05:22
B
37
S
6
G
1
Posts: 301
Reputation: 2,860

Post » Sat Nov 09, 2013 2:02 am

Agreed! Workarounds are possible, but all involve pain....
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
73
S
19
G
66
Posts: 2,198
Reputation: 42,188

Post » Sat Nov 09, 2013 2:57 am

If there is a solid reason behind this that I haven't thought of, then fine, but I can't seem to find any reasons, and it's much simpler, more intuitive, without unnecessary boundaries if you don't specify object.
B
37
S
6
G
1
Posts: 301
Reputation: 2,860

Post » Sat Nov 09, 2013 3:09 am

It's related to Object Definition and related values. Goes back to how programming works.

class Fruit{
int weight;
int grower;
}

class Apple extends Fruit{
string softness;
}

class orange extends Fruit{
string juicyness;
}

you can access Apple Object based on the shared version
Fruit current = *Apple;


class Vehicle{
string company;
string mode;
}

class Bike extends Vehilcle{
int wheels = 2;
}


Fruit current = Bike; BROKEN. That's a no.


That's why UID must be specified with an object type. C2 doesn't have a root object type. You as the developer do that.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013

Post » Sat Nov 09, 2013 4:13 am

Well, logically, they could do it, but it has to do with picking. A pick by UID (as it currently is), sets the object type in the editor, so it knows exactly what actions to offer.

A global pick by UID can definately happen, but with out some type detection events (like, if object is PlayerSprite), then only common events would be allowed. And I don't even think Destroy is common, because that isn't available to Mouse, etc.

So you could pick, but without some type detection events, I don't think you could do anything with it. Now, if we get filtering type detection events, that could work...

But then you could have done the selective pick that it currently does. I just don't think that works with their editor paradigm.PixelHero2013-11-09 04:14:54
B
15
S
5
G
2
Posts: 24
Reputation: 2,054

Post » Sat Nov 09, 2013 9:59 am

@damjancd Wouldn't putting all the objects in a family and picking the family solve your problem?
B
29
S
8
G
4
Posts: 61
Reputation: 6,205

Post » Sat Nov 09, 2013 11:28 am

That's what I do when that comes up, I put all the objects in a family, and use it as the subject of the pick.
B
226
S
60
G
33
Posts: 902
Reputation: 39,989

Post » Sat Nov 09, 2013 2:02 pm

Families should be a good workaround for this. There are two reasons why there isn't a generic system action for picking by UID which does not specify an object type:

1) suppose it exists, and you use the condition. Which object do you put the action under? You don't actually have a way to use the object you just picked.

2) there are some pretty complicated optimisations in the event engine to ensure picking happens fast when it comes to subevents. One of the things it needs to know in order to optimise this well is which objects might have their picked objects changed. A condition which could pick from *any* object type therefore means no optimisation can happen. Due to how the engine works, running that event would take O(n) time, where n is the number of object types in the project. So the bigger your project gets, the slower that condition would get. It is more important to make bigger projects fast than smaller ones, so that's not acceptable.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240

Post » Sun Nov 10, 2013 12:46 am

Thank you for your replies, it makes sense now. Especially the two unbeatable reasons explained by Ashley
B
37
S
6
G
1
Posts: 301
Reputation: 2,860

Post » Sun Nov 10, 2013 3:49 pm

Yeah man, put them in to families, add variable to it, so later you can pick an object in the family and check if the object has particular variable value and you're ready to go ;)
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
85
S
27
G
20
Posts: 1,962
Reputation: 18,651

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests