How do I use physics with pathfinding for rts movement?

  • 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

  • Bump

  • 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.

  • megatronx

    Hello,

    Any success on this matter?

    BR

  • megatronx

    Hello,

    Any success on this matter?

    BR

    Unfortunately not :<

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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!

  • 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.

  • 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.

  • 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.

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