Create Enemy AI in TBS?

0 favourites
  • 5 posts
From the Asset Store
Background Story generation templates. See the Arcade demo.
  • Hi, I am currently trying to a turn based strategy game using construct 2.

    While I manage to successfully create a grid-like movement system for the player, I have no idea on how to create an enemy AI for such a game since the movement must be restricted by the distance, which I have no idea how to code for the AI.

    Can a kind soul please guide me, thanks <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Hello Seth,

    Could you give additional information?

    Maybe you could give your enemies "pathfinding" behaviour? I advice you read it and see the examples given with the Construct 2.

    Regards;

    -Wind

  • I have already given the enemies family the pathfinding behavior among others.

    What I am trying to do and failing at is trying to give the enemies limited pathfinding based on distance that they can move since it is a turn-based strategy when all the actors have movement based on how many grids that they can move per turn.

    Basically what I want is that they to move towards the player but at stop within and not out of a set movement range. Currently, I am trying my luck with creating a highlighted path first and then force them to move towards the nearest highlighted grid from the player.

    I would appreciate any advice, thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm not 100% sure what you want, but maybe you could try using the clamp expression to restrict the distance possible to travel.

  • Ok Sethmaster, lets imagine your enemies move in random directions, but you want the distance they travelled to be limited. (I don't want to use a function) In that case, on the top of my head, we can do something like

    find path to (enemy.X + random (-100,100), enemy.Y+ random (-100,100)

    This way they can only go to a maximum of 141 distance. Basically, an imaginary square over the enemies. Maybe this helps or helps you get a new idea?

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