save scene to bam


I was looking to save all the variables in my game to a file but I know that you can save the scene to bam, but what does that entail?

thanks in advanced for the responses


Note only variables in nodepath.setTag() are saved.

I would not use this method to save your level rather write out xml, json, yaml, or some text representation of your game save state.

thanks, I was just wondering if it would be easier to use something Panda has. Dont want to reinvent the wheel.

bam is used for 3d geometry not level data. Unless your game is about creating triangles in 3d saving stuff in bam will not help you much.

Note that you can also pickle Panda3D nodes.

There are only two reasons i can imagine why someone would want to have bam instead of egg:

  1. making others load your models faster
    In this case it’s only a good idea if you distribute your game as a whole to consumers. Distributing is mostly done through Panda methods (makepanda, pdeploy), and AFAIk they convert eggs to bam anyway. Between developers you should use the egg format. (Read on the manual about the differences)

  2. Having the models load faster on your development machine.
    Here you don’t have to do anything, as Panda caches bam files automatically. The second time you load up your models they will load much faster, given you haven’t changed the original egg files.

If this all doesn’t apply to you, you might want to look into Panda’s bin directory. There you’ll find as helpful little tools as egg2bam :slight_smile:

I think I’ll look into pickle