User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: Faster Multiple Object Instances

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Faster Multiple Object Instances

    tl;dr

    To make long story short, my code lags with lots of objects and I'm looking a way to speed it up. Pleas Help as it is for my Uni project MMF2/F2.5!

    ****
    Current Source:
    http://tm2fk.pl/snail_on.png

    In short

    - Source = Planet
    - Object/Children = Satellite
    - Each Planet can have random number of Children (0-16)

    With 100 planets there can be betwen 0-1600 satellites and each follows their independent Planet on specified distance (planets can change size real time, and level also scales).

    Proposed solutions:

    1) Attempt to count only Satellites/Planets for visible (in range) but how to limit loop to only that amount, and know specifically that I refer to them?

    2) Instead of loops use array (proposed by snail) but I never used them in such scale and... I even don't know where to start

    3) Any other idea which could speed it up would be wonderful.

  2. #2
    Clicker Fusion 2.5iOS 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)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    905
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    You don't need loops for this at all as you can set the satellite's alt.values to the orbit centre of each planet as it's created, then just run the code for the orbiting actives based on these values.

    Example:

    satellites.mfa


    Easily does >2000 satellites on screen at once.

    Hope this helps!

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks I will have a look when i will be back home. If it can be done outside of a fast loop it would be epic SolarB!

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So I tested it and it is all cool but I tried before with the IDs, and it didn't work out for me (dunno why).

    In provided modified example I added a scalability of individual planets and it only works for me in this scenario - where individual planet is selected and we do action then.

    In any other instance (like trying to do a loop or always condition) not all satellites were moving to corresponding position or only the latest one did
    Attached files Attached files

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For Each loop is one of the ways to go, I thought about it yeah. We will see. ATM I need to make it working in MMF2 and it doesn't have built-in ForEach loop (I know about the extension, thought )

    Still any other ideas/concepts/solutions are most welcome - I credit everyone and look for most efficient one. I will give some of my own results after I wake up, lol.

  6. #6
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    Sphax's Avatar
    Join Date
    Jun 2006
    Location
    Paris, France
    Posts
    4,454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To optimize your current system two things:
    1) Use For each loops
    2) Use Groups. Put all your updating code in a group and disable it automatically at the end of the group with a "On group activation" or in the loop itself if there's only loops. Then before executing your loops or foreach loops, be sure to activate the group in which it is located.

    The group solution will prevent MMF to browse all loops in search of the right one. In my case I save between 5-10 FPS.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sphax I am aware of Group Activation hack, however in total I run 2 loops in my engine - 1 for creation of sattellites (which is deactivated) 1 for their positions (which is the issue here).

    I will need to have a look into that For Each loop, but the extension is not available anywhere online to download (Ross website directs to Clickteam, which after refreshing is not supporting any of developers subpages .info/username

    Also AFAIR ForEach MMF2 is not XNA compatible, is it changed for 2.5? Or 2.5 even doesn't have XNA support?

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK I recreated examples provided in MMF2 (I will still play with them) and there is a small difference in performance:

    MMF2: 6862 Sattellites
    F2.5: 7363 Sattellites

    Still both are running pretty smooth and scaling seems to work (yet its slow motion, but what to expect in refreshing of fewK objects... So thanks a lot for your ideas. I will try to experiment further with ForEach!

  9. #9
    Clicker Fusion 2.5iOS 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)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    905
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Since you only need to update the planets and satellites on user input running this update loop for 100 planets is not a problem. Of course when in the process of zooming in and out it will eventually drop your fps. I don't think there's a more efficient way to do it, but I may be wrong, anyway here's an example with built-in foreach in F2.5.

    satellites_scale_SB.mfa

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,665
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guys both solutions are very much helpful. Much appreciated.

    It helps a lot I will see what I can sort it out with.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Faster Multiple Object Instances
    By Fanotherpg in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 7th March 2014, 06:39 PM
  2. Still having trouble dealing with multiple instances of one object
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 31st December 2013, 11:33 PM
  3. How do you reference multiple instances of the same active object?
    By Cybert9 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 3rd February 2012, 02:33 AM
  4. Shoot object of multiple instances
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 31st October 2011, 04:58 PM
  5. Multiple Instances of Object glitch
    By JimJam in forum File Archive
    Replies: 10
    Last Post: 5th March 2008, 12:44 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
  •