User Tag List

Results 1 to 10 of 10

Thread: Can "Always startloop..." slow down the game?

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleUnicode Add-on
    Boba Fonts's Avatar
    Join Date
    Jan 2009
    Location
    Northern Italy
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can "Always startloop..." slow down the game?

    My question is simple and maybe it's dumb, but I'm interested in a technical answer.
    I want to have a "Always" condition for a startloop action and I'm wondering if that condition can slow down the runtime, since I remember that a fastloop stops the process until it's finished (though it's very fast).

  2. #2
    Clicker Fusion 2.5

    Join Date
    May 2008
    Location
    In Your Cheese
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can "Always startloop..." slow down the game?

    It really depends on how many times your running the loop, and how intense the actions are during the loop. An "Always" loop that only runs a few times and only moves an object around will definetely not slow down your game. However, a multi-hundred timed fastloop that messes with huge arrays and complicated ini's will be much more likely to slow down your framerate.

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can "Always startloop..." slow down the game?

    Basically, an always event runs once every frame (normally 50 times per second), so if the operation is fast enough to be performed that much, there should not be a problem.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS 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)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)

    Re: Can "Always startloop..." slow down the game?

    It's not the loops in itself that is slow, but the action or condition that is performed when it runs. If you are running a fastloop 100 times that makes a new file and writes 1000 lines of text to it on each loop, that will defintaley be slower than running a loop 10000 times that adds 1 to a counter.

    Also remember that you can stop the loop when it has finished doing what it is intended to do. So if you loop through 200 active objects to find wich one has a fixed value equal to a counter, and it finds the object on the 5th try, you should stop it and not finish the loop because no more object will have that fixed value.

  5. #5
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleUnicode Add-on

    Join Date
    Jun 2006
    Location
    Australia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can "Always startloop..." slow down the game?

    I agree completely with what the others have said here.

    It really depends on what you are doing on each loop.

    Basically, if it's not slow on your computer then it won't be slow on other people's. Use that as your basis for judgement. (Assuming you have a normal computer).

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleUnicode Add-on
    Boba Fonts's Avatar
    Join Date
    Jan 2009
    Location
    Northern Italy
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can "Always startloop..." slow down the game?

    So I suppose there's no problem in always looping through 25 lines of a List object (that is frequently updated) to copy their contents into global values. It was made to avoid having 25 separate actions such as "copy line 1 to global 1, copy line 2 to global 2, etc.

  7. #7
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can "Always startloop..." slow down the game?

    It still sounds a bit dodgy to me to be honest. That's basically storing the same array of data at two places, while continuously synchronizing one to the other. I can't think of any circumstances when this can be a good solution for anything, but then I don't have insight in what your program is like, so perhaps you're right?

  8. #8
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: Can "Always startloop..." slow down the game?

    Its not only that, but its also a matter of overhead.

    When you run a fast loop in MMF2, it reads through ALL events you have in the entire code that are active, with a "fast loop" red condition on the top. Hence running just 5 loops of "add 1 to counter" might require the game to parse all 100 loops in your project 5 times for 500 effective reads.

    Hence some people will experience slowdown from simple actions like "always: run loop helloworld 100 times" added to their program even when the loop does nothing. The solution to this, if its your problem (its not) is to enclose your loops inside of groups, like this:
    http://create-games.com/article.asp?id=1937



    so slowdown in loops in MMF2 is not always just what you are doing in each loop, but the huge overhead associated with them

  9. #9
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleUnicode Add-on
    Boba Fonts's Avatar
    Join Date
    Jan 2009
    Location
    Northern Italy
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can "Always startloop..." slow down the game?

    I need a List object for a scrollable inventory that is already working quite well, but -as far as I know- the List can't be global; that's why I copy the list lines to global values with a fastloop-based incremental expression. And it works too.
    In every moment I need the contents of the inventory to be available globally if the character move to another frame, I need them to be saved through the save frame position feature (that saves all the globals) and often I have to switch between different characters walking in different frames and carrying different inventories. So the globals seemed a good solution for all those combined needs. Arrays and INIs depend on external files and I already have a save frame position file.
    Setting an always condition for the "synchronization" fastloop is too much, even if it doesn't seem to slow down the game at all: I think every 1 sec. is enough.

  10. #10
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Can "Always startloop..." slow down the game?

    What I would do for that is set up another fastloop so that you can call it like a function... my own game has a fastloop in the global events called "SAVE_GAME" that takes everything and saves it out to a file (which may involve calling more fastloops). Then, all you have to do is put a single action to start that fastloop once before making any frame transitions or after making any changes to the inventory.

Similar Threads

  1. "Cannot load joystick2.mfx" when "Compress the runtime" unchecked. Fine when checked.
    By DistantJ in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 14th September 2013, 09:44 PM
  2. How to make a "slow motion" effect on the game?
    By Daimonmau in forum Multimedia Fusion 2 - Technical Support
    Replies: 19
    Last Post: 22nd June 2010, 02:53 PM
  3. Little "Shift" and "Ctrl" signs popping up in-game
    By Jocastus in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 18th January 2009, 10:08 PM

Posting Permissions

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