User Tag List

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

Thread: Mutliple object repositioning when overlaping other multiple objects.

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module

    Join Date
    Jul 2010
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mutliple object repositioning when overlaping other multiple objects.

    Hello again. This time I spend more than a day trying to figure this one out myself. I know I should probably be able to fix this myself by now. But I can't seem to remember how if so.

    In any case, I have about 20 enemies in my frame that all share the same movement system. Which is basicly
    If direction (south) then every "movementspeed1" set ypos of enemy to ypos of enemy +movementspeed2

    Nothing too complex. They use 4 directions in total.

    When they reach any edge of the frame they will change direction and also get re-positioned by 3 pixels in the opposite direction.

    When they overlap a neutral object (something meant to stop them climbing trees and walking through walls etc), I will check where the neutral object is, and where the enemy is with coordinates. To give an example, if enemy xpos
    <= to xpos of Neutral. Set xpos of enemy to expos of enemy-2 and change direction to west.

    It almost looks good to me. I want to believe that overlaping objects make the instance unique, and it will only use the objects overlaping to compare with.. This work good, well, with only 30 enemies atleast...
    Untill an enemy somehow manages to get stuck between 2 neutral objects. when this happens. All enemies will start to get pushed into a corner. Well, they will actually be re-positioned with the current code used, because they think they are still overlaping a neutral object and has to be moved, just because 1 guy got stuck...

    I have an example file where I have put an enemy inside the mountain to the northwest. To show the effect of what happens when 1 get stuck. If you want to wait for the "natural" bug you can move it outside again and just wait, there's usually one getting stuck southeast between 2 boulders.

    In any case, This code might be usable, IF ONLY one wouldn't get stuck - which I don't even know how it can happen.

    If someone would try to help me solve this, I'd appreciate it!

    Edit:somehow I managed to paste away this part:
    The obstacle collision is in the group Enemies-Obstacles-Original
    The enemy movement is under Enemie group - Enemy name- "name" Movement

    WASD to move around
    http://www.filedropper.com/rpgorb43faaaaail

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module

    Join Date
    Jul 2010
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Update:

    So, I've been at it for another day. I tried using alt values for directions instead of directions, didn't matter. I tried the ForEach as seen in the mfa(wrongly I assume, because ForEach isn't really making them unique in the way I want).

    And just now I tried to use alt values to keep track of the enemies coordinates, because I thought that atleast now they won't mess up other's values but.. Nah, it didn't work since they will still compare with the other enemy also overlaping an obstacle, and for some reason the enemy will think he's stuck.


    In any case, I think I start to understand why they will all start to get sent away. I searched the forums and found that usually one ought to set a "spread value" to make them unique. However I can't seem to wrap my head around how I would compare their value on each instance.

    The other problem is how they can get "traped" in the first place. thye should be pushed out long before they get stuck. Maybe when several enemies overlaps at different palces? Those cordinatioon will take priority and keep pushing it.. I don't know.

    Edit: I also now changed the action to set alt values instead of positions. Didn't fix..
    Images attachées Images attachées

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    There are many ways to do instance selection in Fusion, depending on your exact needs.

    Actually, I find spread value to be generally a little superseeded (by foreach loops)
    or little useful (because of fixed values already existing or dynamic IDs attribution under a custom logic)
    in short - I never use it but it's just a matter of habit.

    If you can isolate your issue in maybe just a specific group
    (possibly you've already done it? Sorry - maybe I just didn't read correctly your post!)
    or still better a single mfa portraying the issue alone,
    forum users could have easier times trying to check this out
    (and maybe "deconstructing" the code could be useful for you to solve it as well)

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module

    Join Date
    Jul 2010
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here it is reproduced, with minimal code.

    Just start it and watch. I added quite some enemies to make the wait shorter..
    Attached files Attached files

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Oh, I see
    nice example

    I don't think this is a scoping issue,
    I think overlapping condition are "too late" for bounce-collision type checks
    in the sense that overlapping occurs while object already overlaps (is over) the other
    in this condition, "phasing" may occur: object being pushed sideways may be "phased" inside another obstacle if the other obstacle is near enough,
    and so start to trigger all the overlapping conditions you coded at the same time, resulting in huge mess!

    If you switch overlapping to "on collision" events, things already get better (no objects phasing inside obstacles)
    but you'll have to add some randomness (or additional checks) to avoid "stuck" situations where spiders keep bouncing between same obstacles

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module

    Join Date
    Jul 2010
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The bouncing between same obstacles? do you mean when it changes direction in very short span of time due the 2 obstacles being close to eachother? Or do you mean "stuck" as inside an obstacle?

    The first mentioned is atleast logical, and is more of a design flaw than code flaw.

    I am not sure why Overlaping wouldn't work. Collisions can also happen at the same time, more foten when there's more instances.
    In any case I thought I tried collision alredy, I might've changed the hurt system a bit since, and that may have helped. But now it ran smoothly for 5 minutes atleast, thanks alot for that help!

    Now I have to decide wether or not to use fine detection I suppose. I made the 4 direction movement to keep things simple, heh, I fooled myself apparently:P

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Yeah I was meaning the first one,
    and yes I agree it could be avoided with some different design choice.

    Overlapping sounds as being "too late" in this situation to me: when an object overlaps another, it's already phased inside,
    you can push it back yes... but (unless you do it 1 px at time and testing, like on a loop)
    what if the object phased inside too much and your pushback distance is not enough,
    maybe due to the object moving too fast, or maybe an instant direction change making just a bit of object still overlapping
    or what if in your pushback you make it "phase" inside some other obstacle, triggering other pushbacks at same time, etc.
    A little messy.

    >>> btw, maybe using a separate "collision mask" would also save from this problem, making for a much smaller collision area (no legs) and thus lesser chances of "phasing"

    While collision events somewhat "prevents" objects from phasing, are more solid for simple bounces
    (I seem to remember collision events trigger when the first pixel phases inside the second object)

    There are many examples around for pixel-perfect collisions though, don't know if you're interested in this,
    or you're anyway up to a "lighter" approach.

    Yep, I don't know why but no matter what, with movements and collisions,
    as long as you can simplify, things always slip through your hands somewhere

  8. #8
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module

    Join Date
    Jul 2010
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well. I understand now. If the pixel speed is higher than the pushback, it can get deeper than the push out.

    By the way, I activated my other enemies, and they buged out, even though they use the same movement system, and are slower than the enemy I was doing the testing with. And the bug is probably what I experienced the first time i tried on collision, and is why I left it at once..

    I now tried it with the file I uploaded 2nd here, to test it for real, and well. It's not solid yet, they can still get past objects even with onCollision. I guess they are "phasing" over it. And this can be understandable if what you said is true, they will keep on doing their movement thingy instead of being pushed out. However, even if I fix that, for some reason my other 2 eemies are buging out, which is weird since I copied the movements from the 1st enemy on to the one I was testing with. I thought I had moved past this problem but nooope :P Even if I add the pushout to 5 pixels (which is higher than any enemy speed) The new bug will remain.

    I just realized, the pushout is the same as the speed so it shouldn't be able to move any further inside an object, especially since there's a delay on the movement, and not the pushout.

    I have reproduced, er.. nevermind. this is different. On my main file they will walk left and right by the right edge. here, the other enemy will, well. u'll see.
    Attached files Attached files

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    I'm starting loving that crazy spiders - why not leave them rolling?

    Just a quick question to avoid breaking our heads against something that has already been solved:
    have you tried bouncing ball with just 4 directions
    and/or direction "correction"?

    It's pretty solid and gives similar results (non-buggy ) even at high speeds

    i.e.
    Application 1help_1.mfa

  10. #10
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module

    Join Date
    Jul 2010
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well. The example you showed got spiders stuck in the trees..

    To expand on the ball movement.. I have used ball movement as a first go-to in all my applications, however, sooner or later they will make hell for me. I spent over a month trying to fix a certain enemy in my Tower Defence, and then droped the project for weeks- to later re-make the movement system (not using any ball movement).

    Ball movement have been nice to me, in early development, but usually wrecks havoc later on.. This is probably the first time I did not use ball movement from the start.

    More about selection of movement types. I like to try and keep things so I can understand them. I don't understand the ball movement. The movement system I have here, I can see it, i know what it does. Well, let's just say I can see what it does (or should do). I tried the safe move object2 today, but it didn't work and I didn't understand it.

    So for the sake of developement(personal aswell) I would like to understand. Just as I understood that the movement can't be faster than the pushback, it makes sense. But then again, the movement have timer and the pushback doesen't so it should be faster anyways. But I think you get my point, if I can understand it, it's going to be easier making applications


    Edit: I am open to suggestions if there's a simpler code than this.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Overlaping active object interference problem
    By Swiff in forum Fusion 2.5
    Replies: 2
    Last Post: 4th February 2016, 11:23 PM
  2. Global/ mutliple .ini objects?
    By nyme in forum Fusion 2.5
    Replies: 5
    Last Post: 5th October 2015, 08:06 PM
  3. how to identify 2 same object overlaping?
    By mulder in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 31st January 2013, 01:32 AM
  4. repositioning for multiple objects
    By pikzilla in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 27th May 2009, 03:24 AM
  5. Overlaping Active Objects
    By Jairo in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 9th January 2007, 06:01 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
  •