playMaker

Author Topic: 2D enemy Ai  (Read 3976 times)

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
2D enemy Ai
« on: July 12, 2013, 09:24:35 PM »
Hey all, I need a suggestion for the enemy Ai in the game. I have him use move Towards to attack the player and is shooting off raycasts to see if it is grounded/wall in front. It jumps if there is a wall in front but sometimes it may fail in it's attempt and start hugging the wall because it is still trying to move forward.



I am using addforce to make it jump (which sometimes shoots randomly as you can see) so if anyone has any suggestions on how to avoid this or a proper way to achieve the Ai please let me know. If there are also any suggestions towards the combat or anything else to improve that would be great too!

Here you can try it yourself. w/d Left/right to move. Space to Jump. Left mouse to attack.

https://dl.dropboxusercontent.com/u/43466779/Desktop.html
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: 2D enemy Ai
« Reply #1 on: July 15, 2013, 02:42:24 AM »
Hi,

I played the game, I don't see any problems in the behavior at all, it's actually very clean and works reliably. Can you make a screencast or something if you can replicated this? thanks.

bye,

 Jean

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: 2D enemy Ai
« Reply #2 on: July 15, 2013, 03:01:27 AM »
Hey Jean!

If you have him follow you and jump into the left pocket he will do it and get stuck on the wall. The image above is one I took of it happening.

The actions are working okay but I am thinking there is a better way of accomplishing the desired effect so he doesn't stay running into the wall.

Thanks
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: 2D enemy Ai
« Reply #3 on: July 15, 2013, 05:12:52 AM »
Hi,

 ah yes, I see it now.

you should adjust the friction of the material you apply to your character, make it 0, and then it will slide up and down along walls happily without problem.

bye,

 Jean

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: 2D enemy Ai
« Reply #4 on: July 15, 2013, 05:43:27 AM »
Ah of course! Thanks Jean for the help as always.
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

Flying Robot

  • Sr. Member
  • ****
  • Posts: 293
  • Od ton yebo redro
    • Flying Robot Studios
Re: 2D enemy Ai
« Reply #5 on: July 15, 2013, 06:58:49 AM »
You can look into this. The enemies need a little pathfinding.

http://hutonggames.com/playmakerforum/index.php?topic=3961.0