-
Questions about a new fast loop
Hello all,
I am considering implementing a new kind of fast loop in MMF.
This because I have realised that many people were using the fast loops to explore a list of objects. To do so, they spread a value in one of the alterable values of the object, then start a loop and compare the number of the loop to the alterable value, to select only one object in the loop.
This works, but is a little complex and long winded.
So the new loop action would be :
Start object loop "Name of loop", Object
And the condition would be :
On object loop "Name"
Basically, it would call the on object loop condition for each one of the "object", selecting only one object at a time. The result would be exactly the same as with spread, but much simpler.
Question : do you think such a loop is necessary?
Next question.
I have a dilema here. When the program calls the start object loop action, I have two options.
* Option one, is to explore the list object objects selected in the condition, and only them. For example if you have :
- Collision between A and B
+ Start object loop "Myloop", A
... this will only call the loop for the collisionning object A. Of course, if you do not select any object in the condition, then all the A objects will be explored.
* Option 2 : whatever the selected objects in the condition, I explore all the objects. In our example, all of the A objects would be called.
In my opinion, option 1 is more powerful, and more in line with how MMF works, but sometime it would be not practical (you may want to explore all of objects A when a collision occurs).
Question : which one should I do? 1, 2? Both? If both, I would need a name for the conditions / actions
Waiting for your intelligent input on this!
-
Re: Questions about a new fast loop
Question 1: Yes, I think such a loop would be necessary as the creator has more control of the loops
Question 2: Both, you can do a function like:
- Collision between A and B
Start loop "Name_here" With object A, then it asks you like "Select all A objects = 0, Select unique A object =1, so if I want all the A's I type in 0.
I hope it makes sense.
-
Re: Questions about a new fast loop
This sounds like it would be a real simplifier in the way we do things, so defiantly room for this feature. As far as the options, I agree with Dines - that would work pretty much perfectly.
-
Re: Questions about a new fast loop
This would indeed be a great feature. I have tried making an extension for this kind of loop, but I never managed to get it working.
-
Re: Questions about a new fast loop
Definitely option 1 (only explore the selected objects). If they want to affect all objects they can do it easily (setting a global, using the select object's "reselect all", etc).
The opposite isn't true. If you make it loop through all objects always, then it's much harder for the user to only loop the objects he's interested in.
-
Re: Questions about a new fast loop
For the second question, its somewhat like an "Or vs Or(Logical)" type of thing. As long as the two different looping methods are clearly distinguished and understood feature-wise, then I don't see a problem.
-
Re: Questions about a new fast loop
SWEEEEEEEEEEEETTTTTTTTTT!
-
Re: Questions about a new fast loop
I do use the old fastloop method to select an individual, and when doing this alot it can slow down MMF. My question is, will this new kind of fastloop be faster?
Also I'm totally in for this, it's a really great idea :D
-
Re: Questions about a new fast loop
Excellent! Asked for that many times :D
Could you call it "For each loop"? That would be consistent with what people with programming background expect and look for.
Such a loop would be a REAL timesaver and it'd save us from always needing to dedicate one alterable value to enumerate objects (and keep track of the numbers or spread value every frame).
Definitely go for option one.
I would recommend, to cover option two, to have a special action "reselect all", which you can run to "undo" what the condition selection did. If you run it before running the loop, you get what option 2 would do. Plus it can be handy in all kind of situations where you want to affect all objects, if a certain condition is true.
-
Re: Questions about a new fast loop
As Dynasoft said, definitely the option 1 and maybe you can include a function in MMF2 to select all the objects (delete the current object selection). ;)
-
Re: Questions about a new fast loop
For example: card games would be easier to make?
This would be a useful feature.
-
Re: Questions about a new fast loop
This sounds like a great additional feature. Question 2 sounds like it could benefit from having both features available, but with some way to set which method (I liked Dynamite's idea of using "0" or "1").
-
Re: Questions about a new fast loop
Quote:
Originally Posted by Benicle
As far as the options, I agree with Dines - that would work pretty much perfectly.
Lol, I'm the only Dines here! (looks around suspiciously) ;)
This is a great idea, I'm all for it!
Do both options, just like OR, but make the descriptions clear (the descriptions for OR aren't that self-explanatory I found).
Also, I think as said before, a name suggesting its FOR-like nature would be good, but not just a For loop. Maybe just:
"For Each Object"
That would leave space if you later choose to implement a full For loop, as handled by other programming languages.
Would the loop need to be called, or is there an option to just let it run inline? E.g. which would be more likely:
A)
Always
--- For Each Object "Something"
For Each Object "Something"
--- (some code)
B)
For Each Object "Something"
--- (some code)
I'm personally keener on B. You could determine when it runs by just shoving some conditions in it. Although I should imagine it may be trickier to do in coding terms, as the FOR loop would need to function as both a Triggered event and a Fake event (I can't remember what we call non triggered ones).
In other words, it would need to sense its own activation when the parser reaches it, execute its actions, and then retrigger itself as a fastloop until all selected objects were parsed.
Hmm :)
-
Re: Questions about a new fast loop
Yes, an object fast loop would be useful. And I would prefer the option 1. Even though I think that it could create problems that we can't imagine yet (and they would be difficult to debug) : "Why doesn't my loop work ???... Oh my god it's because my condition is far too restrictive when I call it, and I need to test all the objects !"
I'd rather you just create the first option. If I need the second one, I can use the traditional fastloops...
-
Re: Questions about a new fast loop
definitely option 1; option 2 could just be a "Reselect All" action as Random said
-
Re: Questions about a new fast loop
Yes, an optimised ForEach condition would be excellent. Not sure I understand the questions about options though.
Question 1:
* ForEach "Active1"
+ Where "Active1" alt value A > 10
compared to
* Where "Active1" alt value A > 10
+ ForEach "Active1"
I'd expect the first example to loop through all Active1's and compare each one with alt value A > 10.
Would the second example, would the ForEach still loop through all Active1's or would it loop through only those returned by the condition "Where Active1 alt value > 10" ?
Question 2:
Probably yes but if you have more than one 'ForEach "Active1"' events in a frame, would MMF group all the same ForEach's in a list, get the first Active1 instance then run through all these events and actions, then get the next instance and repeat so that it only processes the list once? Or would each ForEach event run through a loop of all objects for each one ? Confusing!
-
Re: Questions about a new fast loop
Answer to #1: Yes please :)
Answer to #2: Both please, you can call it "foreach object loop" for the second option?
Object loop will be a great addition to MMF.
Do you think is possible to have a EventGroup-Loop? :)
-
Re: Questions about a new fast loop
Woa, Andy, did you just replaced "Condition" words with "ForEach" in your message? glad you liked "ForEach" too! :)
-
Re: Questions about a new fast loop
Quote:
Originally Posted by Giovanni_Cardona
Woa, Andy, did you just replaced "Condition" words with "ForEach" in your message? glad you liked "ForEach" too! :)
well it basically is a for each loop so
-
Re: Questions about a new fast loop
-
Re: Questions about a new fast loop
Quote:
Originally Posted by Giovanni_Cardona
Answer to #2: Both please, you can call it "foreach object loop" for the second option?
Uh please don't? Name the first one like that.. the second one.. well. I don't deem it that helpful. In the worst case the selection can be reset using the selection object anyway. Although a special action for that would be much more readable and practical.
-
Re: Questions about a new fast loop
About the options for the object selection I think that implementing a new action would be overkill.
According to me the easiest and more efficient solution would be the additional argument TRUE/FALSE when launching the object loop.
Adding a new action just for that would be nothing more than confusing. The action is meaningless alone without the object loop. And I can already see all the questions from beginners wondering what this orphan action does.
-
Re: Questions about a new fast loop
The control over the objects selection should be improved in MMF and I think this action is the basic one. All the functions of the "Select object" object should be implemented in MMF2 but it's another subject I guess.
However, I think the third TRUE/FALSE parameter could be included too. :)
-
Re: Questions about a new fast loop
Question 1: Yes, but is it any big benefit with this? Will it be faster than the old way with spreading values and run a traditional loop?
Question 2: I would rather have the both alternatives, what about having like
"Start an object loop"
"Start an object loop to selected objects".
or, like somebody said, an action to "Reselect objects".
-
Re: Questions about a new fast loop
I think this sounds like a great idea! I'd prefer the following structure:
Actions
Special Object -> ForEach Loops -> Start ForEach Loop
Special Object -> ForEach Loops -> Stop ForEach Loop
Special Object -> Loops -> Start ForEach Loop (Selected Only)
OR
New Objects/Special Object -> Repick All Objects (Repick all %o)
Conditions
Special Object -> Loops -> On Loop
Special Object -> Loops -> On ForEach Loop
I think this will be easy enough for new users to understand! :)
Cheers!
-
Re: Questions about a new fast loop
omg yes this would be perfect! Im making an RTS game and as you can imagine there is a LOT of fastloops used...
To answer your question why dont you have an option to select only the objects that match the conditions, as well as another option to select all objects?
Keep everyone happy :)