Entity systems and components in Panda3D

Some months ago I read an article:
cowboyprogramming.com/2007/01/05 … -heirachy/
and also more in-depth series of articles:
t-machine.org/index.php/2007/09/ … nt-part-1/

I really like the idea of implementing entire game engine in a modular way where I can match and mix every feature as needed using behaviorless components and keep the game behavior in subsystems, where the subsystems communicate through a unified messaging system.

Currently I’m experimenting with a separate C++ game world server (using enet networking) and I’m wondering how it will turn out when I get to the client code and integrating graphics and client side physics.

I’m still new to Panda3D so I would like to know if Panda3D has something to support such architecture out of the box or it would be too time consuming to implement? Will Panda3D plug in nicely in such an entity system?

Hi, those were both interesting reads. I am only speculating here, but I would think that you would not be able to use Panda3d to implement true Entity Systems as described in those links. Panda3d is completely object oriented in its structure and I don’t see how you could reduce your game objects to true entities since you will always be interacting with objects on the Panda side of things. Everything that ends up on the scene graph is an object (a node, or an Actor) and is manipulated by objects (collision traverser, Transforms, etc.), so if you tried to adhere to strict ES philosophy you would be losing all the advantages of the stream-lined, low memory print ES approach while also giving up the advantages of the OO approach; it might end up being the worst of both worlds. I could be wrong but I believe both articles are referring to building a game engine basically from scratch and not using a third party graphics engine like Panda.

That being said, unless you do plan on building an engine from scratch, you may end up having to use a third party engine and I think there would be potential for using Panda in one of the hybrid type approaches mentioned in the articles. I can’t tell you about the C++ side of things but I’m designing a similar game in Python using Panda and I could see right away how easy it would be to implement some of the ideas mentioned in the articles. In Python classes and objects do not have to conform to strict OO rules (no true data hiding, globals allowed, etc.) and can be used (and abused) in ways that C++ and other OO languages don’t allow. Python’s in built dictionary data type (dict[key] = value) would also fit perfectly into the ES system if I understand it correctly.

I understand you’re coding in C++, so this might not apply, but I thought I’d share that your links at least gave me some good ideas. Maybe someone who knows more about the Panda core could add more or correct me if I’m wrong here.

While panda is object oriented design you can totally write an entity component system on top of it. I did so here

Thanks for sharing ideas and code. So I guess, it is possible for higher level game logic, but for low level functionality it might be hard.

For example, if I want to implement audio processing as some AudioSystem which processes only Panda3D nodes with audio capabilities, it seems I would have to implement my own audio processing code (or wrap some 3rd party library) because it would be too hard to separate out Panda’s audio processing and wrap it in my AudioSystem (and the same goes for Physics, Rendering, AI …). I guess, it would work only if Panda3D were completely modular.

In the specific case of the audio system, Panda’s audio system is actually fairly modular and you can just use the *AudioManager and *AudioSound interfaces directly without using any scene graph nodes.