Let user know when GDevelop encounters an ambiguous variable #2338
Replies: 9 comments
-
You have two instances of a player object :) don't think that's a bug
…On Wed, Feb 5, 2020, 10:08 PM Landon J ***@***.***> wrote:
Describe the bug
Let's say I want to make both of my Player objects always face towards my
Ball object. I have the following code:
[image: image]
<https://user-images.githubusercontent.com/30781325/73885852-7e24db80-4836-11ea-9903-0b7b67a69b2a.png>
It behaves incorrectly.
[image: gdev bug 1]
<https://user-images.githubusercontent.com/30781325/73886075-e5db2680-4836-11ea-8bff-35c458560e10.gif>
But if I change it...
[image: image]
<https://user-images.githubusercontent.com/30781325/73886189-1c18a600-4837-11ea-96ee-623ceab3ceb2.png>
It gives me the intended behavior.
[image: gdev bug 1a]
<https://user-images.githubusercontent.com/30781325/73886254-3e122880-4837-11ea-8947-0cf3df09c53f.gif>
I believe this is because of *Player.X* -- it's ambiguous because there
are two "Player" objects in the scene. When I am comparing the Ball's
position to *Player.X*, which Player do I mean? GDevelop seems to assume
I mean the one on the left. (IIRC, I created that one first.) That means
both Player objects adjust their orientation depending on where the first
object is, not on an individual basis.
I think that GDevelop should warn the user when it encounters an ambiguous
variable like this and has to assume the answer. It could display an icon
next to any events with ambiguous variables to aid in bug-hunting. So in
this example, after I typed "Player.X", GDevelop could have caught that
there were multiple Players in the scene and warned me. Or, it could have
warned me when I ran the scene with a popup like: "Variable "Player.X" is
ambiguous, because there are multiple instances of "Player" in the scene."
To Reproduce
See above description and included file.
2020-02-05 Ambiguous variable.zip
<https://github.com/4ian/GDevelop/files/4162233/2020-02-05.Ambiguous.variable.zip>
Other details
Windows 10 1909 x64
GDevelop 5 beta 88
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1413?email_source=notifications&email_token=ABRRWVLR26LVPW5YPPWEBX3RBM2GHA5CNFSM4KQS4FIKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ILK65BQ>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABRRWVJJTYIEI4S5KOWNVKTRBM2GHANCNFSM4KQS4FIA>
.
|
Beta Was this translation helpful? Give feedback.
-
I can see how this can be confusing. The condition column is kind of acting
like a picker to decide what objects to affect. To get what you want I
think you need to tell it to do it for each player object. I think we had
something in the wiki about that. If not this would be a great addition to the topic with explanation :)
It would be cool if we could communicate in a subtle way when the actions will be enacted on the entire object class and when they will only affect the instances that meet the condition
…On Wed, Feb 5, 2020, 10:57 PM Todor Imreorov ***@***.***> wrote:
You have two instances of a player object :) don't think that's a bug
On Wed, Feb 5, 2020, 10:08 PM Landon J ***@***.***> wrote:
> Describe the bug
>
> Let's say I want to make both of my Player objects always face towards my
> Ball object. I have the following code:
> [image: image]
> <https://user-images.githubusercontent.com/30781325/73885852-7e24db80-4836-11ea-9903-0b7b67a69b2a.png>
>
> It behaves incorrectly.
> [image: gdev bug 1]
> <https://user-images.githubusercontent.com/30781325/73886075-e5db2680-4836-11ea-8bff-35c458560e10.gif>
>
> But if I change it...
> [image: image]
> <https://user-images.githubusercontent.com/30781325/73886189-1c18a600-4837-11ea-96ee-623ceab3ceb2.png>
>
> It gives me the intended behavior.
> [image: gdev bug 1a]
> <https://user-images.githubusercontent.com/30781325/73886254-3e122880-4837-11ea-8947-0cf3df09c53f.gif>
>
> I believe this is because of *Player.X* -- it's ambiguous because there
> are two "Player" objects in the scene. When I am comparing the Ball's
> position to *Player.X*, which Player do I mean? GDevelop seems to assume
> I mean the one on the left. (IIRC, I created that one first.) That means
> both Player objects adjust their orientation depending on where the first
> object is, not on an individual basis.
>
> I think that GDevelop should warn the user when it encounters an
> ambiguous variable like this and has to assume the answer. It could display
> an icon next to any events with ambiguous variables to aid in bug-hunting.
> So in this example, after I typed "Player.X", GDevelop could have caught
> that there were multiple Players in the scene and warned me. Or, it could
> have warned me when I ran the scene with a popup like: "Variable "Player.X"
> is ambiguous, because there are multiple instances of "Player" in the
> scene."
> To Reproduce
>
> See above description and included file.
> 2020-02-05 Ambiguous variable.zip
> <https://github.com/4ian/GDevelop/files/4162233/2020-02-05.Ambiguous.variable.zip>
> Other details
>
> Windows 10 1909 x64
> GDevelop 5 beta 88
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#1413?email_source=notifications&email_token=ABRRWVLR26LVPW5YPPWEBX3RBM2GHA5CNFSM4KQS4FIKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ILK65BQ>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABRRWVJJTYIEI4S5KOWNVKTRBM2GHANCNFSM4KQS4FIA>
> .
>
|
Beta Was this translation helpful? Give feedback.
-
Yep I agree these issues are hard to debug in a game!
Unfortunately, it's not trivial to warn the user about this because we don't know the number of objects, only at runtime. (At runtime, if you use an object in an expression, the first one in memory in the list of picked objects is used) We could try to :
So it's not an easy problem, not sure if it's "mathematically" solvable actually :) Though if you have idea about heuristics, let me know. |
Beta Was this translation helpful? Give feedback.
-
Do we need to make it a warning? I see this more as something that can be communicated in a subtle way in the event sheet. This sort of thing is present in literally all engines with an event sheet - both fusion and construct suffer from the same thing. They deal with it by extensively explaining in their wiki how object picking works |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Or maybe add a number in brackets next to the object in the pick object dialog to show the number of instances in the scene, like: Or |
Beta Was this translation helpful? Give feedback.
-
:) It all goes down to a much clearer programming experience for the non-programmers |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Since GD already assumes Player.X refers to the first Player in memory, would it really hurt performance to check if there are other Players? Is there an integer like "numberOfInstances" that GD can check, and if so show a warning? |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
Let's say I want to make both of my Player objects always face towards my Ball object. I have the following code:
It behaves incorrectly.
But if I change it...
It gives me the intended behavior.
I believe this is because of Player.X -- it's ambiguous because there are two "Player" objects in the scene. When I am comparing the Ball's position to Player.X, which Player do I mean? GDevelop seems to assume I mean the one on the left. (IIRC, I created that one first.) That means both Player objects adjust their orientation depending on where the first object is, not on an individual basis.
I think that GDevelop should warn the user when it encounters an ambiguous variable like this and has to assume the answer. It could display an icon next to any events with ambiguous variables to aid in bug-hunting. So in this example, after I typed "Player.X", GDevelop could have caught that there were multiple Players in the scene and warned me. Or, it could have warned me when I ran the scene with a popup like: "Variable "Player.X" is ambiguous, because there are multiple instances of "Player" in the scene."
To Reproduce
See above description and included file.
2020-02-05 Ambiguous variable.zip
Other details
Windows 10 1909 x64
GDevelop 5 beta 88
Beta Was this translation helpful? Give feedback.
All reactions