Create Enemy AI in TBS?

Get help using Construct 2

Post » Sat Aug 31, 2013 4:52 pm

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
B
36
S
18
G
11
Posts: 248
Reputation: 8,694

Post » Sat Aug 31, 2013 5:28 pm

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
B
18
S
4
G
1
Posts: 332
Reputation: 3,149

Post » Sun Sep 01, 2013 3:21 am

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
B
36
S
18
G
11
Posts: 248
Reputation: 8,694

Post » Sun Sep 01, 2013 9:12 am

I'm not 100% sure what you want, but maybe you could try using the clamp expression to restrict the distance possible to travel.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Sep 01, 2013 1:49 pm

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?
B
18
S
4
G
1
Posts: 332
Reputation: 3,149


Return to How do I....?

Who is online

Users browsing this forum: batto and 24 guests