Rts pathfinding

This forum is currently in read-only mode.
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • I have a fairly large map that Im using the rts movement on. The problem is that I have a collision event that tells some objects to move to another object way on the other side. When that happens there is a huge dip in performance as the objects try to calculate the path.

    So I was wondering if there was any way I can get some improvement on this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My only solution thus far has been to use a waypoint instead of move to object.

    This gives a few new problems tho...

    You have to dummy down the obstacles, as the pathfinding isn't nearly as good.

    Then it seems that waypoint means the same thing as move to position, so my events that use on arrived at waypoint are messed up with events that use move to position.

  • What exactly are the events? The actions to move objects with the RTS behavior runs a potentially CPU intensive search. They are only designed to be called in triggers or one-off events - if you are calling them every tick unecessarily, you will waste CPU for no extra pathfinding benefit.

  • Initially I was using

    family.sprite on collision with thisbasesprite

    family.sprite2 move to thatbasesprite

    Now I realize that with a family there is a chance of multiple triggers so I tried it with only one object hitting the base... same result.

    Im pretty sure the slow down is due to the fact that its sending multiple objects at once, and that the distance is pretty far away, layout's 3000x 3000.

    The move to waypoint has no slowdown what so ever, even with multiple hits, but the fact that its treating move to position the same as a waypoint is really what messes that up.

    What would be nice is a difference between the two, with an additional call like on arrived at position.

    BTW I haven't tried on arrived at target, but I assume that's the same as position.

    Any way I just need waypoint's to be handled separately from a position.

    Also I'm still getting some hinkey results when using families that contain objects belonging to other families.

    Something like family tank has tanks, family cannon has cannons, and family artillery has both.

    If I tell family artillery to move somewhere, it works fine, but if I do something like get an object count it only gets one side of the family.

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