User Tag List

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

Thread: Enemy AI

  1. #1
    No Products Registered

    Join Date
    Feb 2007
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Enemy AI

    I know this will obviously take allot of skill but has anyone achieved to make an Enemy AI using MMF2 or TGF2? I know the extent of the AI will be limited but I was just interested to know if anyone had achieved this.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleInstall Creator ProPatch Maker
    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)
    DJFuego's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    1,416
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemy AI

    I think anyone that's made a game with MMF2 has made AI for enemies. Can you be more specific. What genre of game are you making?

  3. #3
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemy AI

    And what would you consider AI? In game terms it's already considered AI when the enemy can shoot at the player on sight.

  4. #4
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemy AI

    There's entity AI and "enemy player" AI. The first is easy, and is as simple as "Distance less than 200, look at player and fire gun".
    "enemy player" AI is things like a strategy game opponent. These are nearly impossible to create, even outside MMF.

    The difference is that entity AI is essentially reactive, it only reacts to things happening. "enemy player" AI can make some of its own decisions.

    Some AIs made in MMF are impressively complicated.

  5. #5
    Clicker Fusion 2.5

    Join Date
    Mar 2007
    Posts
    495
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemy AI

    Generally I tend to use random variables to decide what my enemies do. It makes them difficult to predict.

  6. #6
    Clicker Multimedia Fusion 2

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

    Re: Enemy AI

    I use states, so my AIs are more like state machines I suppose.

    The way I figure it, you've got a better brain than the machine, so you may as well give the AI as much help as you can!

    The trick to state AI is to give the enemy player as many senses as possible. So by senses I mean events that tell him something practical about his environment.

    So for example, I want a platform AI who chases you and leaps off ledges if he can, but screeches to a halt if he can't. How do we code this?

    We give him a simple set of tests. So for instance, I put a detector about 40px in front of him. If it stops overlapping an obstacle (the floor), then the enemy has got a drop coming up. When a drop is sensed, we test again to see if the drop is 30px deep (a safe falling distance). If it's still there after 30px, we either move it downwards to see just how far deep the trench is, or simply tell the AI that this edge is BAD.

    The AI stores this in one of its many Alterable Strings. It now knows to apply the brakes because even if the good guy leaps off this ledge, it won't be safe for the bad guy to do so.

    We can extend it by using still more detections, so for instance I know when he jumps he has a force of -10px, and gravity is 0.3px per second, and his forward run speed is 3px, so I can plot his jump curve. Using this data, move a detector along that curve and if it lands safely, you know he can jump the gap.

    You can basically make it as complicated or as simple as you like, but this still comes under what Dynasoft described as Entity AI, rather than a convincing opponent.

    For most of our games though, Entity AI as described above is sufficient.

    The key like I said is perform lots of different tests and store the results in alterable strings and values. Is the NPC standing on the floor? Is there a wall to his left? To his right? Above him? Is he coming near to a ledge? Is that ledge dangerous? Can he jump the gap? Does he have any weapons? How much ammo? Are there any friends nearby? Is there anywhere he can hide? How close is he to the player? Is he facing the player? You just have to ask the right questions for the behaviour you want to simulate.

    Then, when you've checked all these details and stored their results in his memory, you can now make decisions using them. So:

    NPC is standing on floor
    Has Javelin in hand
    Player is in range
    Path not obstructed
    --- NPC: Throw javelin.

    NPC is standing on floor
    Has NO javelin in hand
    Player is nearby
    Friend's corpse is nearby
    Friend's corpse has javelin (left on floor when he died)
    --- NPC: Run to javelin

    (the NPC will now pick the javelin up, so the event above will trigger and he'll throw it).

    That's how I do it anyway, you can give him all sorts of responses this way, and factor in unique features thanks to MMF's new 'x in y chances' feature.

  7. #7
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemy AI

    Quote Originally Posted by Dynasoft
    There's entity AI and "enemy player" AI.
    You just made that up to sound smart, right? Sneaky. :P

    Nice breakdown, Dines.
    If you want to have your NPC make "intelligent" decisions, you have to provide as much information as possible - within the limits that the NPC can perceive. Having your NPC not know where the player is until he actually sees the player is pretty nice in most games (and can make some tasks easier - e.g. you can get away with less navigation / pathfinding if the enemy does not approach the player if he can't see him).
    On the other hand, if you can make good use of a pathfinding extension, you have one of the trickiest parts of AI already nailed. E.g. for strategy games Greyhill's Advanced Pathfinding Extension can handle A LOT of AI issues.

  8. #8
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemy AI

    Gotta mention one thing about pathfinding though... What most people consider "good" pathfinding is when the enemy can find the shortest route through a series of obstacles to get to the target. This is actually BAD. Why?

    Because much like a hamster in a maze, an enemy is not going to automatically know the shortest path and then take it. That isn't realistic at all.

    A better approach would be to have the enemy take what it THINKS is the shortest path, based on how close it is to a path, how long the path looks, etc. For example, if you were in a maze and approached a fork in the path, would you take the short path that turns early, or take the longgggg path that has multiple turns at the end? You'd take the short one, because you'd mostly likely find out quicker if that way is a dead end.

    But a "good" pathfinding AI would determine that the long way might be best, if it is indeed shorter. So it would take the long path, which defies human logic.

    So I'm all for making enemy AI sort of "stupid" when it comes to pathfinding, and giving them the ability to get lost or trapped or what have you.

    This won't work in all games, mind you, but it's worth a shot. It really wouldn't work in Pacman, seeing as how the ghosts need to be able to hunt you down with a high degree of speed and accuracy. It's not as though enemies can see the maze from a top down view and plot the course accordingly. All they'd see are walls and openings.

    Of course, one has to wonder why ghosts even need to pathfind when they could just go through walls... which makes me wonder why nobody thinks about this when playing Pacman. :p

  9. #9
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemy AI

    I think that's a very interesting point, but really only applies in some situations. In many games you, as a player, would expect units to see the world as you do - top down, or whatever it is.
    Especially if they're YOUR units in an RTS, or YOUR character in any point & click game.

    So often enough, this level of realism is bothersome for the player, or he doesn't really care anyways. It is a thought that becomes very apparent to you as a designer, but most players wouldn't notice the extra mile you went for more realism.
    The same is often the case when you make some elaborate choice system vs. random choices.
    For most players the random choice will just do fine.

  10. #10
    No Products Registered

    Join Date
    Sep 2009
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemy AI

    Someone should upload an example, at least a little enemy, because I can't imagine doing that.
    I don't know how to use timers, I found them useless (in MMF2).

    When I hacked SMW, what I did for enemys was define some kind of variables that were the timers, and the enemy do a different action each specific time.

    So, for example, what if I want an enemy that always faces the player, and each 1 second or 2, throws a bullet?

    Another thing is bugging me is the problem of insert 2 or 3 enemys of the same.
    Let's say I make an Active Object, that is name Enemy1.

    I set up a timer for Enemy1; each 3 seconds throws a bullet; the enemy always faces the player and it have an Alternate Variable named HP, that contains 3. Each time the player shoots towards Enemy1, HP decrease 1, so when HP = 0, Enemy1 is destroyed.

    I insert Enemy1 in the frame and it works well.

    I want to have 3 Enemy1 in the same frame, so I make copies of it. That's where the problem is. There are 3 copies of the same Active Object.

    If I want to have 5 or 6 Enemy1 in the Stage, it's useless to make 6 Active Objects with the same settings.

    I hope I explained myself well hehe.

    Thanks.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Strange thing: If Enemy Alterable Value A = Enemy Alterable Value B
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 26th March 2012, 05:29 PM
  2. Enemy AI
    By Lucien in forum Multimedia Fusion 2 - Technical Support
    Replies: 44
    Last Post: 17th February 2012, 06:02 AM
  3. Enemy
    By Taceo in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 26th July 2010, 09:47 AM
  4. Enemy Help Please!
    By Gate001 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 6th June 2010, 01:54 AM
  5. Enemy HP
    By FlinkGigitty in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 22nd January 2010, 08:09 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
  •