Page 1 of 1

How exactly do you make the perfect AI?

PostPosted: Mon Jul 31, 2006 12:09 am
by The achievement
Just a question, my way doesent really seem to work. what do you guys think?

PostPosted: Mon Jul 31, 2006 12:46 am
by DilloDude
The AI script is different depending on what you are making. A simple enemy might just move back and forth, a slightly more complex one might chase you, and a really complex one might decide when to move away, when to folow you, when to shoot etc. To make AI you really need to decide what you want it to do in which circumstances.

PostPosted: Mon Jul 31, 2006 2:13 am
by The achievement
Yeah what i wanna do is when i open the door, the enemy heres the door opening and then he starts chasing you. ive done it before, but i forget now. and by the way, dillodude your game looks really good.

PostPosted: Mon Jul 31, 2006 1:08 pm
by relaxis
lol,
you would need to work out the x,y, coordinates of the enemy on the screen and then create some kind of a conditional on the door.
____________________________
| ........................|.......................|
|.........................|.......................|
|.........................|...................... |
|.........................|.......................|
|.........................|.......................|
|.........................|.......................|
|...E....................|...............D......|

E= Enemy D= Door

So work out the coordinates of E and then divide the screen in half. If the door is opened when E is on the left handside then he doesn't hear. If the door is opened on the right hand side then he does hear.

pseudo code
(for simplicity let us say that x and y go from 0 to 10)
Code: Select all
 
getcoordinate x = x
getcoordinate y = y
//define
opendoor()
if x,y > 5,5
then make enemy chase actor

else
do nothing.


I hope this helps. It's ok by the way to be a newbie and not know any programming code but if you lie and say that you know how to do it then people will just tell you to go away and do it yourself until you can remember. You don't just "forget" code.

PostPosted: Mon Jul 31, 2006 5:49 pm
by The achievement
i did this once with the help of one of the people on the forums. i just forget where he posted it. i tried searching everywhere. thanks anyway.