AI design

Problems building or running the engine, queries about how to use features etc.
tlaloc
Kobold
Posts: 35
Joined: Mon May 03, 2004 5:03 pm

AI design

Post by tlaloc »

Hello!

I want to ask you somethings. I'm trying to make an AI simulator of humans visiting some museum. I'm using Ogre for rendering and blender for modelling. The idea is to set the agents (humanoids) in the museum, lets ssay a guard and a visitor.
The visitor walks through the museum seing the things that he likes more, if the guard see something that the visitor shouldn't do he goes there and talk to the visitor.

There are a severall questions in my mind right now:

1) How can I make the agents see the 3D world and go walk from place to place?

1.1) Note that I want to settle the angle vision of the eyes of the humanoid (which could be different from agent to agent)

2) How can I make my agents and AI program completly independet of the Ogre engine?

I was thinking in putting the Ogre and Ode in the same layer if design, then there's an API which comunicates between the Ogre+Ode Layer and the AI program+agents (wich is in another layer).

Thanks a Lot! I hope that you understand my questions.
User avatar
Antiarc
Greenskin
Posts: 120
Joined: Thu Jan 23, 2003 8:40 am

Post by Antiarc »

1) Either standard pathfinding like you see in RTS games, or set "travel paths" that the the agents follow throughout the museum with some randomized variation.

1.1) Not a problem.

2) Just write your classes that do AI, and then on each Ogre frame, step your AI procedures and update the position of the models in the engine.

You shouldn't need ODE, since this isn't really player-controlled - bounding box collisions should be sufficient.
tlaloc
Kobold
Posts: 35
Joined: Mon May 03, 2004 5:03 pm

Post by tlaloc »

Antiarc wrote:1) Either standard pathfinding like you see in RTS games, or set "travel paths" that the the agents follow throughout the museum with some randomized variation.

1.1) Not a problem.

2) Just write your classes that do AI, and then on each Ogre frame, step your AI procedures and update the position of the models in the engine.

You shouldn't need ODE, since this isn't really player-controlled - bounding box collisions should be sufficient.
Another question. Where should I put the pathFinding algorithm? The best choice, for me, should be in the AI classes to make it indepent from Ogre (so if I change the Render Engine It is done in the AI classes), but How can I do it indepently from Ogre? Because I need to make questions to the render engine like: what does character B sees? What objects are there? what must I avoid? etc...
I'm steel a newbie to this kind of work, so my apologies if my questions seems to stupid or to easy.
Thanks for the ODE tip ;).
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4

Post by tuan kuranes »

PathFinding algorithm could find a warm place in a PathEngine class that know more things that player should.
Some can place it in an AI class from which guard and visotor inherits...
But most pathfinding Data doesnt' belong to these classes.

Precalc' path, path already used, path that interesect each other (guard walking on visitor ?), influence map, etc....

just call a PathEngine::findPath with
start, end, vision angle, vision distance, and speed.

some links that could help
In your case : http://www.cgf-ai.com/
More general : http://www.ogre3d.org/phpBB2/viewtopic. ... 1006#41006
Last edited by tuan kuranes on Mon Sep 13, 2004 7:06 pm, edited 1 time in total.
tlaloc
Kobold
Posts: 35
Joined: Mon May 03, 2004 5:03 pm

Post by tlaloc »

tuan kuranes wrote:PathFinding algorithm could find a warm place in a PathEngine class that know more things that player should.
Some can place it in an AI class from which guard and visotor inherits...
But most pathfinding Data doesnt' belong to these classes.

Precalc' path, path already used, path that interesect each other (guard walking on visitor ?), influence map, etc....

just call a PathEngine::findPath with
start, end, vision angle, vision distance, and speed.

some links that could help
In your case : http://www.cgf-ai.com/
More general :http://www.ogre3d.org/phpBB2/viewtopic. ... 1006#41006
Thanks for the topics! It is a good help. I guess the ideal is to have some class or function like WhatISee() which returns what the agent sees. then acordingly with the agentes mood, it goes to a specific place -> PathEngine::findPath(whatIsee[0]). How can I open the eyes of my character in the Ogre frameWork?
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4

Post by tuan kuranes »

rayscenequeries lets you test visibility using ray test.

Pretty computational way to do so, you'll have to discretize the number of ray you want to query by some simplification.

But if you have static envirronement, you'd better precaculate what agent can see or not from one place .

The half-life paper in the topic is just about that.
tlaloc
Kobold
Posts: 35
Joined: Mon May 03, 2004 5:03 pm

Post by tlaloc »

tuan kuranes wrote:rayscenequeries lets you test visibility using ray test.

Pretty computational way to do so, you'll have to discretize the number of ray you want to query by some simplification.

But if you have static envirronement, you'd better precaculate what agent can see or not from one place .

The half-life paper in the topic is just about that.
The RaySceneQueries remembers me the paper of the renderware -> blind man with a stick.
My characters needs to see the obstacles, the moving objects (to avoid collisions with another agents), and needs to now what objects are seing so it could decide to wich object is it going to interact.
Let's say a museum and the agent sees a sculpture and a painting. He goes to the painting since he prefers paintings..
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4

Post by tuan kuranes »

If you read the renderware paper, what they call "The 3D topology dynamic analyzer" is the mechanism that the half-life paper explains. (I think it originally comes from a gamedev or gamasutra article on visibility)

It need a static world. but people and object can move. It's occluder that can't, like walls... so if your walls aren't destructible and your museum map doesn't have moving walls, that method is the best choice (fastest above all)
tlaloc
Kobold
Posts: 35
Joined: Mon May 03, 2004 5:03 pm

Post by tlaloc »

Is there any example on how to use ray queries?
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4

Post by tuan kuranes »

Search 3d picking in the forum.
janders
Gnoblar
Posts: 15
Joined: Wed Oct 09, 2002 12:13 am
Location: My backporch, Minnesota

Post by janders »

If you want an little more accurate depiction of what an agent sees, you can also use a frustum to query the scene, rather than a ray.
tlaloc
Kobold
Posts: 35
Joined: Mon May 03, 2004 5:03 pm

Post by tlaloc »

janders wrote:If you want an little more accurate depiction of what an agent sees, you can also use a frustum to query the scene, rather than a ray.
How can I use the Frustum to query the scene????
janders
Gnoblar
Posts: 15
Joined: Wed Oct 09, 2002 12:13 am
Location: My backporch, Minnesota

Post by janders »

Get the planes from the frustum, and use a PlaneBoundedVolumeQuery.

Jon
TorqueMaster
Gnoblar
Posts: 7
Joined: Thu Dec 16, 2004 3:14 pm
Location: Mumbai

help regarding pathfinding

Post by TorqueMaster »

Hi,

I am working on having my agent in the game path find their way. I have not been able to figure out how to apply the path finding algorithm A* to the my level which is a .scene file exported from 3D Max.

Any ideas,

Thanks,
Asif
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4

Post by tuan kuranes »

It's all about pre-process you scene to something usable by a pathfinder :

Polygon Soup for the Programmer's Soul: 3D Pathfinding :
http://www.gamasutra.com/features/20020405/smith_01.htm

some AI sdk provide those pre-process step, but all that does are very costly.
WanabeCoder
Kobold
Posts: 26
Joined: Sun Jan 09, 2005 11:04 pm

Post by WanabeCoder »

Erm.. i dont know the capabilities of ogre, but couldnt you basically define certain points (call them waypoints) in the map, like, a whole array, and use a random integer+case to decide where they would go? Wouldnt be very intelligent, but it would still be half decent.

Dont know how you would actually get them to WALK there, but hey, Im still having technical difficulties with t3h engine.
User avatar
eugen
OGRE Expert User
OGRE Expert User
Posts: 1422
Joined: Sat May 22, 2004 5:28 am
Location: Bucharest
x 8

Post by eugen »

What tuan tries to say is that u need to make your own data structure to use it as a map in which u can look whenever u need to take an AI decision! OGRE (for all i know) doesnt have anything related to path finding...anything u'll do, regardless using OGRE data structure or not, must be done by hand !!
u can actually make a wise AI just using waypoints (depending on the game u're programming) and some parameters for decision making and maybe some free action on key events (ex: spot an enemy)...but the ai implementation should come after u got your engine in place...i'm thinking right now u'll need a map editor to define all this waypoints...or maybe u'll need a script language!
good luck!
WanabeCoder
Kobold
Posts: 26
Joined: Sun Jan 09, 2005 11:04 pm

Post by WanabeCoder »

I thought OGRE had a map editor >.>
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4

Post by tuan kuranes »

Yep. (my sentence wasn't very clear...)

You need to generate an special data file containing info needed by the pathfinder. (real-time analyzing a scene using raycast cannot be done real-time)

Here's a sample of how to achieve it :

Shockwave demo :
http://station-zero.com/medion/demos/pathfind.htm

Director source :
http://station-zero.com/medion/demos/pathfind.zip

The article it's based on :
http://www.gamedev.net/reference/articl ... le1841.asp

The thread I found It :
http://3d.5341.com/msg/2293.html
TorqueMaster
Gnoblar
Posts: 7
Joined: Thu Dec 16, 2004 3:14 pm
Location: Mumbai

Post by TorqueMaster »

Thanks all of you for the help ... Ill be implementing a dummy AI using waypoints and develop a better by creating a directed graph later ...

Asif