Contribution ideas - more GAME samples!

On an other note - I was digging through ‘direct’ today - and there is a TON of stuff in there - a lot of which after searching the docs (and the web!) I couldn’t find samples or explanations of, but there is some potentially really nice features in there that I think no one is aware of!

Top of mind was the ‘distributed’ package - which seems neat, I’d like to take a crack at a game sample that uses it (if it was designed for this.) ‘cluster’ looks interesting as well. The FSM code seems directly applicable to game samples. Also in ‘controls’ there looks to be some useful things… some of which it looks like I already duplicated by accident, so I’m going to try to remedy.

Is ‘direct’ something we’re actively maintaining? Are there longer term plans for the packages? Just curious. If so more official samples to demonstrate some of this might be an idea!


I’m glad of that! :slight_smile:

Well, as noted above, it might not be required.

(Unless one is working in Python 2, of course. However, I’d suggest that Python 3 might be preferable.)

This we’ve argued and disagreed about before. However, it’s also somewhat besides the point, I think: My response above was responding specifically to the approach suggested by Epihaius, not to the general idea of code-externalisation in the samples, I believe.

And I learned something new today!


  • If /foo/ is found, a regular package is imported and returned.
  • If not, but /foo.{py,pyc,so,pyd} is found, a module is imported and returned. The exact list of extension varies by platform and whether the -O flag is specified. The list here is representative.
  • If not, but /foo is found and is a directory, it is recorded and the scan continues with the next directory in the parent path.
  • Otherwise the scan continues with the next directory in the parent path.

So it might be possible. I’ve not tried this yet… but I love the implications it might have to keep our sample logic neat and organized.

1 Like

Sure, it’s one additional lookup, I agree! The idea was to “hide away” the perceived ugliness of having to do:

from samples.ai_sample.main import ai_manager
from samples.collision_sample.main import collision_manager

My suggestion would – in my mind at least – correspond to moving the basic samples into their own basic subdirectory within samples and then having to browse one directory layer deeper in order to find those samples. If the latter seems acceptable, then I’d argue that doing an additional investigation within one more module (samples/ might not be that bothersome either. Anyway, it was just a suggestion :slight_smile: .

It wasn’t that long ago that serega-kkz made me aware of this as well – it doesn’t seem to be well-advertised for some reason. You can find some arguments for and against using Implicit Namespace Packages here on Stack Overflow.

That’s very fair, and let me note that such suggestion is apppreciated!

In this specifically, I’m just very wary of increasing the learning curve in a sample that could be the first that some very-new dev opens after downloading Panda.

I think this makes sense, actually.

So at the top level we have ‘basic’ and essentially - a bunch of ‘game sample’ folders. Those game samples could import the lower-level sample code.

Which makes sense in my mind. We’d want the user to see the game folders first - then if they decide to start to investigate each feature individually, burrow a bit deeper.

I like it. Is there any project guideline currently that says Panda’s source tree needs to be ‘earlier than Python 3.3’ compatible? Or is it OK for us to use propose using 3.3+ specific language features?


Few updates!

  • Restructured the samples/ folder. ( As a proposal, this is far from final ). It was difficult to see which samples were game related vs feature specific, so I’m proposing some cleanup. Also bringing more visibility / focus to ‘game samples’ by putting them closer to the root.

The current structure I have is this:

    ├── features
    │   ├── audio
    │   │   └── music-box
    │   ├── input
    │   │   ├── gamepad
    │   │   ├── looking-and-gripping
    │   │   └── mouse-modes
    │   └── rendering
    │       ├── bump-mapping
    │       ├── carousel
    │       ├── cartoon-shader
    │       ├── culling
    │       ├── disco-lights
    │       ├── distortion
    │       ├── fireflies
    │       ├── fractal-plants
    │       ├── glow-filter
    │       ├── infinite-tunnel
    │       ├── media-player
    │       ├── motion-trails
    │       ├── particles
    │       ├── procedural-cube
    │       ├── render-to-texture
    │       ├── shader-terrain
    │       ├── shadows
    │       └── testbug
    └── games
        ├── asteroids
        ├── ball-in-mazes
        ├── boxing-robots
        ├── chessboard
        ├── roaming-ralph
        ├── solar-system
        └── templates
  • Moved the former ‘Roaming Ralph’ example into the new templates/ sample. It still uses ralph media but, this should be fixed soon.

Note I don’t fully like the name ‘templates’ for the ‘game type’ samples. As they’re not really templates but intended to be very basic copy/paste examples for building a full game based on a particular need. Also putting ‘music box’ under ‘audio’ didn’t seem perfect.

For the source, see: Commit

Love to hear any thoughts! This is still far from complete, lots to go yet, more updates to come!

Hmm… Perhaps instead of “templates” one might have “tricks and techniques”. That then could include all sorts of useful snippets–perhaps including things like the music box.

As to the “games” folder, I’m not sure that I’d include the “chessboard” or “solar system” samples in it: the former doesn’t implement any actual game-rules that I see, while the latter is basically a simple, controllable orrery.

I would suggest instead that they, too, could go in a “tricks and techniques” folder, tutorialising as they do the implementation of drag-and-drop and the use of tasks, respectively, I believe.

I like the idea of a general category like this. Some samples do seem to fit.

For ‘templates’ I was thinking along the lines of something somewhat new in the concept of our samples - ‘game archetypes’ that show how to do common game fundamentals (with batteries included, like physics, animations, ai, all intact etc.) Idea being that you can use them as springboards with very little effort.

My thought process here - it’s actually fairly difficult for a new person to Panda3d to actually get up to speed with basics - like a scene with moving entities and physics applied ‘globally’ (player and NPCs, per poly collision, and things like gravity). I’m hoping the archetypical samples can fix this with as /minimal/ a codebase as possible. So far the 3rd person sample is close, the player char and all the NPCs have full physics and collision enabled, AI works out of the box. But I will want to add some of the basics (gravity, jumping, spherical rather than point collision).

But I’m lacking a vocabulary word to use other than ‘template’ :slight_smile: let me know any ideas here! Some brainstorming needed I think.

Agree. These weren’t sitting well we me either. Is ‘solar system’ something we should put more in a folder like ‘tutorials’? The step-by-step demonstration mechanism there is nice, but not sure a single sample warrants a folder - so maybe the next lesser evil is the ‘tips’ folder, or back to rendering.

Chessboard almost felt like a ‘playable’ game, as in, two players could move the pieces around. I’m imagining on say, a tablet - it could work? Then realized it doesn’t actually support ‘removing’ pieces from the board, so I guess it’s not actually playable!! So maybe better suited for ‘input’ folder as it’s more a ‘picking’ example possibly?

Still just brainstorming here mostly - I’m sure most of this will all change before work is done here. Happy to hear ideas.Thanks!

Hmm… The thing is, it’s not a rendering tutorial; it’s a task tutorial, if I’m not much mistaken. So I wouldn’t want it to be filed in the “rendering” folder!

Maybe a new “logic” folder, alongside “input”, “rendering”, and “audio”?

That said, it does occur to me that perhaps we shouldn’t yet quibble about specific extant samples: it seems to me that we might want to consider the possibility of clearing out some of the old samples.

Ah, I see. Hum… I’m not sure of how I feel about that; I fear Unity-style copy-pastes being uploaded to places like Steam…

You do make a good point that it can be somewhat difficult for a new dev to pick up the engine… but that is somewhat were a “Beginner’s Tutorial” comes in. Specifically, it takes the reader through the process step by step, and gives more instruction than do most samples, I imagine.

There is still the risk of copy-pasting, but at least it’s only one game, not several parts that can be easily assembled into recognisable-but-different games.

Still, if we’re doing this, then I think that the term “template” works well. Otherwise, perhaps “kits”. Or even “snippets”, as in the sub-forum!

I wonder what the goal is here with the sample organization and template games thing. Does Unity lack something that Panda3D offers for developers who want a really quick and fast and easy way to make template games?

It’s unfortunate to me that this thread has turned into precisely the “template game aspirations” we were trying to avoid originally, as Unity-style template games do not fit the character of how Panda3D has been taught to this date.

Making a cool tech demo that reveals a bunch of Panda3D features in a compelling way is far more interesting to me personally.

1 Like

Relax, relax :slight_smile: I also want to use another term other than ‘templates’ , hence posting for some ideas. Really the 3rd person sample I have now isn’t much more than Roaming Ralph with some improvements, it’s not a drastic change from what we already had. The other game archetypes in process aren’t much more complex either, I’ll have that code up soon for review.

Agreed here as well! I’d like to help out with this once I finish the samples revamp. I feel like it’ll help get a lot of the basic components needed. Ideally we could really focus on much more attractive visuals and very nice game play, and make some very nice eye-candy for the website.

What comes to mind here - Blender did this with their animated shorts. Their own team produced and released these really nice CG films, and said work actually pushed their team to make improvements to their product (Blender itself!) as it motivated their own team to make awesome things.

I think its a great idea for the Panda community to do the same! We definitely don’t have the resources that the Blender org has, but it would be fun to see what can be done. In the end we can have a nice page of showcases done in similar vein, as does Blender: Open Projects —

(Some of these movies really do look great, if folks haven’t seen them yet.) Imagine if we the Panda community did something similar!

That being said, don’t let my progress on ‘official’ samples slow down the effort for a tech demo, we could spin up that effort in tandem? Just a thought!

1 Like

These are cute and technically impressive showcase pieces, no doubt. Looking at the Blender Cloud website, they have a fee-based service to access these assets and tutorials. Blender Cloud In addition, they had significant funding support in order to create these. And obviously, the rendering is not real-time, so we wouldn’t begin to approach that VFX level even with infinite resources.

I’ll give some thought to a working outline for a scalable team project, IE a multiple perspective sci-fi/sci-fantasy tech demo with roughly a 10-minute length. We may want to aim even lower, maybe a 5-minute interactive tech demo. If we’re to accomplish anything, we’ll need well-defined goals and at least a tiny bit of art direction.

Definitely a great place to start! I wonder if a new thread to solicit more volunteers and contextualize the effort makes sense? Might need to do a bit of recruiting to get enough hands on deck to make this work!

Just for some inspiration, I bookmarked some neat tech demos over time. Sometimes it helps to see what’s been done by others to get some ideas!

Although these approaches are super art intensive, it’s amazing to see what can be done in realtime. I wonder what Panda would be capable of if pushed hard enough?

Do you happen to know what GPU/GPUs these demos were rendered with? RTX 3090 maybe? :slight_smile: I think the average Panda user might have a 1050 Ti. The PS5, from a quick glance, is roughly analogous to an RTX 3070.

The Kite demo is an old one, I think the min spec required is 4 core/8GB ram/GTX 680. The hardest part for me was compiling the thing, I didn’t have enough ram to actually build it, and the scene optimizations took forever. But you can download it from here:

But running it in real time wasn’t too bad on the 680.

The other two I haven’t tried yet! I think infiltrator is also up for D/L on the marketplace as well for those brave enough to try to build.

The 680 is about 9% faster than a 1050 Ti, according to UserBenchmark. I point this out because not only do we have to be realistic about art goals, we should set a hardware goal. I think the RTX 2060 would be a fine level to set it at. But I am aware this is beyond the average spec here.

Agreed, good idea to set scope or a project like this could really spiral out of feasibility :slight_smile:

Other thing to note as well, these are rendering demos, and you can cheat a ‘lot’ there, no physics needed, so there’s a lot more cycles for gfx, and you can /really/ cheat with pre-computed lighting, shadows, and pre-rendering frames, so it’s way easier to get something impressive.

If you’re looking to do a playable /game/ demo, I think expectations are reasonably lower on looks, much less might impress! And you need cpu/gpu cycles for more things too.

That being said - the hardest part of projects like this is always the artwork for me (since we’re all coders after all), it might be nice to find and/or ask a sponsor to purchase/donate something professionally done? Just ideas!

Here you go: Collaborative Sci-Fantasy Tech Demo for an Official Panda3D Showcase

Is there an easy way to determine how one’s graphics card compares to a given baseline? I would like to see where my own card sits relative to these proposed specs–but I’m afraid that these days I’m not at all familiar with the hierarchies of graphics cards! ^^;

It’s less the term “template” that has me worried than the description that you gave of its intended use, I think. As I said, I fear that providing easy-to-use “kits” from which people can quickly assemble games might lead to Unity-style copy-paste games on marketplaces…