Instance picking demo and a suggestion

Post your own tutorials, guides and demos.

Post » Mon Sep 22, 2008 11:22 am

I have been playing with object picking for some time now. A long time ago I made a suggestion that the picking system needs to be improved; there is not much control over the picking, when instances of same object have to interract with each other. I suggested that in event editor, when choosing an object user could define additionally an "group" which would "represent" the specific instance or instances. (Ah. This is hard to explain :D) So, that there would be conditions like:

[code:2ywbf38n]Sprite1.A.Value('Strenght') > Sprite1.B.Value('Strength')
+Sprite1.A Collides with Sprite1.B

>> Sprite1.B Destroy
>> Add 1 to Sprite1.A.Value('Strength')
[/code:2ywbf38n]

Where A and B would represent different instances, and Construct would determine automatically based on conditions, which "group" would represent which instance. This would allow much more complicated interaction between different instances of the same object, and would provide much more power to the game developer. Imagine a situation, where there is action or expression which takes two object parameters, for example, an angle between objects. Currently Construct doesn't know what to do when asking to calculate the angle between "CoolSprite" and "CoolSprite". It cannot propely distinguish the different instances in events.

HOWEVER, I found a workaround. I was happy with that and shut my mouth... and started making a .cap that would use the interractions between instances. Construct can distinguish between instances using Families. It works quite well, and I think and there is no special need for my suggestion... (It would be still nice to have, though! Imagine that syntax: Sprite.A.Something, pretty clear, huh :D?) This .cap has been lying on my HDD for some time, but now I found time to finish and upload it. Go ahead and see, it's a cap about making object chains.

By the way, I think that there is some bugs in picking code, or then I have just misunderstood how it should work :D I have pointed them out in comments in events:
[quote="myself":2ywbf38n]NOTE: Strangely, the Green picks all Cells in the Blue's group, although there is the "is overlapping"-condition which should rule the other Cells out. (I tested the normal and advanced overlapping, none of them worked the right way) The order of the conditions also makes dramatic changes to behaviour, although they should pick the objects same way. Seems that the first condition "defines" the Selected object list of Greens, and strangely later conditions don't affect it. (Try to move the Red.Tail==Blue.Tail -condition first! It picks ALL the Red!) I think THIS IS A BUG, but it doesn't matter in this algorithm. (I still hope it'll be fixed)...[/quote:2ywbf38n]
[quote="myself":2ywbf38n]NOTE: For some reason, normal overlapping seems to ignore selected objects list totally, and picks every overlap, not just THE Red and Blue instances which are introduced in the main event.[/quote:2ywbf38n]

Oh, I blabbered a bit too much again. Sorry about the text flood. Some comments? And are these things I pointed out bugs? And devs, what do you say about my instance picking suggestion?
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Mon Sep 22, 2008 11:37 am

David posted an example of family picking a few days ago in Help :)

viewtopic.php?p=11456#p11456

But good job on coming up with it on your own. And your example is pretty sweet, too :)

Edit:
Ooh, I can make it crash... if I mix them all up in a big pile then start clicking and dragging things out, eventually it will pop up with an error that says "A while condition has reached one million iterations blah blah blah" so apparently it's stuck in an infinite loop. Never seen that one before.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Sep 22, 2008 11:59 am

[quote="deadeye":2z7xqq0t]David posted an example of family picking a few days ago in Help :)

viewtopic.php?p=11456#p11456

But good job on coming up with it on your own. And your example is pretty sweet, too :)
[/quote:2z7xqq0t]

Oh thanks, seems that I missed that topic before.

[quote="deadeye":2z7xqq0t]
Edit:
Ooh, I can make it crash... if I mix them all up in a big pile then start clicking and dragging things out, eventually it will pop up with an error that says "A while condition has reached one million iterations blah blah blah" so apparently it's stuck in an infinite loop. Never seen that one before.[/quote:2z7xqq0t]

Yeah, the crash is because somehow the cells form a group where the first cell's Target value isn't zero but the UID of the last cell, kind of a ring. Then it tries to resolve the first cell in the chain, but ends up just looping infinitely...
B
3
S
2
G
5
Posts: 263
Reputation: 2,201


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests