Pathfinding Routines

TobyToby Member Posts: 478
edited November -1 in Working with GS (Mac)
Need some pathfinding behaviors. Currently my enemies get stuck behind scenery when chasing me. Can they search for the shortest path around the obstacle or keep going moving left or right until the object is passed?

Comments

  • TobyToby Member Posts: 478
    I have a rough solution. Basically create a game Boolean attribute first.
    Then a rule saying if enemy actor's motion is less than 50, move to vertical random(500,-500) and horizontal (500,-500). Eventually the enemy finds it's way past the wall object and continues toward the player target x,y.
  • TobyToby Member Posts: 478
    Have a reasonably good technique for creating enemy path movement and behaviour. Create your enemy character and 2 or 3 circle graphics. Constrain the 2 or 3 circles to your enemy XY character first, then assign some different on collision player behaviors to each circle. The circles should be changed to be different sizes. The largest circle should tell the enemy have a random(500,-500) movement applied to the x,y axis, this creates a wandering behaviour. The inner most circles should have an enemy player accelerate toward behaviour applied which moves the enemy to the players x,y co-ords. You will need to define the player x,y attribute s (integer) and a few Boolean attributes for the ring behaviour in the game attributes. So, when the rings collide with the player different behaviours are presented by the enemy - eg more agressive, change graphics to look angry etc. Anyone have any better ideas?
  • harrioharrio Member Posts: 234
    what's cookin,

    hey toby, i read over your example a couple of times to get it into my head. i don't know if this is better or not but here it goes...

    you could have four zones/buffers that surround the enemy actor. the enemy has a move/accelerate towards player rule that is interrupted only when one of the zones collides with anything other than the player. when it does, the player moves for a set time in one of the other three directions, then it continues it's move/accelerate towards the player.

    i think this would make it bump around until it found open space to continue pursuing the player. you could even give it rules like remebering which buffers were recently hit and not going in that direction immediately again.

    well, at least in my head it seems like that. i might have to try a mock up to see if it actually worked decently.

    there ya go...my pinch of parsley...noodles
  • MillerEPMillerEP Member Posts: 22
    You can try having the scenery and actor in different layers. When something new spawns, it spawns on the top of it's existing layer. if you create multiple layers for depth, than you can put non-collidable objects in the foreground so they can run behind it undeterred.
Sign In or Register to comment.