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):
      self.pandaActors.append(
        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.
2 Likes

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