How do I expoHow to implement smooth enemy separation (no overlap, no jitter) in Construrt my game?

Not favoritedFavorited Favorited 0 favourites
  • 9 posts
From the Asset Store
HTML5 Game Bundle (7 Games) – Created with Construct 3
  • Hi everyone,

    I am working on an enemy follow system in Construct 3. My current logic is:

    If distance to player > 300 → enemy moves towards the player

    Else → enemy stops

    The issue I’m facing is:

    Multiple enemies overlap each other

    Movement becomes shaky/jittery when they get close

    What I want to achieve:

    Enemies should maintain some distance from each other (no overlapping)

    Movement should be smooth (no shaking/jitter)

    Ideally it should feel like natural crowd movement

    Is there a recommended approach for this?

    (Separation behavior, pathfinding, or custom logic — anything works)

    If possible, please share example event logic or a sample project 🙏

    Thanks!

  • You may be able to get a more organic crowd by experimenting with Boids and Steering Behaviors:

    red3d.com/cwr/steer/gdc99

    In practice you have a lot of things you can tweak to get all kinds of different behaviors. Here's one possible result for a jostling crowd that moves around in groups. Left click to have it pursue the mouse.

    dropbox.com/scl/fi/a1mmcm9ty5hpjrz9hgpx9/boids_test.capx

    In some ways it resembles a crowd but it may be more like a living slime kind of thing. But there is a lot of room to tweak to make it behave differently. Anyways, just an idea that could be explored more.

  • R0J0hound

    I have recorded a short video showing the exact enemy follow behavior I’m trying to achieve. Could you please take a look and let me know if this kind of movement is fully possible to implement in Construct 3?

    I’m specifically aiming for smooth movement with no jitter and proper spacing between enemies (no overlapping), similar to what’s shown in the video.

    Any guidance or confirmation would be really helpful.

    Thanks!

    https://youtu.be/jPdD1-2-GFo

  • Yes it's absolutely possible to make movement like this in Construct.

    You can check out dops example.

    Or check this one out I whipped up. Doing it with physics iirc has better performance but if you don't need many enemies at once (e.g. vampier survivors style), mine will do just fine.

    wackytoaster.at/parachute/encircle_enemies.c3p

  • IT'S EASY, YOU CAN DO IT IN SEVERAL WAYS, WITH PLUGINS OR BEHAVOUR, BUT DIRECTLY BY CODE, PUT ALL THE ENEMIES INTO A FAMILY AND THEN COMPARE IF ANY MEMBER OF THE FAMILY COLLIDES WITH OR OVERLAPS ANY ENEMY AND HAVE ONE OF THEM STOP UNTIL THEY ARE NOT OVERLAPPING, YOU CAN USE THE SOLID BEHAVIOR AND EVEN PHYSICS WITH STANDALONE SO THAT THEY PUSH EACH OTHER. Regarding movement, to prevent enemies from going directly to you, I would use code to generate a trail, an invisible sprite. When I'm near an enemy, the search angle changes to that sprite, and when they're on top of it, it disappears and the search changes to the next one. Here you could use a line-of-sight behavior, or do it another way.

  • You can do this with physics:

    https://www.dropbox.com/scl/fi/b8w45zomhay2o9lfmrqxb/ZombieAiNoOverlapingV3.c3p?rlkey=mcca4hu4xyjyuuzjva6blg848&st=hwgsqeez&dl=0

    THE SOLUTION:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • NECRONOMICRON It doesn't work that well, and starts lagging terribly with a large number of moving objects. My physics example works a lot smoother.

  • You can do this with physics:

    https://www.dropbox.com/scl/fi/b8w45zomhay2o9lfmrqxb/ZombieAiNoOverlapingV3.c3p?rlkey=mcca4hu4xyjyuuzjva6blg848&st=hwgsqeez&dl=0

    Hi, check if this helps you; I designed a behavior for this mechanism.

    https://necronomicron-boids.netlify.app/

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