HelloWorld example scales poorly

Hello! :slight_smile:

I took the Hello World example and turned the panda into a grid of pandas, eg:

self.pandaActors = []
self.pandaPaces = []
  for y in range(size):
    for x in range(size):
        Actor("models/panda-model", {"walk": "models/panda-walk4"}))

With some offsets and new camera position to view them all at once.

If size is greater than ~14 (196 pandas), FPS drops hard.

Is this the ball bark of entities that Panda can handle? Given that these are low poly objects, with a single low resolution texture, playing one animation, without collisions/path finding/state machines, I worry how the engine would handle say 50 ‘real’ entities.

It’s not the polygon count, nor the texture-size, that’s the problem here I daresay.

Rather, I suspect that the source of the performance issue that you’re seeing is that by default Panda does skeletal animation on the CPU, which can be expensive.

Now, there is some support for shader-based skeletal animation, but it does also require a custom shader on the developer’s part for the moment, I think. (Although I stand to be corrected on that last.)

Further, performance gains can be had via scene-graph instancing (not to be confused with hardware instancing), although this does incur all such copies running the same frame of the same animation at all times.

As to hardware instancing, as just mentioned, that I know little about, not having touched it myself. Perhaps another forum-member might have something to add there!

For what it’s worth, I think that I’ve had more than fifty entities–albeit simple and non-animated–on-screen at a frame-rate above sixty.

1 Like

Thank you very much for a great answer.

And … indeed!

  • Without the animation roughly doubled the frame rate.
  • Instancing with animation moved it up an order of magnitude.
  • Instancing with animation, without Sequence almost moved it another magnitude.

So in this case, I take it that the GPU tops out at ~16k static pandas, and the engine overall at ~2k sequenced pandas.

For the latter, I’m assuming we’re hitting CPU/memory restrictions due to Python?

Assuming that collision detection, path finding are C++ implementations, is the overhead for using those (proportionally) lower than the overhead for say Sequence?

I’m aiming for a Quakelike game with a larger (~80) set of entities; evaluating Panda3D against that use case.

Honestly, that I don’t know, offhand.

Again, I fear that this is something that I don’t know. (Indeed, I’ll confess that I’ve made very little use of Sequences, let alone in anything that might stretch their performance, that I recall.)

It should be possible to test, I imagine–or perhaps someone with more-intimate knowledge of these elements will respond.

Well, my guess would be that such a game would make only limited use of Sequences, if any at all.

(I’m honestly not a huge fan of their being used in the “Hello World” sample–but in all fairness they do provide a quick-and-easy means of getting an object moving.)

Have you looked at the “Asteroids” sample? That might provide a slightly more useful demo for your assessment, I think. (If you can keep clear of the asteroids while driving their numbers up, at least. :P)

Alternatively, I have a “beginner’s tutorial” that might prove to be a useful test-case for you: it builds up what is essentially a tiny single-room endless-shooter. It’s a bit more complicated than the “Asteroids” demo, but it might be closer to your intention, and does include collision.

That said, it’s also probably not ideally efficient, and does make use of animation.

Still, if you’re interested, you should find it here:

Also, If you have an looping animation that doesn’t need to be skeletal, you can use a SequenceNode.
While this might not work well for things like characters that have lots of long animations with just a few predetermined joints, It’s perfect for certain animated objects:

  • Muzzle Flashes for rapid-firing weapons.
  • A rushing, turbulent waterfall.
  • Flags flapping in the wind.
  • etc.

Great tutorial. Cheers!

I could spawn ~140 WalkingEnemy before FPS took a hit. Wonderful! This is good enough for my use case, as most expensive operations can be spread out over many frames.

Thanks! :slight_smile:

1 Like

Excellent–I’m glad that it helped you, and that it succeeded in your tests! :slight_smile:

1 Like