User Tag List

Results 1 to 5 of 5

Thread: tutorial on how to use fast loop

  1. #1
    Clicker Fusion 2.5Android Export Module

    Join Date
    Jul 2006
    Location
    Falkirk,Scotland
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    tutorial on how to use fast loop

    can anyone give a clear and concise tutorial on how to use fast loop as I cannot get my head round it at all.Some examples would be appreciated.Thanks in advance.

  2. #2
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2006
    Location
    Britain, South Coast
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: tutorial on how to use fast loop

    I'll have a go for you.

  3. #3
    No Products Registered

    Join Date
    Aug 2006
    Location
    Westcountry, UK
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: tutorial on how to use fast loop

    Basically when you start a loop using an action MMF2 will look for all the conditions which have "On Loop" in them.

    So it is like a function object. It took me a while to work out how to use it.

  4. #4
    Clicker Multimedia Fusion 2

    Join Date
    Sep 2006
    Location
    Britain, South Coast
    Posts
    1,030
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: tutorial on how to use fast loop

    [size:14pt]Fastloops[/size]

    Fastloops are immensely cool. The purpose of this article is to show why they happen to be so immensely cool, and how we can use them to coolify our programs!

    Before we start, we need some background info on how MMF2 works. This will show you why we need fastloops...

    [size:11pt]Event Loops[/size]

    Look at your event list. MMF is reading this list from top to bottom all the time. When it comes to the end, it redraws the screen and starts reading the events all over again.

    Each time MMF reads the whole event list, it has performed one 'Event Loop'.

    However... redrawing the screen takes ages (in computer terms at least). Since the next event loop won't start until the redraw is complete, event loops are REALLY slow.

    This normally isn't a problem, but sometimes you need to process things faster. That's where fastloop saves us.

    [size:11pt]Fast Loops[/size]

    Imagine this:

    MMF is reading through the event list. Suddenly, it comes to a an action saying "Start loop 'blah' 100 times"

    MMF now changes its behaviour slightly. It remembers where it was, and then starts looking for any events which start with the condition "On Loop 'blah'". It runs these events as it comes to them. MMF has now entered what's known as a 'Fast Loop'.

    Once it's finished running those OnLoop events, it goes back up and runs 'em all again. And again. And again. And again, blindingly fast until it's done all of those OnLoop events 100 times. The reason it's so fast is because MMF is not stopping to redraw the screen.

    Once the 100 loops have been performed, MMF goes back to the action which triggered the loop ("Start Loop 'blah' 100 times"). It now continues going through the events as normal. MMF has finished its fastloop, and is now finishing its Event Loop.


    Once the eventloop is finished, it redraws the screen.

    [size:11pt]Uses for Fastloops[/size]

    Fastloops have the following advantages:

    They're Fast
    They Don't Redraw the Screen

    The first advantage is obvious. Sometimes you need MMF to do something really really quickly, like loading a game save. Fastloops are so fast, you often don't need to create a Loading Screen at all!

    The second advantage may not be so obvious, but is hugely cool. For example, you can loop through each enemy, checking how far they are from the player. If that enemy is within a certain distance, make him face the player.

    If you did this with normal event loops, you'd see each enemy turn to face the player one after the other.

    With fastloops, they all turn instantly.


    [size:11pt]How to Use Fastloops[/size]

    I may post some examples later, but for now, this description will have to do.

    You can give each fastloop a name, to describe what it does. For example, if I'm scanning a list for some reason, I might name the loop "LIST SCAN".

    You can also do several events PER loop.

    Here's an example. We have two counters. When we press SPACE, we want to add 1 to the first counter and 5 to the second counter.

    [events]
    Using a Fastloop!

    *User presses key "Spacebar"
    -[obj_special]Start Loop "ADD" 100 times

    *On Loop "ADD"
    -Counter 1: Add 1

    *On Loop "ADD"
    -Counter 2: Add 5

    [/events]

    When you press space, the first counter will instantly say "100" and the second will instantly say "500". Because it didn't redraw the frame, you don't see the counter going up. It just instantly seems to jump.


    'Fraid I can't do any actual MMF2 examples for you right now, but if someone else would like to, that'd be great. I hope this is good enough for now, if you have any other queries, just ask

  5. #5
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module

    Join Date
    Jun 2006
    Location
    Merseyside, UK
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: tutorial on how to use fast loop

    To back-up Dines explanation, here is a simple example comparing fastloop to event loop. The two methods are shown for adding all the numbers 0-999 into a listbox.

    (Note: You dont really need a counter in the fastloop frame, you can access the loop index value and use that, but I left it to make the comparison clearer)

    Small Example

    It includes both points mentioned, first the speed difference and second the screen redraw, notice how the fast loop version doesnt show any numbers until the operation is complete.


Similar Threads

  1. Instead of Fast Loop
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 17
    Last Post: 5th November 2010, 04:08 AM
  2. fast loop and loop index
    By willow in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 18th May 2010, 01:43 AM
  3. 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
  4. fast loop
    By jhonson in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 17th November 2008, 09:18 PM
  5. Fast Loop - How do you use it?!
    By jonjoyceuk in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 31st May 2008, 02:47 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
  •