- Home /
Enemy turn AI
I want to create game like risk or something else. And faced with enemy AI problem. Question is how to make enemy turn that computer sothing do(send army to citys, attack other player or change military size) link text
Answer by feydfeyd · Feb 16, 2013 at 07:10 PM
There are different ways to do it. The question you need to ak yourself is, waht I want the AI to do, and then just do the actions.
For an AI, you will mainly have to know how should look your algorithm. How the computer will make the choices, and based on what.
Starting with a Risk-like gasme might not be the easiest way to start.
Here is simple map. How from (10 points) send to player land then mouse press on it. And how calculating points who gets every turn. Sorry for my bad english.
One more problem. How need to take variables from all scripts who have GameObjects tag "Player"? (Example = cube and square they have scripts (each other)with (static var Points : int;) and both have tag "Player". Now I need use these variables in calculating. How take them?) Please help would be realy nice :D
if the variable is static then first there is only really one of them for all instances of the script (please consider this)
second as long as the variable is public static (UnityScript does this by default), and the class is compiled at the least on the same assembly then all you have to do is ClassName.staticVar, and you can access the value. though you might want to insure that the value is only changed independent of things like Update(), or OnGUI()
But how take it from tag with "Player". (And how exactly be tag there is no known, becouse Player conquer land and get more points)
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Enemy turn AI 0 Answers
Ai for Enemy 0 Answers
A beginner's questions!!! 4 Answers
Make ball remain in front of player during player movement 1 Answer