AI for Panda3D: PandAI v1.0!

Hi all,

For those of you following the PandAI thread, I know PandAI v1.0 has been out there for awhile since its development stages. But what was missing was something critical. Good documentation, examples and samples.

Welcome to the new documentation :

sites.google.com/site/etcpandai/

[b]{EDIT}

Now the PandAI documentation can also be found in the Panda3D manual.[/b]

I hope you guys find all the steering behaviors and path finding documentation much more accessible. Each steering behavior now has a sample video and code. This makes it really easy to get into it and try it out.

The next step for this ofcourse is to integrate it with the manual page of Panda3D but this is a good start for now.

Let me know what you think !

Cheers.

@NNair

Thanks for all of your work on the documentation. All of the sample code is definitely a plus.

Do you have any plans to support C++ programmers?
I use Panda3D, but only program in C++. I would like to use PandAI for my projects. Is there a way currently I can compile PandAI to work with my C++ code?

Thanks,
Frankie

Well, we provide the source code (which is in C++) and its open source so why not :slight_smile:

The documentation is only in Python for now though. But all the functions and classes are very similar to how it would look in C++.

As to whether it being part of Panda 1.70 and being accessible to C++ users through Panda directly, I am not sure. Let me get back to you on that.

So after consulting with the experts at the forums, the suggestion was to use PandAI in C++, it would have to rebuilt from the source code.

Before rebuilding make sure to include these in the classes you want to use : EXPCL_PANDAAI

Eg: class EXPCL_PANDAAI AICharacter { … }

To use it: you’d simply include the header files that you use, and link with libpandaai.lib (on Windows) or by specifying -lpandaai on the linker command-line (on Unix).

This might be a bit harder than expected but PandAI was initially designed to be a simple AI library for Panda Python users (which I think are the majority) to abstract the complications of creating AI in their games.

UPDATE: In the next version, Panda 1.7.1, this will be included already and so it will become easier to use PandAI from C++ !

Cheers.

Thank you for the very quick reply. This is exactly what I am looking for.

BTW: When is panda 1.7.1 expected to be released?

That would be a question for the maintainers of Panda.

I am just an intermediary :slight_smile: I like you hope it comes out soon !

Hi,

Always on panda3D AI. it seems when a NPC got a behavior like pursue, panda3D AI will orients the NPC directly on the target, but without a smooth move in transition.
For example, you are pursuing a NPC, but you are behind it, and it has not seen you. You fire on it, and it does’nt rotate to you, but it is here directly front of you.
Is that possible to avoid this? how?

Yes. That is how pursue works in PandAI.

My suggestion would be to create an empty node path. Make it as an AICharacter and do the pursue. Then based on the desired behavior that you need on your actual model, use this motion to determine that.

Also, I didn’t understand your example, if it meant that when the bullet hits the NPC, it should pursue you and rather than turning to face you, it jerks to directly face you. Well, the way to do this in my head would be, when you get a collision event of the bullet hit on the NPC, you would create a Slerp on the rotation to face the shooter and once this is done, you would turn on the AI.

Hope that helps !

I think… Awesome job!

yeap, you understand my trouble.
Ok, it was what I imagine. First, do the smooth move to rotate the ship, then activate AI.

I got another question on this. Because, I have different type of ships, with different manoeuvrability, can I parameter my AICharacter to simulate this.
I understood how to parameter to have different speed, but is it possible for manoeuvrability? (maybe using mass, or movement_force?).

Thank you

@darthrigg and Matthewop

Thanks a lot!

@shimrod

Well, I would say the best way would be to test it out :slight_smile:. But on another note, the way I would implement it, if it doesn’t work the way you want, would be to create a class (say MyShip) which has an AICharacter made out of an empty node path.

This class would also store other information related to movement, such as the maneuverability variables. Then on the update of each character of this class, it would take the empty node path’s ‘pursue’ values and apply the maneuverability variable values. This way you can have it work the way you want ?

:slight_smile: Just a suggestion. Hope it helped.

Cheers.

I don’t really understand what you want to do…
what the finality of this empty node? How to update it? Do you know move it manually, if so, what the interest to pursue it? why not simply manually move the ship?

I think it miss me something to understand.

I am looking for the limit or not of this library.

What happens if you give pursue + arrival to an NPC ship, and that the player and the NPC are face to face?

If the player goes straight forward, will the NPC just slow and stop?
Or maybe can I add an “evade” behavior, and parameter the distance to have panic=50m, relax=100m, and arrival=80m for instance.
What do you think about that?

But once again, what happens in case of flee? Have I to manage smooth rotation to other directions by myself?

Limit of the library is I guess that PandAI was designed to be a general simple library where we hoped special cases could be handled by the users themselves.

NPC should pursue the Player and if the distance between them is ‘>arrival distance’, then on its approach it will slow down.

The direction doesn’t matter, it will follow the above rule.

I don’t understand the question sorry. Evade and Arrival should work based on these parameters. If it doesn’t then maybe there is a bug we didn’t catch.

Most of the questions you have asked pertain to the same thing. Smooth rotation was one of the features we had in our to-do list which we had to remove as we ran out of development time during our semester for this library.

So, to accomplish this, you might have to do something a little more ‘hacky’.

Let me try and give you a working demo and test this out for myself too. Give me some time to fit this in my schedule.

In fact I was wondering, to avoid, in case of pursue + arrival, to have a character that will stop if it comes too near of its target, to add an evade behavior.

So, I hope the character will turn back and go to security radius, and next take back the target.

To come back on discussion of the smooth move, I think it is quite important to have this, because, if I cumulate several behavior to give to the character, the most pertinent global behavior, it is not acceptable to see the character not have a coherent and smooth move. A spaceship (for my example), can’t just turn back, it has to rotate slowly to the new direction.

And I can’t predicate when I have to add my own smooth move, because it depends of the reaction of the behavior.

Happy to give you my opinion to enhance your library, but I think for the moment, I will write my own scripts to manage behavior.
But I will still follow your progress, and why not use it when it will look like something I can use (because I have specific needs, I agree).

Thank you for your time anyway

In my opinion this is pretty well documented and since pandaAI is part of panda now, the docs should be copy-pasted to a new panda3d manual page. If this page is not linked from anywhere but the forums, it will be hard to find, I know that some users might not need to go to the forum for help at all and so wont find this.

@Anon Yes. I agree.

I will try to get that going by this weekend.

Great.
If you wont find enough time, I could do it for you. Though I’m not sure about the youtube videos, haven’t seen a video demonstration anywhere in the manual.