Ideas about AI helper tools.

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Ideas about AI helper tools.

Post by christianclavet »

Hi,

A previous post gave me some idea that I'd like to share. This could be developped in the future.

Here is the post: http://irrlicht.sourceforge.net/phpBB2/ ... 229#132229

About the AI. I'm not talking to integrate AI into Irrlicht, but only some helper tools to start integrating AI.

Here is the basic idea about the tools that could be developped:

Motion Path planner:
A function that would do a spline from point A to B and also align the camera position (rotational value). This could be used in about every kind of game or visualisation. It could have a boolean to restrict the Z axis alignment of the object (Airplane or car or people) We would have then to use that spline to move the object, or camera. It should have some functions (like a collision response animator sphere) to not go thru walls or thing that are in the metaselector.
EDIT: I just found out from the thread that there is already a library for that "OpenSteer for pathfinding". So perhaps a good wrapper for it...

This would then be applied to a splinemotion Animator to the specified mesh.

So if the AI decide that the object must flee, or attack, it would be of a great help.

PlayerInView function:
This would use a standard camera that could be parented to a mesh. (Car, airplane, ennemy player). This camera is defined like usual. But the function will take the node as reference (That way it could have the FOV for that.)
It would only give a TRUE if the player node is in the view of that camera. (So if the player is hidden behind a wall, this should return false)
This could be called like this: PlayerHere = PlayerInView(EnnemyCameraNode, PlayerNode);

HitByPlayer function:
This would return true, if the defined node is "hit" by the specified projectile node or object node. Could be called like that:
Ennemy1Hit = HitByPlayer(ennemy1Node, playerbulletNode);
So with this, we could see if the ennemy is hit by a projectile then to the proper AI for it (Ragdoll, sound, life meter decrease etc). This could be done using a bounding box test for each object first then triangle test.

Another tool that could be useful:
InRange function: That tool could to a quick test to see how many object node are in the radius of the specified node.
It could be called like this:
Troops = InRange (EnnemyNode, Range)

That could be used so that an Ennemy check how many "friends" there are so it could decide to attack even if it's injured (The AI would pick up from there)

These tools could help us to implement some basic AI easily into our projects.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I think this is more of an addon library that someone could do to allow this sort of stuff to be easily included in irrlicht projects but it's not something that should be included into irrlicht really as irrlicht is trying to stay as just a render engine and not be too closely linked to games so that people who want to use it for things other than games aren't bogged down with loads of stuff that's not useful to them.

But yes, if someone could implement these sorts of functions then it would help a lot of people. AI is quite an interest of mine as my degree was based on AI but i don't know if i'd have time to implement this stuff right now!
Image Image Image
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Re: Ideas about AI helper tools.

Post by rogerborg »

christianclavet wrote:Hi,

A previous post gave me some idea that I'd like to share. This could be developped in the future.
So we're clear, are you offering to develop this? I hope so; I've seen your demo work, and it's beautiful.
christianclavet wrote:PlayerInView function:
How do you see that implemented? Talk of a camera seems to imply doing an actual render from the camera's POV any checking if any pixels from a given mesh (not node) are actually written to the Z buffer. If not that, then what?
christianclavet wrote:HitByPlayer function:
I've currently got a candidate patch in the tracker that does BB then triangle selection based on a ray (not a node). You could then trivially check if the node that's hit is the one you're interested in. That's useful independent of 'AI'.

christianclavet wrote:InRange function: That tool could to a quick test to see how many object node are in the radius of the specified node.
Again, not really specific to AI.
christianclavet wrote:These tools could help us to implement some basic AI easily into our projects.
Sure, but I suggest that you try to keep the functionality general rather than specific to 'AI'.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Hi, Thanks for the reply.

JP:
I think this is more of an addon library that someone could do to allow this sort of stuff to be easily included in irrlicht projects
Yes that true. That could very useful to have theses functions but perhaps not in every situation. If most of theses functions would only be useful in AI, yes. But if theses could be used for other things...

rogerborg:
So we're clear, are you offering to develop this?
Humm. If I could, I'll do it sure. My c++ skills are not good enough to do it. I have some theorical knowledge of 3D and basic knowledge of C++; but not lacking in imagination :wink: . I had some ideas that I wanted to expose so, that perhaps taken by someone that have the skills and a new project could be born.
PlayerInView function:

How do you see that implemented? Talk of a camera seems to imply doing an actual render from the camera's POV any checking if any pixels from a given mesh (not node) are actually written to the Z buffer. If not that, then what?
I think it's only the active camera that is being rendered. I was thinking of an algorith that could take the information of a standard camera and use its informations (FOV, View frustum), to get a basic idea of what the NPC is viewing then do a test on the view frustum of that camera (some ray casting intersection test I think). Another advantage of this, if that someone could "record" this camera, and we could "replay" the NPC in the main camera view. And see the player being killed... :) Also be a good tool to see how the AI is working for a character. (Select the NPC camera as the active one)
I've currently got a candidate patch in the tracker that does BB then triangle selection based on a ray (not a node). You could then trivially check if the node that's hit is the one you're interested in. That's useful independent of 'AI'.
Wow, that's great. We'll only need a little code tutorial to use it properly. Thanks. It think your code could also be used to determine if the player is in the NPC view. Since it's based on RAY. We could have both function done with the base of your code.
Sure, but I suggest that you try to keep the functionality general rather than specific to 'AI'.
Yes, these functions are not limited to AI`. (Except the path tracer, that is already done with OpenSteer for pathfinding. (I'll still have to google this to see what it's all about)

But for me, starting working on a basic ennemy; I'll need those functions to start something. That's why, I'm building "demos" and not games. I'm not able at all to do something with a character. (Perhaps a still character, but not a fully interactive one)

It's not that bad, because I'm using IRRLicht to understand "engines" and promote my skills as a modeler. So I'm not "requesting" this. It would just be fun, that a non-skilled C++ like me could have a basic ennemy to "shoot" in my own modeled level... :)
Post Reply