I would need your comments on wether or not I should switch from blender game engine to panda 3D on a specific project. My explanations will be a bit long but I need to have an educated advice on this.
What I had to do, and done with bge, is a kind of small WoW for scientific simulations of robots swarms. Currently the project is spread across many .blend files.
- the robot 3D model, currently only one but I might add a couple of other robots type. The robot dynamics model is also stored there as a Python script calling applyForce and applyTorque from bge according to actuators orders and many other parameters. This dynamics model is good enough to reproduce the feeling one gets when piloting a real world robot.
- a map, currently one but everything is designed to change it at will
- a blender server managing the dynamics of all the robots in my virtual world but no rendering of the scene.
- a blender client, connected to the server across the network, rendering the camera view of one or more robots
Typically the blender server starts, loads the robot model and the map and waits for clients to connect.
One, or several, blender client connects to the server, gets the robot model and the map over the network and asks for a given number of robots to be spawned in the virtual world.
Then these clients receives actuators commands (from a joystick, from another program, etc) and they send these actuators commands to the server. They DO NOT simulate the dynamics.
On each logic loop the server computes the physics and collisions of each and every robots it was asked to spawn according to the actuator commands it got from the clients. These values are then made available to the clients which in turn renders the scene for all the cameras of all the robots they manage.
So, for example, I can have 5 blender clients managing 4 robots each for a total of 20 robots in the server’s virtual world. Each client takes care of the actuator commands of its four robots (how this is done is off topic here), updates the actuator commands of these four robots into the server, gets back the position and orientation of the 20 robots and renders the cameras attached to its four robots. If I’m unclear here think of World Of Warcaft but with one human player managing several characters at the same time.
This setup allows me to get a reasonably accurate simulation of the physics and camera view of a couple of dozen robots by splitting the rendering accross many computers and still get a decent framerate.
Issues with bge:
1/ The major issue is that I can"t have lights hooked on my robot 3D model and instantiate this model at will in my virtual world (known limitation of bge with GLSL lights…). What I had to do is to hide many lights in the clients 3D scene and each time I want to spwan a robot I have to pick an available light, hook it to the new robot instance and switch it on. Then when a robot leaves the virtual world I have to take back this light, hide it, switch it off and so on. As I can have several clients connected to the same server it means I have to track each and every light used in each and every client…
2/ Furthermore I can’t have more than ~30 lights in the same scene so I will never be able to simulate more robots even if I had the required computing power. I know that 30 lights moving around on a single scene can be considered as a bad design in the first place but I CAN’T just use a single sun light. I MUST have one light attached to each robot as the only light sources available. I don’t care if I get 6 fps instead of 60 as long as I’m not down to 0.6 fps.
3/ The physics I get from Bullet are not that good, I don’t know if this comes from Bullet of from the way it is used by Blender, I suspect their ode solver to be only good enough for games rendering but not for moderately accurate real world physics models. Don’t take me wrong, I don’t intend to criticize Bullet and start a flamewar, I think it might simply not be designed for I want to achieve and to be honnest I had no time to dig very deep on this issue. The only thing I know is that, without any tweaking, and using blender on top of it, what I get from Bullet is light years away from what a decent ODE solver gives me on the same dynamics model.
4/ As the python interpreter is embedded into blendeperplayer.exe on windows platforms, the Python’s multiprocessing module is a pain in the *** to use. It took me days to figure how to do this on win32 and I’m not proud at all of how I solved this problem. (see here if you are curious: blenderartists.org/forum/showthr … on-windows )
5/ Documentation is somewhere between awful and nonexistant, I spent too many hours designing workarounds and I’m sick of having to dig into BGE’s source code in order to understand what a Python binding is doing.
According to the above, do you think it would be worth it to port all my physics and client/server code in order to use the Panda3D game engine ? What kind of improvements should I expect regarding the issues listed above ?
I would still use blender as a 3D design tool but I have read it is possible to export my 3D model to Panda so this looks like a non issue, are there any caveats though ?
Thanks in advance for your comments !