Hello!
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!
1 Like
ExcellentāIām glad that it helped you, and that it succeeded in your tests!
1 Like