Genetix
Member
I am trying to work on a grid based Tactics RPG - This is something like Final Fantasy Tactics, Fire Emblem, Disgaea, etc. If you have never played a game like that - essentially it an RPG where the battle takes place on a grid.
The player takes a turn - each of their units can move so many tiles on the grid (based on how much energy they have) and can also attack if they are in range of an enemy and have enough energy left. I have this system working great.
I am struggling to get my enemy AI working correctly though, and need some feedback on the logic behind how it should work.
I am using an mp_grid to break the battle field up into tiles - but have a number of questions if anyone can help:
- My enemies move to the nearest player unit, but they all end up on the same tile, how can I prevent this from happening?
- If the tile by the nearest player unit is not open (another enemy standing there) how can I have my enemies move to the next closest tile?
- How can I make my enemies move to a random tile that is open if they aren't within attacking range of a player unit?
- How would you make an enemy move 1 tile at a time towards the nearest player unit object, rather then setting a path directly to the nearest open tile by that player unit?
I hope this makes sense, i'll be glad to go into great details and share some code if that helps out. I have really been struggling with this recently, but need to grasp basic AI using grids and paths better.
The player takes a turn - each of their units can move so many tiles on the grid (based on how much energy they have) and can also attack if they are in range of an enemy and have enough energy left. I have this system working great.
I am struggling to get my enemy AI working correctly though, and need some feedback on the logic behind how it should work.
I am using an mp_grid to break the battle field up into tiles - but have a number of questions if anyone can help:
- My enemies move to the nearest player unit, but they all end up on the same tile, how can I prevent this from happening?
- If the tile by the nearest player unit is not open (another enemy standing there) how can I have my enemies move to the next closest tile?
- How can I make my enemies move to a random tile that is open if they aren't within attacking range of a player unit?
- How would you make an enemy move 1 tile at a time towards the nearest player unit object, rather then setting a path directly to the nearest open tile by that player unit?
I hope this makes sense, i'll be glad to go into great details and share some code if that helps out. I have really been struggling with this recently, but need to grasp basic AI using grids and paths better.