Panda3d right for me? (2d game, with h/w accel using gles)

Theres ben a few topics asking about using Panda3d for 3d, over the years, but not too many very conclusive ones; I would humble ask for your thoughts on it again, but with regards to some specific points…

  • I’d like to use a 3d engine rather than a 2d one, so that I have access to some handy operations; I’ve written the 2d engines with page-flipping sprite-sheet type artwork for a million years, but I’m hoping I can get a lot of handy features this way…
  • I could roll my own using GLES and some python ctypes wrappers, but again, not wanting to reinvent the wheel again :slight_smile:

Using a 3d engine like panda 3d…

  • gets you cross platform nicely (sure, SDL and so forth can get you that too)
  • get ‘free’ rotation, flipping, scaling on ‘sprites’; a sprite really just being two back to back tri’s, or a 4 point polygon if we can do that(auto splitting?), with a texture; so would need to load image into texture or create texture on the fly… if panda3d can’t do that, shouldn’t be too hard to fake it at laod time
  • I don’t want to use egg files or whatever, I’ll be pulling down all my tile artwork from local or remote images, so just have bmp or png or jpg to work with, dynamicly set up (changing images on the fly and such.)
  • I do want to be able to do zoom and rotate of the scene as a whole… ie: say you’re doing a map editor for Super Mario, you might want to pull way back and see the whole scene, or zoom in to see it as a player would; smooth zooming in/out using a 3d engine shoudl be as eay as setting the camera paramters, right?
  • I’m figuring I’d get ‘free’ alpha blending … put a tile down for base, put some features on it (add a tree to a base tile say), add a player charactert on top of that, and add some weapons onto the player say for example… putting som eumber of image son top of each other, with transparencies (so the tree can be on a greass tile say), and having stuff like a weapon that glows with pulsing in and out… just a matter of setting transparency and colouring on the polygon that contains the textures, perhaps?

I figure to render a scene, would be a matter of … at level ‘startup’, set of a scene graph with all the static stuff (the map), and then render time is rendering that scene graph, along with additional polys for the sprite groups and so on.

Should be doable … I expect I’d be fighting with some of panda3d since it inherently is more 3df than that…

… but do you think this would be a good match?

Or should I just go back to rolling my own? :slight_smile:

I don’t want to just use SDL (say), since then you’re really on a 2d thing, and doing zooming and flipping and such becomes tedious (ie: I’d be tossing a lot of memory away with pre-rotating and pre-flipping all the sprites, and doing stuff like whole-scene zooming and rotating is _very cpu intensive, impossible on low end machines that would have no problem doing it in gles)

WHeck, with panda3d, might even be able to do it with kivy to get UI elements …

Thoughts?

Thank you for your reading and time :slight_smile:

… Honestly, I think that doing what you want with Panda is easier than you seem to have in mind. ^^;

To answer the overall question, I do think that Panda should suit your purposes well indeed. That said, let me address a few of the points that you bring up in your post:

First of all, you say that you don’t want to use eggs, but you’ll essentially end up using something similar anyway, I suspect.

A good description should be found here, but in brief:

Panda has a type of NodePath called a “SequenceNode”, which can automatically (and with control over speed and so on, I think) cycle through a set of child NodePaths, showing one at a time. Panda also comes with a command-line tool that not only takes images and generates quads having those images as their textures, but can also automatically produce the above-mentioned SequenceNodes (including prescribing frame-rate, I think). Combine the two, perhaps with a bit more code on your side to manage collections of these to make full sprites (that is to say, including animations for multiple directions, or multiple actions, etc.), and you should have your sprite handling.

(If you want to be able to view them from behind as well, take care to set their NodePath to be “two-sided”, I believe.)

You could, as you suggest, rapidly change the texture on a single quad to produce your animations, but I think that you’ll find that to run more slowly and be more work on your part than the above.

Moving the camera should be very easy indeed:
base.camera.setPos(), where is the point at which you want the camera to be placed.

You should also be able to move the camera relative to another object, including itself; for example, if you want to move the camera forwards by 1.5 units, you might use the following:
base.camera.setPos(base.camera, 0, 1.5, 0)

As to layering characters, remember that you can attach one NodePath to another, causing it to be rendered relative to the first: scale the first, and the second scales with it; move the first, and the second moves with it; etc. Naturally, you should be able to move, scale, etc. the second relative to the first.

If I understand you correctly, then I think that you’re thinking about this at a lower level than that at which Panda offers. For the most part, it should more or less be a matter of adding your objects to Panda’s scene graph (perhaps with a few intervening nodes for the sake of assisting culling), including your “active” objects, and then letting Panda render. There’s a little more to it than that, but primarily high-level stuff (logic for your game objects, for example) and tweaks intended to improve performance.

hrm, thanks … now you’ve made it hard, so now I have to keep panda3d in my consideration pile :slight_smile:

Are there any UI toolkits for p3d, so that you can get basic dialog boxes, dropdowns, etc? I looked at p3d years ago, and at the time I was making my own dialogs, but probably a lot has changed.

Any idea about memory consumption? ie: I’m like3ly ot have 100 different tile types (or less), across a tilemap maybe 50x30 tiles viewable (with the full tilemap level being say 128 square tiles … hence, there being a visible viewpoer sliding around or zooming in/out.)

Plus ‘detail tilemaps’ layered on top, plus the sprites.

Its hard to use ‘eggs’ … I figured anyway since… I could maybe use eggs for player and enemy sprites, as they likely won’t change too much; even then, you’d have a separate egg for each animation state… left, up, right, down, bored, jumping, shooting, etc; a lot of eggs, and you’d be switching them constantly, so no big deal to just switch textures myself, shrug

But actual tiles couldn’t be egs (and don’t animate much anyway usually), since they could be dyanmicly generated or player updated or other things. shrug Anyway, I’ll not worry about that.

I’ll have a tilemap I can load (a 128x128 list of tile types, plus another 128x128 overlay for details to show on top of the base tilemap, plus the sprites running around.)

Target devices could be desktops, to mobiles; now, I know panda3d does not currently support android or iOS, so thats a problem, but naturally the game would take a year or more to build and a lot could happen in that timeframe, so its not totally a huge strike right now. At least, it’d be a good prototype.

On mobiles, you may have 256MB of RAM, minus OS overhead and engine and so forth, minus any assets and so on. So you could have 100MB free to work with, quite likely, to as much as 150-200MB. On many more modern devices you may have 500MB or a gig to work wit, which shoudl be plenty…

… but any chance panda3d can operate in 50-100MB? 100-150MB?

That probably is unanswerable without experimentation, but perhaps the above is enough to make a WAG (wild assed guess)?

Thank you for your thoughts my friend :slight_smile:

Hmm… I’m honestly not sure of Panda’s memory footprint offhand; I don’t think that it’s built with mobile devices in mind, albeit that I may well be mistaken on that. Experimentation may well be your friend here: put together a simple test scene and see how much memory you use up. Since you’re targeting mobile devices, you may also want to look at installer size.

As to dialogues and the like, Panda does have its own GUI system, and I think can work with tk as well, but you may want to do a forum search on the latter point, since I’m not at all confident one way or the other on that.

As to eggs, I still think that it would be slower to switch textures than to switch eggs - I seem to think that Panda does the latter rather more quickly than the former.

As to level tiles, you may be correct - in fact, the MeshDrawer system might work well for you there, since that’s set up in a manner congenial to the use of a texture atlas, rather than lots of separate images for each tile type.

Again, many thanks; MeshDrawer looks pretty interesting; I’ll have to do some performance analysis then, see how that works out :slight_smile:

The MeshDrawer examples seem very trivial to build… some really tight interfaces there.

Thanks, I’ll take a look… now the hard part :slight_smile:

jeff

as far as gui systems go. panda recently gained librocket support.

panda itself doesn’t require much system hardware. i’ve run panda on systems with just 128MB of RAM and 16MB of grafic memory. you need to optimize your assets for the targeting hardware but then you’r fine. panda has been demonstrated to run on a number of embedded systems already, including the iphone. you will have to make use of many of panda’s optimization features to run stuff on such hardware. but that’s only natural.