User Tag List

Results 1 to 5 of 5

Thread: Controlling data output speed from fast loop

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)

    Join Date
    Feb 2015
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Controlling data output speed from fast loop

    Hi,

    Anyone have any good tricks for varying the speed of fast loops ?,

    I have been trying for the last couple of days with different
    methods,
    on each frame actions are too slow, so it has to be a loop.
    The main loop i need to slow down has nested loops inside it,
    the speed needs to be variable, and the loop length can be
    different each time, so dividing it up into chunks gets messy as it
    will not always be divisible by a whole number,
    the nested loops rely on index info from the main loop,
    and the main loop can also have actions on it, such as reversal of the loop.
    Have been trying many methods but everything causes problems and
    conflicts with other parts.
    Its all inside a behaviour also, although I don't think that should
    effect things.

    Hopefully, Steve.

  2. #2
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    May 2017
    Location
    Nantes
    Posts
    201
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    If m'y memory is good, fastloop must run in one screen refresh (if your app runs at 60i/s your fastloop have approximately 16 ms to run). If takes too long it will be killed. So trying to slow it down isn't probably the best solution.
    Maybe if you explain your goal and your problem we could offer you solutions.

    Have a nice day
    Haoujey

  3. #3
    Clicker Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)

    Join Date
    Feb 2015
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just did a quick test, and its the other way around, the loop takes priority and runs to its end stopping all other frame events and refreshing
    until it has ended, I tried to move an active around the screen 250 million times ,it took about 25 secs, 10 million a sec !. but screen only
    refreshed at the end along with other objects and timers I put in on always events. So, no, obviously this is not the way to do it !.
    Like I said, I have ways to do what i want, just wondered if someone had a simple way of doing this, ie,

    start loop "bigmother" - 10000 times - max times per frame - 100

    and it would retain its loop position etc.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleUniversal Windows Platform Export ModuleSWF Export Module

    Join Date
    Jun 2014
    Posts
    58
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yeah. Fast loops always pause the Fusion event loop to execute it's actions, before returning to the main Fusion loop exactly 1 action after the event that calls the fastloop.

    Loop speed depends on lots of factors. Moving a sprite around 250,000,000 times will not take the same amount of time as writing to an alterable value 250 million times, reading from an array, manipulating a list object etc. The individual functions of an object add their own latency. I'd guess that having many "on loop" events would also add to the latency. Whether you can complete the loop within a frame certainly depends on what events are executed within it. As such there isn't any consistent amount of time a fast loop should take to complete it's iterations.

    If you want to run a large amount of loops, but be able to break out of them at some arbitrary point to perform another loop, then return to the main loop at the same position you were at, the simplest & safest way is to count the main loop index manually.

    For example, if you want to run the loop 10000 times, but break out to perform some function on loop index #3756, then on that specific index you need to temporarily store the current loop position (say you used a global or alterable value called "elapsed_loop" to hold this value), then you will need to restart the main loop at the end of your function, minus the amount of loops that were done.....e.g start loop "big mother" (10000 - elapsed_loop) times.

    I wouldn't recommend doing this using nested loops, as it will be slow & possibly could crash the runtime, depending on the on loop actions.

    Another thing to note about loops is that where possible, avoid calculated expressions for on loop "xxxx" conditions (where xxxx represents a calculated string expression) events, this will cause a massive FPS drop. However, this is not true for calling a fast loop, so Start Loop "xxxx" will be as fast as if you called start loop "bigmother".

  5. #5
    Clicker Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)

    Join Date
    Feb 2015
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the answer YesNoYes , Yeah, stopping and restarting the loop is what im having to do, but its a pain as the loop length can vary
    each time, so i have an extra bit at the end, ie, loop length 1764 - every frame run loop 20 times ,reset each frame for 88 frames, then 1 loop of 4 at the end, or 4 loops of 21 then 84 loops of 20.
    on top of this, the speed needs to be variable, so loop amount will change dependent of speed.
    Trying to workout a formula for a linear speed scale for this, which sometimes needs to be faster than 1 per frame(needing loops), but also at times slower than once per frame rate( needing every X frames rather than loops), making my head steam, but I will get there in the end.

    Thats a handy tip to know about using calculated string expressions as loop names, I will keep that in mind, thanks.

Similar Threads

  1. Game Of Life - Fast Loop = not that fast :)
    By bad_rick in forum Fusion 2.5
    Replies: 7
    Last Post: 20th June 2016, 07:36 PM
  2. Replies: 3
    Last Post: 8th April 2016, 08:11 PM
  3. Replies: 2
    Last Post: 27th May 2015, 02:00 PM
  4. Fast loop within fast loop - platform game
    By Safe in forum The Games Factory 2 - Technical Support
    Replies: 1
    Last Post: 16th April 2010, 07:38 AM
  5. Fast loops controlling mutliple enemy movements.
    By Malice in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 25th August 2009, 01:21 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
  •