RTS Style Collisions - Preventing Overlapping Qualifiers

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hello Team,

    I have searched for qualifier collision/movement based objects from Anders, pathfinding examples to prevent overlapping qualifiers controlled by "AI", coming to a conclusion that I must post. The movement is fluid to the destination when normal parameters are set. However I would like the path to control like zerglings in Starcraft or any other RTS. The zerglings in Starcraft stop movement when colliding against another zergling, when performing any basic movement function. However, they continue their natural movement towards the object- even if they run around a stuck zergling. I understand it gets astronomically complex after that, but I am looking for a simple solution. One which if the enemy gets stuck or stopped upon the same qualifier, it will just continue the path in front of it once the collision is clear. My theory is that I will have to create a "bubble" around the character and treat is as a collision detector to separate same-qualifier issues?

    I prepared a rough example.

    Example one in the picture is the fluid overlapping or stacking of enemies towards player.

    Example two is the issue when I condition same-qualifier overlapping with any directional change. They seem to wiggle dance to the destination at random directions. I understand the problem, but trying to display my conviction towards the issue. Thanks and my apologies if I missed a thread with this solution.


    Please login to see this attachment.

    EDIT:: I found Anders' Flocking Object. This looks like exactly what I needed. I will re-post if necessary or if my search on forum: flocking becomes null.

    Thanks!

    Edited once, last by wickjamesgtar: Found Anders Flocking Object (May 28, 2015 at 7:40 PM).

  • I'd also suggest searching for the terms 'Pathfinding' and 'A* Pathfinding', that should bring up some more info.

    With pathfinding/flocking I would imagine that the complexity and amount of processing that needs to be calculated will increase more and more as you add more enemies/obstacles that need to be taken into account. In my project I decided against using pathfinding to make units walk around each other, I went for an extremely simple method of preventing enemies that are moving towards the same position from overlapping, and that was by adding some random variance to their movement. Whilst this might not be appropriate for all units in a RTS game, it might be appropriate for some of them, and could be used for a small performance gain for things such as certain flying enemies.

    You can see how it looked before and after in my dev log post here:
    Please login to see this link.

    SUPER MEGA BEST CAT ADVENTURES Please login to see this link. and Please login to see this link. live now!

  • PBarwick, thanks for your reply. Although I do appreciate your example, I was able to successfully solve my problem using only the Flocking Object. It is absolutely brilliant. In contrast to your example, the units stay separated during the "agro" process and idle while their destination has been reached. The random variance in +/- degree was something I was tampering with prior to finding the Flocking Object by Anders but found the code difficult to distinguish individual enemies. I tested the Flocking Object with 50-100 objects and only saw a ~5 FPS scatter.

    Please login to see this attachment.

  • No problem, my idea is a very simplistic take on a solution, which doesn't really solve the problem properly in your situation. I always like to think of alternatives, especially when they would give a reasonable performance increase.

    Flocking is definitely the way to go for most if not all of your units.

    Looking at your image, I noticed that some of the cubes overlap others in what seems to be the wrong order. If you use the layer object you can force all the object instances to overlap correctly:

    - Always:
    Layer object > sort by Y decending

    This will put the active objects at the top of the frame at the back, and those at the bottom of the frame at the front.

    SUPER MEGA BEST CAT ADVENTURES Please login to see this link. and Please login to see this link. live now!

  • PBarwick, thanks for that tip. I had to do IF: XQualifer overlaps XQualifier (they are duplicates within an "enemy" qualifier) THEN: Decrease Ysort. Duplicates and qualifiers seem to need narrow commands.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!