User Tag List

Results 1 to 7 of 7

Thread: Buggy Enemy Detection of Surroundings [+Example]

  1. #1
    Clicker Multimedia Fusion 2 Developer
    Blue66's Avatar
    Join Date
    Jan 2008
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Buggy Enemy Detection of Surroundings [+Example]

    Hi guys!

    In the last couple of days, I've tried to find a 1 object only method to have enemies that can jump and detect everything around them, without use of PMO or whatever.

    And with a combination of two methods that I've found, it's almost perfect! ...yeah almost

    The system I have concocted here has a few flaws and I was hoping someone can help me fix it. The enemy seems to act randomly different then he is supposed to.

    What I want from the enemy:
    - is there a gap in the ground? JUMP
    - if there is a ceiling over the ground? DONT JUMP
    - collide with walls? TURN AROUND

    Not that complicated, but I have no idea why he acts on random and not how I am telling him. Can someone here please take a look at this problem and tell me what's wrong?

    www.gungirl2.com/stuff/testenemy.mfa
    (if your browser wants to change file extension to .tiff, just rename it back to .mfa)

    Your help is very much appreciated!

  2. #2
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)

    Re: Buggy Enemy Detection of Surroundings [+Example]

    I'm very happy to see you're using embedded collision detectors, and not relying on the PMO extension either.
    That's what I'd do too.

    I don't understand the ceiling detection part at all. Why on Earth are you pasting a detector into the background?
    I suspect this is probably the part of your code that you need to redo. The rest appears to work okay.

    A few other points:

    I generally don't like to use spread values & fastloops, unless there's really no alternative. In this case they're not really needed, and you can address all enemy objects at the same time.

    You have an alterable value called "yPos", but it's actually a velocity not a position.
    You are adding 0.1 to this velocity (to simulate gravity), but you don't store the enemy's position as a float, so the velocity is always rounded down - meaning that the enemy doesn't accelerate smoothly.

    You have duplicate events for each of the three different "blockade" objects. You should give them all a common qualifier, and refer to that in your events instead.

    You're not using a fastloop to push the enemy objects out of the ground. This means that if they are moving very quickly, they will appear to sink into the ground and then slowly float back up, instead of instantly stopping when the hit the ground. The same applies to horizontal movement.

  3. #3
    Clicker Multimedia Fusion 2 Developer
    Blue66's Avatar
    Join Date
    Jan 2008
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Buggy Enemy Detection of Surroundings [+Example]

    Thanks for taking the time and looking at my file

    The ceiling detector is pasted into the background just for me to see if it has the right height. If I take out the ceiling detection, the enemy would jump through the ceiling and that's not what I want.

    The different blockades could be handeled through qualifiers, but I have some values stored in the blockades that sometimes let enemies through, but took that part out for this example.

    The fastloops were taken from the original enemy engine - I had it on my hard drive for a time and I can't remember where I got it from. It didn't have any credits, so I'm sorry I can't thank the guy who made it.

    You have a solution how I should improve this engine?

  4. #4
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)

    Re: Buggy Enemy Detection of Surroundings [+Example]

    Quote Originally Posted by Blue66
    The ceiling detector is pasted into the background just for me to see if it has the right height. If I take out the ceiling detection, the enemy would jump through the ceiling and that's not what I want.
    I'm not seeing that.
    If I remove that one action, the only time they jump through the ceiling is if it's a blockade object, and that's because your "detect ceiling" events (lines #24 & #25) are only detecting obstacles - not blockades.

    The only thing that looks a bit weird to me, is the way they almost walk off the edge before turning around (where there's a gap, but they can't jump because of the ceiling). I'd guess that's just down to the positioning and size of your detectors though.

    In case you're interested, I made this: https://skydrive.live.com/self.aspx/Public/PF5.mfa?cid=b1e7ee094271bbda&sc=documents
    But I'm bored now, so I probably won't take it any further.

  5. #5
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: Buggy Enemy Detection of Surroundings [+Example]

    MuddyMole. Nice example. I love the pink comments. Gets your attention.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  6. #6
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)

    Re: Buggy Enemy Detection of Surroundings [+Example]

    Thanks
    I nearly always use the same pink color scheme - that's how you can easily spot one of my examples.

  7. #7
    Clicker Multimedia Fusion 2 Developer
    Blue66's Avatar
    Join Date
    Jan 2008
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Buggy Enemy Detection of Surroundings [+Example]

    Thanks a lot MuddyMole! Your example was very helpful and I've figured out a very solid method for enemy behavior now

Similar Threads

  1. 'Manual box colission' VS 'Built in colission detection ( fine detection checked )'
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 8th February 2012, 09:32 PM
  2. my buggy first app
    By JollyPanda in forum File Archive
    Replies: 5
    Last Post: 13th July 2010, 10:36 PM
  3. Enemy Detection System
    By MikeB in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 27th April 2009, 11:09 PM
  4. Moosock very buggy
    By FerHat in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 27th December 2008, 01:26 PM
  5. Fades are buggy?
    By Jarzka in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 11th September 2006, 02:51 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
  •