AI help?

How do you put AI in a game? I am trying to make a game where you see a castle from above and move around and I already have the movement from room to room etc, but I need to insert enemies that go towards me if they see me and patrol/move at random if they don’t. Can anyone help?

Allright… So what you are going to line are line of sight lines for your enemies then… Whereever your enemy is facing… He will have an invisible line stick out of him… if that line collides with you… Then they will start chasing after you…

Now… On the random notes. it’s a simple Math.random()*numOptions where numOptions would be how many options the character can take to randomly move around.

That’s why I’m here to help Yeldrab… :wink:

lol… When I went through High school… after trying games in C++… I started noticing the use of Physics and Math alot more… So I took a course in Advanced Calculus and Advanced Physics just to be prepared and thank GOD for that… lmao

Anyways… Invisible sticks should stop extending once they hit a wall… Actually depending on how you want it to look you could juts use grid locaters… Wherever on the grid on is facing the blocks will sort-a become detectors then… Then an array of items inside of that line of data will tell you if you are detected or not :wink: