1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Traffic Jam

Discussion in 'Programming' started by Ted Gress, Sep 21, 2018.

  1. Ted Gress

    Ted Gress Member

    Joined:
    Sep 1, 2016
    Posts:
    752
    So I know I've posted about this a couple times but I'm not making any headway.

    My enemy character is either solid or not. Fair enough,. When they aren't solid they overlap and go right through the player. When the y are solid they run into each other and get stuck.

    I'm looking for some sort of algorithm I can use so that they will stop when they run into the player, won't overlap, and can move around each other. I've tried making them stop when they collide with each other and bump the other enemy out of the way, I've tried speeding them up on their path but they still either enter a traffic jam or fly across the screen. I'd post some code, but frankly, I don't have an ything that works well enough to post. I basically have some player characters and the enemy brains that float towards the other side of the screen.
     
  2. NightFrost

    NightFrost Member

    Joined:
    Jun 24, 2016
    Posts:
    1,977
    Sounds like you're wanting pathfinding with dynamic collision avoidance. Good solutions to this, I'm afraid, are not simple. At basic level, it means enemies need to be aware of their desired movement direction and all the obstacles nearby (including fellow enemies), then decide which way to move. One thing you could look into is Steering Behaviors - but guides generally expect you to understand basic vector math.
     
  3. Kanugane

    Kanugane Member

    Joined:
    Sep 20, 2018
    Posts:
    24
    I'd personally would experiment with place_meeting function and collisions. It won't be an easy one but at least, it could put you on a right path of solving this issue.
     
  4. Ted Gress

    Ted Gress Member

    Joined:
    Sep 1, 2016
    Posts:
    752
    Does place_meeting work even if one of the elements of the collision isn't marked solid?
     
  5. Ted Gress

    Ted Gress Member

    Joined:
    Sep 1, 2016
    Posts:
    752
    NightFrost: I think I could handle it. I had Linear Algebra in college. Do you have any good links you could share with me?
     
  6. the_dude_abides

    the_dude_abides Member

    Joined:
    Jun 23, 2016
    Posts:
    667
    Go to tutorials and type "steering behaviours" - there's a download, and whatnot, for this topic
     
  7. Ted Gress

    Ted Gress Member

    Joined:
    Sep 1, 2016
    Posts:
    752
    I went to the tutorials and searched for steeeing behaviors but it didn’t find anything
     
  8. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    2,264
  9. the_dude_abides

    the_dude_abides Member

    Joined:
    Jun 23, 2016
    Posts:
    667
    That will be the one....courtesy of IndianaBones
     
  10. Ted Gress

    Ted Gress Member

    Joined:
    Sep 1, 2016
    Posts:
    752
    Got the link and watched it. He cuts out at the end and explains Steering Behaviors but not avoidance,. There aren't any follow up videos.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice