User Tag List

Results 1 to 5 of 5

Thread: Optimizing code - how fusion reads the events?

  1. #1
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperiOS Export ModuleUniversal Windows Platform 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)
    droxon's Avatar
    Join Date
    Feb 2014
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Optimizing code - how fusion reads the events?

    Hello guys, I have a quick question and hopefully somebody can help me out.

    I'm trying to optimize my code, but I'm a little confused.

    If an event has for example 10 conditions, and the one on top is lets say: Difficulty=2

    If the difficulty is not 2, I'm assuming it would skip that event without reading the other 9 conditions, let alone the actions... I'm I right?

    Or is it better if I put that event inside an Inactive Group and then if Difficulty=2 activate that group?

    I'm thinking that both achieve the same thing, but one is just more work, please correct me if I'm wrong. I'm just trying to understand a little bit better how the event system works.

  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)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,301
    Mentioned
    94 Post(s)
    Tagged
    0 Thread(s)
    I don't know for sure (maybe someone else can confirm) but the way you described it is certainly how I believe it works. Hence, I try to always put the conditions that are least likely to be true first, to save on Fusion having to read all of them each time.

    Though it probably doesn't make much difference, really. The things that seem to make a tangible difference in performance are mainly: Shaders, number of objects on-screen, fast loops, and inefficient variable types (eg. named variable object or list object).

    Another thing to note is that the conditions which are green (eg. "start of frame" or collisions) get executed out of the regular order - ie. whenever they happen, and not just when Fusion reaches them in the event list.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    arthurh's Avatar
    Join Date
    Sep 2010
    Posts
    916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use group to optimize your code. If difficulty=2, open group "difficulty 2" and the end of this group close it. This is more efficient : less line to read for fusion

  4. #4
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You are correct Droxon.

    If you have the following event

    + Condition 1
    + Condition 2
    + Condition 3
    - Action 1
    - Action 2

    and Condition 1 is false, the rest of the conditions and actions are skipped

  5. #5
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperiOS Export ModuleUniversal Windows Platform 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)
    droxon's Avatar
    Join Date
    Feb 2014
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot for your replies guys, I'm glad Fusion works that way

    @arthurh
    Thanks for the tip Arthurh, I have most of my events inside inactive groups like you mentioned, but I was asking about individual events... if Fusion skips them as soon as it reaches a false condition, then I don't see the point in putting that particular (1)event inside an inactive group, if I still need an extra event to check if the group needs to be activated.

Similar Threads

  1. Fusion 2.5 Source Code Game Templates
    By DrWho in forum Fusion 2.5
    Replies: 4
    Last Post: 13th April 2016, 05:38 AM
  2. code 'snippets' for Fusion 2.5?
    By Dex in forum Fusion 2.5
    Replies: 6
    Last Post: 14th August 2015, 04:59 PM
  3. plug a C++ code into Fusion
    By ADS_3000 in forum Extension Development
    Replies: 10
    Last Post: 20th June 2014, 10:34 AM
  4. Fusion 2.5 Developer - Looking for Code optimization and/or Consultation.
    By Logiq121 in forum Paid Design & Development Requests
    Replies: 0
    Last Post: 12th March 2014, 05:56 PM
  5. How MMF reads conditions
    By Nick in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 14th July 2007, 11:22 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
  •