Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / I need some Artificial Intel Plz

Author
Message
Obee Wan
20
Years of Service
User Offline
Joined: 27th Feb 2004
Location: The Daegoba system
Posted: 14th Mar 2004 16:39
I need some AI for a game I am working on. I need the AI to work on the following paramiters:

When the object this is applied to "sees" the player, it is alerted.
It shoots at the player when it has the opertunity
It runs at a pre-definbed speed.

Your help would be most appriciated. If you do this for me please comment your code well so I can make adjustments because this AI is going to be applied to all of the guards. Your name will also be in the credts under "Special Thanks To"!

Use The Force Luke!
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 14th Mar 2004 17:50
Oh dear oh dear oh dear.

First, its "Dagobah" not "Daegoba". Secondly, its "Obi Wan" not "Obee Wan". Thirdly, "Obee Wan" did not live on "Daegoba" (sic). He lived on Tatooine. Fourthly, you have posted what is known as a "give me da codez!" message. This is the height of newbness I'm afraid. Even if someone were kind enough to give you "da codez" it is unlikely that code would work in your game (variables won't be the same, etc.) Essentially, you should try and think of a solution to the problems you have outlined above yourself. This is the way that you will learn. If your solution does not work, then you should include the code in your post and then people can help you by commenting on it.

Lets take the first of your problems to illustrate how you might go about solving it. Your object in question probably has a viewing range which it can see. Presumably it can also only see what is immediately in front of it and a specified angle to the right and left of that - the viewing frustrum. Now then, what you need is some code that tells you whether or not the player falls within that viewing frustrum. If the player does, then you might activate a variable for the object to "alert it". For example: if player_in_object_frustrum() = 1 then object_alert = 1

If your game is effectively 2d then finding out whether the player is in the object's viewing frustrum can be solved using trigonometry.

etc. etc.

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P1.3ghz / 384 megs / GeForce MX 5200 128meg / WinXP home
Obee Wan
20
Years of Service
User Offline
Joined: 27th Feb 2004
Location: The Daegoba system
Posted: 14th Mar 2004 22:06 Edited at: 14th Mar 2004 22:09
I don't want to offend butunless you are Goerge Lucas you need to mind your own buisness because I was just having fun.

Use The Force Luke!
Tim Ballisto
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Right behind you.
Posted: 14th Mar 2004 22:34
look up these commands and start from there

Move object
Set object to object orientation

and use this formula for calculating distance

Distance=sqrt((object position x(1)-object position x(2))^2 + (object position y(1)-object position y(2))^2 + (object position z(1)-object position z(2))^2)
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 15th Mar 2004 07:18
Yes. I was also having fun.

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P1.3ghz / 384 megs / GeForce MX 5200 128meg / WinXP home

Login to post a reply

Server time is: 2024-09-22 00:25:17
Your offset time is: 2024-09-22 00:25:17