Jump to content

Bomberman Ai


vytas
 Share

Recommended Posts

Still busy on one of my JS projects, but I need some ideas for the bomberman AI for the players. I whas thinking of something like this:

if isInBlastRadius then if canWalkDown   walkDown() if canWalkRight  walkRight() else   walkLeft()else if enemyIsNear (like 3 tiles) dropBomb()else  randomWalk()

This is pseudo code just so u know :)Bomberman-project (not completed)

Edited by Vytas
Link to comment
Share on other sites

Yeah i need some ideas for the AI, i never designed one before so i need some ideas on how to do this.

Link to comment
Share on other sites

I'm not understanding what you're asking for. A game should have a main loop that keeps running, and inside the loop one of the things that needs to happen is you loop through all the actors and check each one to see what actions they need to do, whether they move or whatever. So your game needs to have each actor on the stage saved somewhere so that each time through the main loop you can loop through each actor to decide if they need to perform an action. I'm not real sure what else to say.

Link to comment
Share on other sites

This may sound extremely primitive, but I would suggest forgetting about the coding for a while. Mock-up your game with cardboard and construction paper. Play it by yourself or with a friend for a while. Improve the rules and strategy as things come up. When you've got the thing down so it's as clear as Monopoly, start work on the code version.There too, work on the logic first, rather than the images. That can come later. Games are about decision-making and mapping coordinates. If you need to "see" something, move alphabet characters or colored divs around for a while.Probably the place to start is a coordinate system. Will you move things at the level of pixels, or will you have a grid (the grid can be invisible--the idea is that things would move in blocks of pixels instead of individual pixels) ? Just being able to change the color of XD42 (for example) is a pretty good trick.

Link to comment
Share on other sites

I am almost done with this bomberman project just need a few things added for the player object like the move function etc. but i don't know if i should add a* pathfinding because it's only a small map and the layout in the map is just a pattern. I don't got sprites in place i will worry about that if the game runs smoothly. And i got the tip before, that i must first draw my map and play bomberman with the AI rules i setup. I will try that. But if you look at my first post should that code be fine for an bomberman game? Or do you want to see my code first?

Link to comment
Share on other sites

You don't need something like A* unless you're trying to get from point A to point B. If you're just moving randomly, especially if it's on a grid, each turn you can just use random numbers to decide which direction they move. You can implement some crude chasing type of thing if an enemy is within a certain range, but you shouldn't need anything as complex as A* for something like that unless you're trying to automate getting from one point to another point (e.g., a maze). If you're not trying to navigate a maze, but just move around randomly, you don't need to use A*.

Link to comment
Share on other sites

Ive uploaded the project. (see the link in the first post).

Edited by Vytas
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...