I know there are a couple of topics like this one, but they’re quite old (over a decade) and I kinda wanted to know your current opinion on things. Basically, I just want to know what are some of the best practices I should be aware of from the start. (For context, I’ll be making a somewhat heavy 2D simulation with hundreds of intelligent agents interacting with one another, written in Python).
Is there a common practice regarding code structure, use of classes, use of global variables/functions, programming paradigm (such as OOP or Data Oriented), etc? I know it varies from case to case, but my guess is that just like every programming language has good and bad overall practices, so must Panda3D haha.
If you need any more detail regarding my project, feel free to ask! This is a really important project and I don’t want to mess it up by starting with my left foot XD.
Not really: different devs here have different approaches and different philosophies! (For example, where one dev might prefer a class-based approach, another might prefer a functional-programming-based approach, and yet another might prefer an entity-component-based approach.)
For your case, my main suggestion would be to be prepared to move components over to the C++ side of things should the Python side prove too slow.
By all means implement in Python first–at the least it’s a quicker language for iteration, I daresay. But as it can be slower, and as you say that you intend a heavy simulation, it may be that performance will be undesirably low in some places. If that does happen, it may be useful to then port the relevant code over to C++ in the hopes of a performance boost.
(Presuming that you’re not placing the heavier elements onto the GPU, of course.)
Personally, my experience suggests that you do not need to take templates such as DirectGUI or ShowBase as a basis for your application. This also applies to the C++ side, for example PandaFramework. The main goal is to study the engine at a low level so that you can make the most of its capabilities.
On the python side, I would generally not recommend using the Direct module. It is implemented clumsily.