Bomberman Mechanics for AI

0 favourites
  • 13 posts
From the Asset Store
Top down zombie survival mechanics pack in the style of Cannon Fodder.
  • Hi folks,

    I'm researching a way to develop the AI for NPCs opponents of Bomberman.

    There are some tricks, like avoid the own bombs, also, avoid the adversary bomb, and don't be dumb to stuck on a corner.

    The scenery will have moving tiles like treadmills, quicksand and so on.

    On the time finish, the scenario will start to tighten to the center.

    So, it's just to learn more about AIs. I'm thinking about a custom movement system, checking the four cardinals with points. Pathfind here is something important? or not!? that's the question..

    Assuming the NPCs will need to know where the player is, how is the best approach to make them chase the player with a minimum of strategy? Plus, they should fight each other too...

    If an NPC set a random route and use pathfind to achieve it every 3 seconds, plus, if an enemy cross his line of sight is a start, but it will be so much random. Making pathfind over another NPC/player and the AI necessary to avoid him suicide himself maybe be a good way to go.

    Do you know, have or simple want share something about the Bomberman mechanics? Please, share with us.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Pathfinding might be as important as you want it to be. Meaning depends if that would be the core of your movement or not.

    Im intrigued by this type of AI cause is a complex one, you have so many things to tackle and take in consideration. but definitely you're four cardinals suggestion is the way to go, however its not only 4 ways of moving its 16 i think if we exponentially grow the possible positions to move on, cause you have to make the AI become smart a bit so it can decide to go close to the player and try "hunt him down?" or just build its superpowers and then go for a hunt? thats why im intrigued by this AI is bloody amazing and complicated all those variables.

  • I think Bomberman uses a minmax algorithm like chess where all possible moves and outcomes are tested then the best result is chosen. I don't think its possible to do it with events as it would be too slow and complex.

    An easier approach (which has its owns problems) is some thing like this https://www.gamedev.net/forums/topic/622051-ai-for-simple-bomberman-game/

  • Well, I'm testing an AI to mimic Human behavior, and it's going well, but the difficult I'm facing now is to determine the ways to reach the player. If the AI is placed in a spot where he need to destroy some walls to reach the player, he will be unable to pathfind the player, also, if he have a long way to go, but destroying a wall near him can make a shortcut, he will ignore this and walk all the way around...

    , I have no idea of how to make a matrix and explore its potential to result in something useful, like chess AI do. Chess have two main variables, the number of moves and the movement behavior itself, but here, you'll have power ups like said, will have superpowers, jump mechanics, aggressive and defensive status, walls to block his way, bombs to avoid, also blocking the way, plus traps, destructible permanent stops, etc xD

    I'm trying to start with a simple bomberman/dynaman behavior because it only use bombs and power ups, walls and few less mechanics to learn and work on.

    So, my sixty sense is saying the mimic human behavior is the way to go, ignoring algorithms, and making it more chaotic and variable.

    Organizing this behavior, it'll be something like this:

    Initial Behavior:

    • Destroy a radius of 3-4 wall blocks around the initial spot always catching powerups;
    • Check the player distance and orientation, going toward him, picking the nearest wall and destroying it;
    • Check the player powerups, if he is powerful than the AI, it will chase powerups and become in a defensive status, else, hunt the player mimicking the human behavior, trying to hold him with bombs and corners.

    Defensive Behavior:

    • Pick the nearest destructible wall where he is able to reach;
    • Search for powerups on screen and try to reach it;
    • Avoid player, avoid cross paths with bombins in line, avoid corners and dead end paths;

    Aggressive Behavior:

    • Chase the player, staying two to three steps ahead him;
    • Avoid corners, but use the bomb space to protect himself if necessary;
    • Keep tracking the bombs timers and ranges;

    Common Behavior:

    • Track bomb paths and the possibility of one bomb ignite another one;
    • Pick bombs and throw them if possible, in direction of the player;
    • Kick bombs in line to hold the player on corners, also check if a bomb can explode and his fire will cross the path of this bomb to explode before;

    To make the bombs more predictable, I'm thinking in setup an invisible object to be placed along the line of fire exactly when the bomb is placed, so, any AI will can check where the fire will hit and avoid it, but, if a wall near the bomb is destroyed before it explode, the range of this bomb will need to be adjusted.

    This give me freedom to make every AI with some human behaviors, like more aggressive, more strategic, more defensive and even more careful of crossing fires, using it in its favor, dropping bombs in time to kill the player when he is running around.

    All the way this is a huge amount of things to do such simple AI =

    Do you think it can work well?

  • Well, it's proving to be more challenging than I'd thought.

    Anyone know where the AI of Vs mode is explained? Or a source code in C #, Java, anything.

  • try to use some Finite State Machine, it will become so random.. maybe it is a good start and simple.

    if it has some wall in front, throw a bomb and get out.

    if it has a bomb near, make the NPC go away from it.

    even this is going to be a lot of work to implement.

  • Yes, to run away for a safe spot give a lot of work, because it need to keep tracking too much events, like line of fire, obstacles, other players, etc. It also ask you a decision, what is a safe spot? What is the best behavior to find one?

    In the start, for example, I did him to search for a diagonal available spot after placing a bomb, and wait til the fire is over. For this simple task I did a lot of events and variables.

    But when you have a player facing the AI, and he placed a bomb and walked to the "safe spot", so, the player placed a bomb in line with him, and the first bomb didn't exploded yet. Here I did a "choose" event to the AI decide risk running away or still there and die, but it's always possible to track the bomb timing and walk away when possible, if possible.

    I'm working on a Pacman clone right now to learn how to make the AI move smooth, and newt told me about a plugin of pathfind using the A * Pathfind algorithm, who is very fast.

    Looking forward, AI in bomberman is being a huge challenge for sure, at least for me.

  • I liked the challenge

    When I have some spare time, I will see what I can do

    Then I can share what I done so far... lets see

    I will try to use finite state machine

  • I liked the challenge

    When I have some spare time, I will see what I can do

    Then I can share what I done so far... lets see

    I will try to use finite state machine

    I'm needing to pathfind four times per AI, because the AI can reach the walls in four sides, but here is a trick, we need to know the shortest path. Also, I can't setup it to go straight to the wall, or it will overlap the wall with the move-to behavior.

    I'm thinking in improve it by setting the AI to to direct to the wall but when the next step hit the wall, disable the whole thing, but didn't figured out how yet.

  • Almost there...

  • Nice effort my friend! Remind me of my stalled Bomberman prototype:

  • Since the game level is a board and people move on squares in a grid, you could find the square you want to move to, mark that sqaure as 0. Then go outawards in a circle pattern so the next squares surrounding that would all be 1, then go outwards again and all those squares would be 2 etc until each square on the board is covered. Dont count squares with a wall as you cant move there. Now all the person who is moving needs to do is to always move each step towards the sqaure with the lower value to the square its currently standing on to move there.

    You could artifically inflate the value of squares under certain conditions to make those squares less attractive to move to, such as if an enemy drops a bomb then that would add say 100 to the sqaures value and would radiate 99, 98, etc for the bombs explosion range. The person would avoid those squares and find a path around them.

  • For making the ai avoid explosions you could use

    https://en.wikipedia.org/wiki/Breadth-first_search or

    https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm

    It's kind of along the lines of what mOOnpunk said, but instead of a weight, we just search from the player to the closest non blast radius area. That brings me to another idea, you can use an array as a grid of the level and loop over the bombs and set all the locations that will have explosions. That gives a simple lookup with events.

    https://www.dropbox.com/s/ks3feo35bgyo1 ... .capx?dl=1

    Basically that's the first half of an ai. The blue guy will move out of the blast radius of placed bombs if it can without stepping into fire. It doesn't consider the time left before a bomb goes off which is something most players don't bother with. they just stay out of range of bombs.

    The second half would probably be moving and placing bombs. Finding where to bomb could be done with a similar breadth first search and then evaluating what a bomb would destroy (enemy or block) for each grid location considered.

    The logic would be:

    if the ai is in a blast radius

    move to same place

    else

    find a good place to bomb, move there and place bomb

    To keep the ai from bombing itself you can also check for if there's a place to escape to before placing the bomb.

    Anyways maybe some of those ideas are helpful. More advanced stuff can probably be considered later, but the basics are always good first. Also in the example everything is grid based but the motion doesn't have to be. The units need not even stop of grid centers, but that's something to figure out for another day.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)