User Tag List

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 21

Thread: Are "On Each Loop"s memory intensive?

  1. #1
    Clicker Fusion 2.5 DeveloperiOS Export ModuleMac Export Module
    Enchantainment's Avatar
    Join Date
    Sep 2012
    Location
    West Yorkshire
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Are "On Each Loop"s memory intensive?

    I've been using "On Each Loop"s, to multiple instances of a enemy, to stop one even affecting all the instances of it. I've used it, so that when the enemy lands on the ground, the one that is hitting the ground stops and not the ones in the air. I know that "Fast Loops" can cause your game to strain, but I was wondering if the same applies to "On Each Loop"s?


    Thanks!

  2. #2
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    679
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Many of them, or lots in complex situations can, but it usually takes considerably more foreach loops to cause a notice-able slowdown than it does fastloops. You shouldn't have to worry about them, I think.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    I noticed/tested a couple things,
    and recall hints by Snail, ProdigyX and other forum members,
    that may be worth mentioning:

    -scoping a Foreach already on launch wil scope down inspected objects already (this will save Fusion from iterate through the same objects again onloop)

    -always>foreaching becomes a bad practice when additional different loops are performed on the same objects

    -^ following from above, better stuff most actions you can, for the same objects, in the same "on each one of" condition

    -scope down the loop at best you can, and always put the most "scoping" filters in higher places on the conditions list

    As for speed, it may also significantly depend on the use you do,
    if you iterate through objects, foreach will generally do a better job.

    (this is all worth inspecting/tweaking in a crowded situation with many actions performed onloop, otherwise just leave it go )

  4. #4
    Clicker Fusion 2.5 DeveloperiOS Export ModuleMac Export Module
    Enchantainment's Avatar
    Join Date
    Sep 2012
    Location
    West Yorkshire
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the answers! I'll make sure to use them sparingly, and try to avoid using them in an "Always" event.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Just as a clarification,
    (from what I can tell with own testing)
    always - foreach is not a bad practice on its own (I'm myself an always-foreach addicted )
    it becomes dangerous when you perform more of these on the same objects

    i.e.
    always --> count - foreach one of "glue", loop name "stick"
    always --> count - foreach one of "glue", loop name "drop"
    always --> count - foreach one of "glue", loop name "sink"

  6. #6
    Clicker Fusion 2.5 DeveloperiOS Export ModuleMac Export Module
    Enchantainment's Avatar
    Join Date
    Sep 2012
    Location
    West Yorkshire
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for clearing that up Schro. That's definitely a good bit of knowledge to have whilst using them

  7. #7
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Simon's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2,735
    Mentioned
    65 Post(s)
    Tagged
    3 Thread(s)
    For this kind of testing I highly recommend that you use behaviours. Applying logic through behaviours allows you to test each individual instance of an object in isolation, automatically, simply by attaching the events you need as a behaviour. Fusion then automatically filters these down so that they apply to only the objects affected by your conditions on the behaviours.

    These are one of Fusions least well understood tools but can offer an enormous amount of power and flexibility without bogging the main event loop down with lots of for...each or fast loops.

  8. #8
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Simon: It is too bad the interface for behaviors is so unfriendly. Otherwise they might be more popular and useful. It also doesn't help that you have to change your coding logic to deal with them at the end of the event loop, something I find very tricky to deal with.

  9. #9
    Clicker Fusion 2.5 DeveloperiOS Export ModuleMac Export Module
    Enchantainment's Avatar
    Join Date
    Sep 2012
    Location
    West Yorkshire
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Simon View Post
    For this kind of testing I highly recommend that you use behaviours. Applying logic through behaviours allows you to test each individual instance of an object in isolation, automatically, simply by attaching the events you need as a behaviour. Fusion then automatically filters these down so that they apply to only the objects affected by your conditions on the behaviours.

    These are one of Fusions least well understood tools but can offer an enormous amount of power and flexibility without bogging the main event loop down with lots of for...each or fast loops.
    Using logic from the top event in this screenshot, the spawner (the default triangle) should begin adding to it's spawn timer when none of the 3 objects are overlapping it. However when one instance of the object meets those conditions, nothing happens. That event will only work if all instances of the spawner don't have any objects over them. Could you tell me why this might be the case?
    Spawn Event.jpg

  10. #10
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Simon's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2,735
    Mentioned
    65 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by mobichan View Post
    Simon: It is too bad the interface for behaviors is so unfriendly. Otherwise they might be more popular and useful. It also doesn't help that you have to change your coding logic to deal with them at the end of the event loop, something I find very tricky to deal with.
    Can you elaborate on your thoughts about the interface? How is it unfriendly in your opinion?

    Also could you elaborate on what you mean about changing coding logic, perhaps with a simple written out example?

Page 1 of 3 1 2 3 LastLast

Similar Threads

  1. Replies: 6
    Last Post: 18th August 2015, 02:23 AM
  2. question about "odd" ForEach loop behaviour
    By Jorum in forum Fusion 2.5
    Replies: 5
    Last Post: 12th August 2014, 10:25 PM
  3. "Caret" problems with the Rich Edit Object/Fast Loop Question
    By Gullyking in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 4th June 2012, 04:41 AM
  4. "Out of Memory" error every time I save
    By JohnC in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 19th October 2010, 04:59 PM
  5. Start loop "loop" 'Alterable Value A' times
    By Dynamite in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 9th May 2009, 07:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •