Alternative picked instances list #2653
Replies: 8 comments 19 replies
-
Not really... if we had support for "asynchronous" actions in the future (actions that "stop" and let other actions and sub events continue later when it's done (like a web request)), we'll have to restore the context of the object lists and the additional object lists. And remove from them the deleted objects. But that's it.
Correct. I think groups can contain "alternative lists" (and so become "alternative" groups, though it really depends what you put inside).
Possibly not, at least I don't see a reason for limiting to a single alternative if we do something. Recap about Object GroupCurrently a group is a way to refer to multiple objects at the same time. In other words, if a group "MyGroup" contains "Player, Enemy, Item", an action like This is also the reason why groups can't be used to have "alternative lists": they are just a synonyms for referring to multiple list of objects. Recap about object listsIt's important to note that all conditions and actions are working with lists of objects.
That's pretty much it. Potential solution: The alternative lists of objectsWhile groups are just "synonyms" for more than one object, "alternative lists" are, as the name implies... lists of objects. So they actually still linked to an object, but are separated. For example you could do:
and this will turn all enemies that are on the left toward the (or at least, one of the) enemy that is on the right. The question is now where we should declare these alternative lists. |
Beta Was this translation helpful? Give feedback.
-
I wonder if a lot of this can be solved with more control over object picking. We've had a discussion around this on the forums in the past, in that these issues aren't unique to GDevelop, but in GDevelop we do not have Pick Nth, Pick based off Z order, etc. https://forum.gdevelop-app.com/t/more-pick-conditions-for-object-selection/29410 As far as I can tell, object instances always generate in the same order, and I think the "First" instance would always be the initial object activating the condition (or the first one on the list, etc), and the rest of the order would be the natural object list that occurs. |
Beta Was this translation helpful? Give feedback.
-
What I meant by only one alternative is a global picked instances list alternative. For instance, with TurtleEnemy and MushroomEnemy objects and Enemy group, there would be TurtleEnemy (other), MushroomEnemy (other) and Enemy (other). Picking Enemy (other) would pick TurtleEnemy (other) and MushroomEnemy (other). I ask this because it's hard to see how global list alternatives could be named by users. And if alternatives should not be global, I don't see how groups could work. Moreover, I don't see cases where 3 picked lists for one object could be necessary.
To adapt this to dual global picking, it could be an action like "Make _Object_ picked objects for both picking sets". |
Beta Was this translation helpful? Give feedback.
-
Using this example again:
In this case, it will be problematic because each instance is in collision with it-self so all instances will always be picked. N nested loops would allow to have N independent named instances and use them in conditions and actions with the remaining instances without any conflict. |
Beta Was this translation helpful? Give feedback.
-
(Below was copied from discussion #2748.) Is it correct to say that one weakness in GDevelop is that it is impossible to control interaction between instances of the same object? When using ForEach, you can only reference the instance that is currently in the loop. Can we think of a way to allow referencing other instances of the same object? I ran into this problem with my Physics Chains extension. I had to use two different objects that connected ObjectA to ObjectB. I could not make an event that connected InstanceA to InstanceB. What if we make a new Action that saves the currently picked instances with a Name that can be used later? (This Name functions as a temporary Instance Group.) <previous code assigns an "ID" object variable to every instance> EVENT:
EVENT:
EVENT:
|
Beta Was this translation helpful? Give feedback.
-
I've been brainstorming this some more. I think it would be useful to offer multiple actions to manipulate these "dynamic object groups".
These actions will provide a lot of flexibility to create a curated list of instances. I also like the wording "dynamic object groups" because they can be used just like normal object groups in conditions and actions. The only difference is how they are created and populated (using Actions instead of statically defining them in the scene editor). |
Beta Was this translation helpful? Give feedback.
-
I discovered today that the order an instance was created determines how "powerful" it is in "separate two objects" (when used on the same object type). Instances can only move instances that were created before themselves. This means the first instance created cannot move ANY other instances, and the last instance created can move ALL other instances. As you can guess, this will cause a frustrating experience in an RTS game. This problem could be solved if we had the ability to assign "selected units" to a dynamic object group.
vv39RRKAbT.mp4 |
Beta Was this translation helpful? Give feedback.
-
We probably have enough use-cases defined to help guide the development of this feature, but I keep running into instances where I could benefit from dynamic groups. Building an RTS with hundreds of units interacting with tens of thousands of terrain tiles has really made it easy to identify CPU bottlenecks. This forced me to design scalable relationships by using a 2D array that units and terrain interact with. The reason I need dynamic groups today is to select objects that have moved since the last frame, so I only update vision on those instances.
Without dynamic groups, I can only check if ANY moving object has moved to a new tile in this frame. Then I am forced to apply vision calculations to ALL instances of Movable objects. |
Beta Was this translation helpful? Give feedback.
-
Abstract
Context
Actual
Expected
Use case 1: Grids with links
Context
Actual
Expected
Use case 2: Procedural generation
Context
Actual
Expected
Solution brainstorming
Beta Was this translation helpful? Give feedback.
All reactions