Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by RickyX · Mar 06, 2014 at 02:12 PM · artificial intelligencezombies

Zombies AI

So i'm making a zombie apocalypse game, about 3 months now, a lot of things are done, everything is perfect, so now i want to make a script for zombies to attack me when they see me... I want to ask you guys, what do you think is the best way to make AI for them ? What should i use, any ideas ? I was thinking about using raycasts going from zombies eyes to ground, or something like that, so i just want to know what do you think is the best way to make it.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Mulldor · Mar 06, 2014 at 02:27 PM 1
Share

If you are making a 3D game, use a frustum* camera combined with Vector3.Distances to check if they see you or not. Then if they detect you, simply use a Quaternion with lerping to rotate towards player, and move forward. Repeat until player reached or he runs away, where they then continue on a randomized path

avatar image RickyX · Mar 06, 2014 at 03:15 PM 0
Share

Yeah i will try that too

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Calum-McManus · Mar 06, 2014 at 02:35 PM

This should really be in the forums but I may as well answer it while it's here! There are many different systems you can do this but the way I tend to do it is to have different modes the Enemy can be in, so something like this:

  1. Idle (Idle animation on the spot)

  2. Wondering/Patrolling(Following a way point system)

  3. Alerted(Something happens e.g. hears foot steps, and changed course to check out the noise)

  4. Attacking(Walking towards you, use Vector3.Distance so it stops near you and begins its attack and repeat)

For zombies it can vary as different zombies may have different ability's (Thinking like Left For Dead) or just normal generic dumb/aggressive zombies that will attack a tree if it makes a noise xD this system makes it easier to change later on as well if you make a good waypoint script as it can all run from that one script and just changing the state of the AI and the next way point it must go to! GoodLuck!

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RickyX · Mar 06, 2014 at 03:14 PM 0
Share

Thanks for your answer, and yeah i had to put it on forums not here, my mistake.

avatar image
1

Answer by ReaperMK · Mar 06, 2014 at 03:24 PM

Wandering scripts are very useful for this type of situation as stated by Mcmanus... I also recommend checking out bird flocking behavior to make your zombies seem more in tune with each other. In most zombie films you see groups of zombies flocking together tearing through towns and eating brains - use media and film to define a style of zombie you want your game to portray and define the movement using these references. Flocking behaviors are great as well as wandering, vision systems, and alerted systems. Typically you can define a radius in which the zombie will agro but it can also help to have alternative alert systems so the player does not get too accustomed to a particular radius and kite the zombies all the time. Having varying zombie movement styles, alert types, and movement patterns can increase replay value as well as difficulty and realism.

Raycasting is not a bad start - I used this for a stealth game at one point and it is a very good way at simulating vision area if coded properly.

Hope this helped! -Mitch

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RickyX · Mar 06, 2014 at 06:47 PM 0
Share

Hmm. Really interesting idea, this one's the best idea in my opinion, thank you.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple enemy AI using the same animations/animation controller 1 Answer

Friendly AI that follows player and shoot zombies. 1 Answer

How to make enemys do damage and you dying etc 1 Answer

Pathfind - Scripting help 1 Answer

How can I use Unity FSM for my in-game behaviour? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges