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.

Author
Message
steve c
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 23rd May 2005 01:37
i have tried for ages and ages to make a decent ai program but i cant and i was wondering if anyone could help me make one i just need him to walk around a patrol area unless you are infront of him then he stops and if gun=2 he shoots at me.
if you can help me on any of this even if its only one bit pls help.
thanks

current projects = codename : tasgarad
despite what it sais to the left joined 5 december 03
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 23rd May 2005 07:32 Edited at: 23rd May 2005 07:32
What is this partol area? Just between 2 points or a field in the game? How do you want him to act, just random walk anywhere and halfway a route change the direction or only change the direction when he is close to an object?

please reply
steve c
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 23rd May 2005 21:06
the patrol are is between 3 points and yea everynow and then change his route.
also if ure infrot of him he stops and if you have ure gun out he shoots at u thanks

current projects = codename : tasgarad
despite what it sais to the left joined 5 december 03
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 26th May 2005 11:38
Start with working out a waypoint system...
Basically, this would be an array of locations that
whenever the critter gets to a location (or near it)
it decides to go to the next location.

When you get that working, Add the guard ? option.
This would pick 3 (maybe) random locations within
a certain distance of the main location, and then move
as per the waypoint system ...

Attacking other critters within range would mearly "pause"
the effective waypoint system during the attack. When the attack is
completed, the critter would revert to the last waypoint system.

So, to do this, you'll also need a list of flags for each activity
that the critter can do, which should have a priority value ...
But that then begins to get complex.... Start with the waypoint system support. Many games never use a "patrol" option except as
a designated waypoint. The AI could get by with just the 3-5 random locations ... Also, in most games, if an order is interupted,
say by an attack as example, the previous order is simply dropped.
That's the easy way out. More modern games will resume when its safe.
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 29th May 2005 21:42 Edited at: 29th May 2005 21:52
steve c,

I have written for you a couple of programs, the second which will demonstrate waypoint guard following. The two snippets below are the two seperate programs. Copy and paste them as seperate .DBA files, but in the same folder.

The first snippet allows you to use your mouse to create waypoints on the coordinates of x and y, within the dimensions of the screen. The second will have a guard walk from waypoint to waypoint, either sequentially(in order from start to finnish), or randomly. In the second snippet, right under the REM statement that says "<<<<<<<<main loop>>>>>>>>>>", is where you want to focus your study on, in which you will be able to learn simple waypoint movement of characters.

Using the first program, the waypoint generator, draw a circle of waypoints. Then, in the second program, the waypoint follower, set the follow type to 1, sequential, and watch the guard walk in a circle. Or, place just two waypoints and set the movement to sequential, and watch the guard patrol a "hallway". Enjoy, and I hope you learn a great deal from this.






+NanoBrain+
steve c
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 2nd Jun 2005 02:09
cool thanks pity you cant just do that in 3d though it would be a lot easier he he, thanks

current projects = codename : tasgarad
despite what it sais to the left joined 5 december 03
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 2nd Jun 2005 03:32
Oh but you can do it in 3D... Just think a little, understand Nanobrains code and let the coding begin!!!

Immunity and Annihalation makes Immunihalation...
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 2nd Jun 2005 22:42
steve c,

My second program above can simply be translated to 3D. It finds the angle between two points, and heads that direction. Once the guard gets close enough to one point, the program then figures the next location(waypoint), depending on the settings either in sequential or random order, the angle between its current and new location, and then heads that direction, until it comes within a certain range of the new location. Then, the loop starts over again.


+NanoBrain+
steve c
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 6th Jun 2005 00:07
cool but can i make my guard guy instead of turning like 90 degrees in one movement which looks so unreal could i make him turn slowly like you would in real life or would that have to be an animation thanks

current projects = codename : tasgarad
despite what it sais to the left joined 5 december 03
bibz1st
22
Years of Service
User Offline
Joined: 2nd Jan 2003
Location:
Posted: 6th Jun 2005 02:02
you could use a radar system eg...
add a simple object ( number 100 for instance ) at your guards position, hide it...

guardangY#=object angle y(guard)
radar_angY#=object angle y(100)

point object 100,waypointX#,waypointY#,waypointZ#

guard_angY#=curveangle(radar_angY#,guard_angY#,20)```change 20 for different rotation speeds

yrotate object guard,guardangY#

hope you understand this and that it helps
steve c
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 13th Jun 2005 03:11
cool thanks i will get back to you if i cant get it working, thanks.

current projects = codename : tasgarad
despite what it sais to the left joined 5 december 03
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 13th Jun 2005 03:38
That way isn't this bad. But when you want to make many guard, it will slow your game down. I made a quick function to solve this:



It's all math...

Immunity and Annihalation makes Immunihalation...
steve c
21
Years of Service
User Offline
Joined: 30th Jan 2004
Location: united kingdom
Posted: 22nd Jun 2005 19:47
cool thanks will use to the best of my ability

current projects = codename : tasgarad
despite what it sais to the left joined 5 december 03

Login to post a reply

Server time is: 2025-05-23 06:12:07
Your offset time is: 2025-05-23 06:12:07