- Home /
How to make AI look like swat team members?
Hello everyone. Im a noob at unity 3d. I am currently making a FPS game in unity 3d. one thing Im having trouble with is AI.
What I want to do is make some AI that look like swat team members or police officers. I already know how to make robot enemy, but they look so dull and boring. I want a swat team member (I already have a model) to look and shoot a machine gun at me when I attack him.
Please I am dying to know how to make enemys like this. If anyone could give a good and specific step by step answer, i would really apprciate it. Thanks you guys!
As $$anonymous$$atthew says, this is a gigantic problem, you need to start smaller. Break your problem into components and start solving them one by one. $$anonymous$$G. (-First Step get a model to appear correctly in game, -Step Two get an animation working on the model, -Step Three get an animation to fire from a script, Step Four, Start working on the AI (which is a huge set of more steps.)
There's nothing really wrong with this question. I flagged it for close just because its getting off topic and the discussion isn't relevant.
Answer by Peter G · Feb 13, 2011 at 10:28 PM
This tread is getting really strange, so I'm going to end it by answering it. :)
Creating an AI routine isn't easy. There are a couple things to consider:
I'll start with the easiest. Animating your model isn't very challenging. You can play an animation simply by calling
animation.Play("AnimationName");
The only trick is coordinating it so that it works with the characters motion. Unity put out an IK solver called "Locomotion System" that will take your FK and place feet on the ground and such.You can divide the AI tasks multiple ways; for simplicities sake, I'm going divide it into pathfinding and stimulus response.
Pathfinding is very complicated and people have written entire books on it. The robots use a simple waypoint system. Another popular method is A* (pronounced A-star) Aaron Granberg and AngryAnt have implementations of A* designed for Unity that you could look at. A simple search for pathfinding on the web will bring up loads of examples.
Responding to stimuli is another aspect of AI routines. This ranges from extremely simple to highly complex. Something like the robots in the FPS tutorial are very basic. They just check to see if the enemy is within "x" meters of themselves. If you want the NPC to account for the environment, then you have even more calculations. Such as the player being outside their field of view, or behind a wall. Using the environment is another wrinkle, hiding behind walls all add more complicated algorithms.
Flocking requires awareness of other NPC's and that can be expensive. The Unify Wiki has a flocking algorithm that could be modified to let enemies work together.
If you can do all this, then your in good shape. Otherwise, I suggest that you learn to program, read a book on the logic behind AI programming, and get to work. :) One of the biggest problems you will find is the performance hit from iterating through all the data needed.
I would also recommend checking out developer websites. Plenty of big devs such as Valve and Bungie publish presentations of various topics such as AI.
Here's an example: http://www.valvesoftware.com/publications/2009/ai_systems_of_l4d_mike_booth.pdf
there is also a question $$anonymous$$e that is about the advanced AI http://answers.unity3d.com/questions/35421/online-advanced-aiartificial-intelligence-with-js
Answer by Matthew Weitzel · Feb 13, 2011 at 05:15 PM
Sam, you are asking questions in a way that Unity Answers is not designed for. If you have a technical question and you have given it your best shot, then a specific question can be given a specific answer.
The questions you have been asking are very broad and imply you either have no idea what you are doing or expect someone to put together a tutorial for you, holding your hand and walking you through step by step. I don't know if you realize that something of that nature takes hours of time to create. And it looks like someone were to hold your hand and walk you from where you are at to where you are trying to go, it could take years, there is no quick easy answer.
Are you willing to dedicate years to the cause of being able to make and interactive experience for another? If that is case, then please be satisfied with my answer to this question as "its not as easy as you think".
I could give you directions to Carnegie Hall, but that wouldn't get you in. Practice will get you in. Right now you are standing outside with a cello you found and nobody can tell if you have even tried playing it.
Did you make this model? Do you write code? This link is pointing at someone else's portfolio, that's not OK. How many hours have you spent developing games? If you are actually serious, I will try to point you in the right direction, but you have to know the right direction is an unbelievable amount of work in a certain (or multiple) area(s) that everyone here has gone through. It's a long way to the top if you wanna rock and roll.
Answer by sam 1 · Feb 13, 2011 at 06:16 PM
Ive been working with unity for about 6 months. im sorry, i dont write down how many hours everyday i use unity.
another thing, I know its not easy doing this. and I know you guys cant answer this my question with a quck solution. but something you guys can do is at least try to help me somehow. you dont have to write a tutorial but maybe you can give me a link on a tutorial. or maybe you guys can suggest something. another thing. i have my own model of a swat team member. i dont know who told you that picture was my model, but its not. I never stated that was my picture/model so learn to read please. but i have my own model. it dosent matter who made it so im not answering your question about if i made the model or not. and i dont unerstand what you mean by"did you write code?" which dosent even make sense. i told you guys im sort of a noob at unity and that i needed some help. if you guys dont wanna help, then dont bother answering my question. but if you do wanna help, please give me a good answer to my question. not a 5 paragrapgh essay on why Im asking this quesion
maybe your not new to unity itself, but I think your new to unity answers because, first, make your questions more specific, second Peter's answer is just a very good answer, third, it doesnt matter you have 6 months into Unity, I have been into unity for 2 years and I can tell you I only know the 30% of Unity(Unity is a complex program that handles many things), and fourth, that you just put is a reply not answer and that kind of things need to be in the comments not in the answers, hope this reply help you know how to make your questions and answers :P.
@Uriel. I agree with everything you say, I would like to point out though that you cannot comment on other's posts until you get 15 reputation.
Your answer
Follow this Question
Related Questions
Enemy AI Problem: Dancing? 1 Answer
Shooting Damage Help 1 Answer
Complete AI Tutorial? 1 Answer
2D Random AI 1 Answer
free roaming enemy ai 1 Answer