9 Replies - 836 Views - Last Post: 13 April 2017 - 09:22 AM Rate Topic: -----

#1 Dialupp  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 210
  • Joined: 31-October 16

Need advice on making enemy ai

Posted 12 April 2017 - 09:47 PM

Hey guys so I am at the last stage of my game. I am making a clone like Super Crate Box and this last enemy ai is completely different to the other ones. Basically from what I see the enemy floats around the map and as the player goes in another direction it follows, but it also seems to float around alot not sure if there are some random elements involved. How should I go to approach this problem? I tried code decomposition so far not helping too much. Not sure if I should use a tutorial sorta feels like cheating or if I should just figure it out.

Is This A Good Question/Topic? 0
  • +

Replies To: Need advice on making enemy ai

#2 nstrydom  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 56
  • Joined: 26-April 12

Re: Need advice on making enemy ai

Posted 12 April 2017 - 10:12 PM

Do you have a default positioning property?
Was This Post Helpful? 0
  • +
  • -

#3 Dialupp  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 210
  • Joined: 31-October 16

Re: Need advice on making enemy ai

Posted 12 April 2017 - 10:27 PM

Don't believe so. I am not asking for code or anything I am currently doing some research now I think I need the mathf.sin function from the looks. I don't use any complicated maths in Unity any courses or anything I should take on the maths aspect?
Was This Post Helpful? 0
  • +
  • -

#4 nstrydom  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 56
  • Joined: 26-April 12

Re: Need advice on making enemy ai

Posted 12 April 2017 - 10:31 PM

Wow, beat me too it. I'm not often great in this area, but my thoughts were not precise positioning values. Also, might be a good idea to have a default rest position. Hope I helped a little, kudos on not wanting code and wanting a small push so you can find the solution yourself.

This post has been edited by nstrydom: 12 April 2017 - 10:31 PM

Was This Post Helpful? 0
  • +
  • -

#5 Dialupp  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 210
  • Joined: 31-October 16

Re: Need advice on making enemy ai

Posted 12 April 2017 - 11:59 PM

Ah ok thanks.
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 5886
  • View blog
  • Posts: 20,092
  • Joined: 05-May 12

Re: Need advice on making enemy ai

Posted 13 April 2017 - 04:05 AM

Moving to game programming...
Was This Post Helpful? 0
  • +
  • -

#7 snoopy11  Icon User is offline

  • Engineering ● Software
  • member icon

Reputation: 1375
  • View blog
  • Posts: 4,308
  • Joined: 20-March 10

Re: Need advice on making enemy ai

Posted 13 April 2017 - 05:06 AM

Flowcharts can help concentrate the mind with situations like this

Posted Image



code each block,

breaking ideas down in this way really pays off as coding each step seems less daunting.

Regards..
Was This Post Helpful? 0
  • +
  • -

#8 Dialupp  Icon User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 210
  • Joined: 31-October 16

Re: Need advice on making enemy ai

Posted 13 April 2017 - 05:17 AM

View PostSkydiver, on 13 April 2017 - 04:05 AM, said:

Moving to game programming...

what?

View Postsnoopy11, on 13 April 2017 - 05:06 AM, said:

Flowcharts can help concentrate the mind with situations like this

Posted Image



code each block,

breaking ideas down in this way really pays off as coding each step seems less daunting.

Regards..

Interesting thanks.
Was This Post Helpful? 0
  • +
  • -

#9 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 5886
  • View blog
  • Posts: 20,092
  • Joined: 05-May 12

Re: Need advice on making enemy ai

Posted 13 April 2017 - 05:40 AM

View PostDialupp, on 13 April 2017 - 08:17 AM, said:

View PostSkydiver, on 13 April 2017 - 04:05 AM, said:

Moving to game programming...

what?

I moved this topic to the Game Development subforum because your question was not C# specific, and that you will likely get better traction in this forum where there are more game programming focused folks.

Good idea looking into the math functions. My approach for this would have been to let the enemy compute a basic vector towards the player, and then add in a smaller vector which simulates the "floating" effect. The smaller vector is simply rotated around a unit circle and scaled appropriately. The rotation is controlled by timer.
Was This Post Helpful? 0
  • +
  • -

#10 snoopy11  Icon User is offline

  • Engineering ● Software
  • member icon

Reputation: 1375
  • View blog
  • Posts: 4,308
  • Joined: 20-March 10

Re: Need advice on making enemy ai

Posted 13 April 2017 - 09:22 AM

My approach would be have the 'move towards enemy' bit slighlty fuzzy ie wander towards the enemy but dont make a direct vector towards the enemy.

I would use a Sigmoid function for the fuzzy bit.

https://en.wikipedia...igmoid_function
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1