Is My AI Suggestion True?

Started by
7 comments, last by cwhite 19 years, 3 months ago
Hallo every body.. I am a C++ programmer,and I work on my project which is Game Engine (FPS Game Engine). of course the AI in games is a complicated subject. I feel it and i have some problem in it. In my engine the AIplayer must do the following basically: 1- walk in the world ( sub area of it). 2- attack the main player (me) when they see me. of course it will developped much more in the future, but now it's enouph. I suggest the following: I use the graph to make the AI player walk on the world. But when they see the mainplayer they will leave the graph and will attack or persuite him by A* algo. Is that simple suggestion suitable? are there any other ways that serve this case which are better than mine? thank you all for your attention.
Advertisement
W/ #1, you could just get it to move around the world (ie. pick random spot within a set area that it should sat in, and go there.)

W/ #2, you just keep doing LOS checks between the NPC and the PC, when you get a good return, just get the NPC to find the PC, and attack them.

Quote:
But when they see the mainplayer they will leave the graph and will attack or persuite him by A* algo.


I do not know what you mean by that. (perhaps explain it fully, in your native language, then translate it? (internet translaters are avalible)). Arabic to english translation service


From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
If I understand rightly, you mean that your NPC will follow a set path until they see the player, and then run towards the player? Sounds like it'll work fine to me. As Nice Coder says, instead of having a set path for the NPC to move along, you could generate one on the fly by occasionally picking random locations for it to walk towards. This makes it less predictable, and so makes it look possibly more intelligent.
Quote:Original post by Nice Coder

Quote:
But when they see the mainplayer they will leave the graph and will attack or persuite him by A* algo.


I'll explaine it.

The AIPlayers are walking in the world by the graph which is designed before,
But when the Main Player be in the Visibility range of the AI Players then the AI players must do some persuiting,attacking and shooting.

the persuiting mean that the AI Players will do pathfinding to the main player and when the Main player be in the shoot range they will fire him.

[Edited by - Sharshour on December 15, 2004 5:45:16 AM]
Ok, i think i got the gist of that (you give your npc's a path, they follow it until they are within los of the player, then they walk up and fire at the player).

Yep you could do that, there are just easier ways.

Like just random pathfinding, or point pathing (your path is just point->point->point. the monster moves off, attacks the player, then moves to the closest point and resumes its little path.)

From,
Nice coder
Click here to patch the mozilla IDN exploit, or click Here then type in Network.enableidn and set its value to false. Restart the browser for the patches to work.
Quote:Original post by fractoid
you could generate one on the fly by occasionally picking random locations for it to walk towards. This makes it less predictable, and so makes it look possibly more intelligent.


I use this way in my game as suggestion, when i weren't have any better idea.
but i expect that (Condition Zero Game) use this way, because i could read some special resource file whitch have some information about the nodes position and the lines between them,

anyway, can you tell me more about generating the pathes (run_time)
and what are the parameters i must use?
are there any articles that i can start from?

You Could try this site which shows how to write a find seek Algorithms between 2 points:

http://www.rookscape.com/vbgaming/tutAO.php

Or this site on how to path find using a pre-created map

http://216.5.163.53/DirectX4VB/Tutorials/GeneralVB/GM_Dijkstra.asp

You talk about following a graph before combat and then using A* once you see the player. A* is a algorithm for finding a path through a graph; the network of nodes you see in Counter Strike bot code defines the graph the AI uses for pathfinding.

Now, can you additionally define a separate graph of patrol nodes. Thse could be treated as destination locations before the AI sees the player. The AI would start use A* on the pathing-search graph to get to one of the patrol nodes. Once there, it would tell him which patrol node to go to next (using the patrol-node-graph). The AI would then use pathing-search graph to find a path to the node with A*.

I apologize if I was a big redundant there. I want to make sure we are talking about two separate graphs.

Now, instead of a predefined patrol route graph, you could just pick random locations. Or you could define tactically good locations to be in, and rules for moving between them. Or any number of other methods for deciding what a good place to be is.

For now though, I would keep this as simple as possible until you have at least a basic system up and running.
This is slightly off topic, but for realism I think it should be brushed on. Once the NPC realizes the target is visible, it has three actions from which to choose: chase, shoot, or chase and shoot at the same time. Deciding which of these to take can have a big impact on how realistic the agent's behavior appears. You could also add variations on the action space, such as hiding or retreating. These aren't easy problems to solve in a natural looking manner, but I just thought I'd throw them out here because they're interesting and work on them can significantly improve realism.

This topic is closed to new replies.

Advertisement