How do I use physics with pathfinding for rts movement?

Get help using Construct 2

Post » Sat Apr 04, 2015 8:46 am

Hi,

I've seen example some time ago of connected pathfinding with physics, for units not to overlap each other. I've spent long time yesterday searching for it but couldn't find it. Could anyone explain to me how can I do that?

THX
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
75
S
20
G
19
Posts: 1,931
Reputation: 17,134

Post » Sat Apr 04, 2015 10:07 pm

Bump
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
75
S
20
G
19
Posts: 1,931
Reputation: 17,134

Post » Sat Apr 04, 2015 11:09 pm

Hey,

I've never done that but just thought about it. You can retrieve the waypoints from a given path and use the physics to reach them. Once unit arrive (don't know if there's an ever built in condition, or just compare unit position and path's current node) go to the next. The physic movement implementation should be the difficult part, because you will have to tweak forces (in construct itself or from a movement plugin) for you unit move nicely towards a direction to a given point.
B
14
S
4
Posts: 108
Reputation: 1,279

Post » Sun Jul 19, 2015 10:28 pm

@megatronx

Hello,
Any success on this matter?

BR
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Sun Jul 19, 2015 10:46 pm

irina wrote:@megatronx

Hello,
Any success on this matter?

BR


Unfortunately not :<
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
75
S
20
G
19
Posts: 1,931
Reputation: 17,134

Post » Mon Jul 20, 2015 6:37 am

You can also try rex's Push Out of Solid behavior in combination with Solid behavior to make sure units don't overlap, although you'll have to make sure pathfinding is set to custom instead of solids.
B
41
S
18
G
16
Posts: 277
Reputation: 11,179

Post » Mon Jul 20, 2015 7:11 am

Sup with that? wrote:You can also try rex's Push Out of Solid behavior in combination with Solid behavior to make sure units don't overlap, although you'll have to make sure pathfinding is set to custom instead of solids.


Man, and I thought I had all plugins downloaded! Thx for the tip. Rex's stuff is always ace!
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
75
S
20
G
19
Posts: 1,931
Reputation: 17,134

Post » Mon Jul 20, 2015 7:53 am

iw tred that but units are behaving unrealistic... pushing eachother every wich way... :(

only way i think of it that could be done in realistic manner is when units are selected we set that number to variable and on move click we create same number of destinations in certain formation so that each unit targers its own destination (that coordinate save in units variable) spot and than move them in order of proximity... closest starts first and so on.
And then use FOW for speed corrections so when unit has in designated FOW other unit it reduces its speed untill fow is clear... and call that units variable to recalculate path to target.

but i dont know how to set each selected unit to its position in formation... but i think that is the key.
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Mon Jul 20, 2015 6:27 pm

@megatronx

check this example, its quite similar on what i had in mind.
https://www.scirra.com/forum/download/file.php?id=10494
(original thread: https://www.scirra.com/forum/no-name-isometric-rts_t98057?&hilit=units+movement&start=30)
here one can set units to solid when they are not moving and regenerate obstacles.
and when units are moving remove solid behaviour and set some proximity check and when they are too close decrease its speed so they wont colide or overlap...

ill try to produce that as best as i know and if i get good result ill share it.
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Wed Jul 22, 2015 8:26 pm

So something interesting I came across, I plugged R0j0's Chipmunk physics into the RTS template and it seems to work rather well. I didn't do anything besides turning off gravity and just let the default pathfinding behavior do the moving.
B
41
S
18
G
16
Posts: 277
Reputation: 11,179


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, SKYNET96 and 13 guests