RTS movement problem

For questions about using Classic.

Post » Wed Jan 25, 2012 12:41 pm

I am using LOS and RTS for enemy AI, but I have a problem that after my character moves a couple times enemy is on the top of another enemy it is real problem for my game. How to make them move close to each other if they are following same object, but not to collide between eachother?
B
11
S
3
G
6
Posts: 193
Reputation: 4,229

Post » Wed Jan 25, 2012 1:14 pm

One of the RTS actions should be "Set Object Type To Avoid" - that will make the character avoid the object and its instances. AFAIK, you do not need to refresh the pathfinding grid for it to work.

You could also alter the RTS behaviour manually based on distance checks to have avoidance, but I prefer the first method - much simpler...
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Wed Jan 25, 2012 1:38 pm

Hmm doesnt help.. I guess I'll better post a cap, here it is: cap. I need to make enemies not collide...
B
11
S
3
G
6
Posts: 193
Reputation: 4,229

Post » Wed Jan 25, 2012 1:59 pm

Ah, I see the issue. I've run into it before...
It seems that custom obstacles don't work reliably/at all...

Switch the Pathfinding type to Around "Solid" and give Sprite4 the "Solid" attribute. If you need to toggle the collision, remove the attribute when needed via System actions and regenerate the pathfinding grid.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Wed Jan 25, 2012 2:20 pm

Already tried, this doesnt work well for me... can you edit the cap and post the link to the project here? This would be amazing! :D

link to capMastaZavr2012-01-25 14:24:09
B
11
S
3
G
6
Posts: 193
Reputation: 4,229

Post » Wed Jan 25, 2012 2:45 pm

http://www.sendspace.com/file/xobe0a

I switched the RTS behaviour from Custom to Avoid "Solid" and made Sprite and Sprite4 have the Solid attribute. Based on the way your game is set up, do not give Solid to the actual character sprites. Since they overlap the red sprites, they won't move, as to RTS, they are in a blocked cell.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218

Post » Wed Jan 25, 2012 4:23 pm

When player stops enemies just start to move around themselves...
B
11
S
3
G
6
Posts: 193
Reputation: 4,229

Post » Wed Jan 25, 2012 4:37 pm

Is the code in the cap yours or are you adapting someone elses example?

The enemies move constantly because of the events that adjust the speed of the sprites - the RTS behaviour works against that, thus creating a loop.

Once these are disabled, the enemies stop eventually, but not close to the player - your grid size is set to 60 pixels - as soon as the enemies get within 60 pixels of the cell the player is in they will stop.

Lower the grid size for more precision, but not to less than the enemy size - if you do, the enemies may stop moving at all due to the way the grid is calculated.
B
8
S
2
G
2
Posts: 85
Reputation: 1,218


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests