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.

Code Snippets / Enemy A.I. - Go round walls

Author
Message
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 12th Jul 2005 09:22
Ok, this aint quite finished yet, and it's not the smartest bot in the world but it'll do just now just as a simple enemy.

controls: mouse

in this there is a wall that you can hide behind, and there is also a marker behind you, which changes place after a short while (depending on the intelligence, which you can change), the marker is there so that if the enemy cant see you because your behind the wall then he chases the marker, then once he's got to it he'll see you, letting him chase you (I haven't made that yet because I'm gonna go to bed now, but I'll do that tomorrow)

It's besically my way of letting the enemy know that your behind the wall and give him a path to get to you, I don't really wanna go into A* and algorithms (yet), but this'll do fine.

Tomorrow I'll make it that the enemy only chases you if he can see both the marker and you.

P.S. The intelligence changes the amount of time before the marker changes place, and how far away it is. It can be changed in the source code by changing the "Intel" variable.



Your signature has been erased by a mod because it's larger than 600x120...
Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 12th Jul 2005 12:01
Pretty good man .
You know, you can make a chase game out of that. Without the check although.

Enjoy Life while your still alive.
Enjoy a recees anytime!
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 13th Jul 2005 06:15
yeah, i could do that, but i still think the check would be a good idea, coz say i had two walls to make a corner, and you went round the corner and the enemy was chasing you, he'd be colliding with the corner and wouldn't be able to get round.

Your signature has been erased by a mod because it's larger than 600x120...
Metrion
19
Years of Service
User Offline
Joined: 8th Jul 2005
Location: In the darkest cave
Posted: 23rd Jul 2005 07:27
Hey, is it possible to do pathfinding stuff w/ that?
Blazer
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: United States
Posted: 23rd Jul 2005 09:13
you could make about 10 cubes and every so many seconds (about 3) you plant a cube where your character is. So if your being chased the enemy will follow exactly in your footsteps so they won't hit a wall......just an idea

I discriminate against discriminating people....
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 29th Jul 2005 00:10
Blazer,

That is a good idea, but in the end, would create seamingly dumb a.i. For example, if the player was to run around a box, the a.i. would do the same thing. This would even lead up to the player overlapping the a.i., as when a racecar laps an opponent on the racetrack.

Metrion,

Pathfinding is a slightly advanced approach to finding best path, at any given moment, to a destination. Take a look at http://www.policyalmanac.org/games/aStarTutorial.htm for an awesome, extensive tutorial into the world of a specific pathfinding method for beginners.


+NanoBrain+
Metrion
19
Years of Service
User Offline
Joined: 8th Jul 2005
Location: In the darkest cave
Posted: 29th Jul 2005 00:13
Um, if anyone's interested, IanM's library could be a plausible approach to solve this problem

If practice makes perfect and nobody is perfect, then why practice?
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 29th Jul 2005 00:24
Metrion,

May you give everyone a link to where they can find the library?


+NanoBrain+
Metrion
19
Years of Service
User Offline
Joined: 8th Jul 2005
Location: In the darkest cave
Posted: 29th Jul 2005 00:30 Edited at: 29th Jul 2005 15:50
Sure...

For DBC:
Mattman has created a library... I'm not sure if it works...
http://forum.thegamecreators.com/?m=forum_view&t=33426&b=5

For DBPro:
Search the Codebase for 'A*' without quotes.

Good luck!

EDIT: Btw, i know this is off topic totally, but does anyone here know a bit of java? I'm trying to convert IanM's library (for DBPro) into Java so I can use it for other purposes. I have a small problem... I'll give u a copy of the package if u can help

EDIT [2]: Um, not sure about DBC... just checked the forums again over there and Mattman said that the pathfinding methods wouldn't work...

EDIT [3]: Yeah, I just tried out the library for DBC... it doesn't work AT ALL! Unfortunately, I only have DBC, but other people who have DBPro seem to like the library a lot as it works perfectly...

Btw, if anyone does manage to get the library to work for DBC, could u post the new source here?

Um, off topic again , but does anyone here know how to contact others by MSN on the forums? It doesn't seem to have a link to contact the person... but how do u use it?

If practice makes perfect and nobody is perfect, then why practice?
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 1st Aug 2005 02:33
Metrion,

Hold the mouse over the MSN logo box that is under a user's post. A popup box will appear with their MSN adress in it.


+NanoBrain+
Darkbasic MADPSP
19
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 2nd Aug 2005 19:36
Can you create the code that just make them follow you and shoot at you for and fps

life's a game and a games a life More games at www.freewebs.com/halorc
Metrion
19
Years of Service
User Offline
Joined: 8th Jul 2005
Location: In the darkest cave
Posted: 7th Aug 2005 18:18
Um, I'll try It'll take like a week or so...

If practice makes perfect and nobody is perfect, then why practice?

Login to post a reply

Server time is: 2024-11-23 10:32:48
Your offset time is: 2024-11-23 10:32:48