playMaker

Author Topic: AI for SideScroller Help(solved)  (Read 6159 times)

Vink

  • Playmaker Newbie
  • *
  • Posts: 19
AI for SideScroller Help(solved)
« on: December 01, 2012, 10:38:59 PM »
Hello Everyone, i have been following BadSeedGames tutorial on AI, but he shows how to make one for a top down game, i came up with a few ideas and questions revolving his tutorial

PS. Im noob, i find tasks easy with playmaker except for AI, i havent watched all his video's yet, i just want to get it right on the first go, i have learned a lot from his video's but i feel they can be improved a little

the AI for detecting the player:
he uses 3 different types of ways to detect the player, Range, visibilty and FOV, and i assume it uses a lot of processing power if you make a stage full of them, wouldnt it be easier to remove the FOV and range and use a cone type collider as trigger for that? Is there any way to customize a collider shape? if that is possible it would cancel the FOV, range and there calculations and just use a trigger, so it only has 2 conditions that have to be met.

AI for following the player:
I have a couple of issues with this one where to get it to follow the player properly i had to remove the FOV, with the FOV he would stop as soon as i jumped over him an would just stand still doing noting, i tought of adding a second FOV surrounding the the enemy but it would just use 1 more fsm and calculations when using his method.

AI For enemy attack:
He uses 4 different states to perform one attack animation, idle, readying, attack and recover. I managed to do this in one state with one animation, what would be the difference in using 4 instead of just using 1?

If anyone has any templates i could use, advice, or a suggested item in the asset store or video tutorial, i would appreciate it
« Last Edit: December 04, 2012, 07:51:41 AM by Vink »

shinodan

  • Full Member
  • ***
  • Posts: 180
    • Shinozone
Re: AI for SideScroller Help
« Reply #1 on: December 02, 2012, 04:05:47 AM »
Im a bit of a noob too but im using character controllers on my enemys with big triggers either side of the ai, when my player enters the trigger the ai will walk toward him/jump and be annoying using just the char controller actions!

Vink

  • Playmaker Newbie
  • *
  • Posts: 19
Re: AI for SideScroller Help
« Reply #2 on: December 02, 2012, 06:25:57 PM »
Wow thanks i didnt know you could do that, i thought it was just for the player. Ill play around with that now

I figured i could use 3ds max to make the triggers how i wanted it to and add a mesh collider.

I have a problem with the Wandering AI 2 things id like to know how to do, i have it set for the enemy to create its own waypoint on a random location on the X axis and moves towards it, but he creates it behind obstacles and ends up head budding the wall, how can i go abouts fixing this?
And when player goes out of sight id like the enemy to go to last known position, i tried doing this, like storing the position of the player thru the raycast and sending it to a move to state


shinodan

  • Full Member
  • ***
  • Posts: 180
    • Shinozone
Re: AI for SideScroller Help
« Reply #3 on: December 03, 2012, 04:19:04 AM »
I havent worked with raycasts yet but id go about it like this..

For the re setting of the last known position mabye have a get position action at the beggining of the enemys fsm (but not set to every frame) Save it in a vector 3 variable, then have mabye a collision trigger going round the scene, when the collision is active you could use set position action and call upon the vector 3 that was set at the start and it should spawn back where it began.

for wall collision maybe have another variable, this time a float (or bool) set to 0 and named wall collision.
On collision enter set the float to 1, and exit back to 0. If its only certain walls in question then you can tag your collisions to only react between the enemy and the wall.

Now in your enemy's movement cycle you should have actions checking if that the float is 1. and when it is, use actions to maybe turn him 180 degrees and move away. then continue its cycle again?

This is only how i would do it :P without raycasts that is.
I feel answering peoples questions helps me learn too :P

Good luck!

« Last Edit: December 03, 2012, 06:06:50 AM by shinodan »

Vink

  • Playmaker Newbie
  • *
  • Posts: 19
Re: AI for SideScroller Help
« Reply #4 on: December 04, 2012, 05:32:51 AM »
I havent worked with raycasts yet but id go about it like this..

For the re setting of the last known position mabye have a get position action at the beggining of the enemys fsm (but not set to every frame) Save it in a vector 3 variable, then have mabye a collision trigger going round the scene, when the collision is active you could use set position action and call upon the vector 3 that was set at the start and it should spawn back where it began.

for wall collision maybe have another variable, this time a float (or bool) set to 0 and named wall collision.
On collision enter set the float to 1, and exit back to 0. If its only certain walls in question then you can tag your collisions to only react between the enemy and the wall.

Now in your enemy's movement cycle you should have actions checking if that the float is 1. and when it is, use actions to maybe turn him 180 degrees and move away. then continue its cycle again?

This is only how i would do it :P without raycasts that is.
I feel answering peoples questions helps me learn too :P

Good luck!



Thanks Shinodan

You are really helpful :) so i made my AI with just a custom trigger, and on "trigger event" activates the raycast which then detects whether its the player or world object, if its a player it enables a "Chase down and shoot" fsm, if its a world object the AI follows a path i layed out for him, or plays a fun idle animation like playing rock paper scissors with another ai with now fingers :)

thanks for all your help

Damian

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 188
    • Permaximum Betty
Re: AI for SideScroller Help(solved)
« Reply #5 on: December 09, 2012, 07:59:24 AM »
There is a lot of ways to make AI.
Would you like to share what you have done?
It is always interesting to so how other have done.
I am working on a AI now( not finished yet) and I seeking better ways to make it.