A preloader is a custom class that loads game assets ahead of time, while providing the player with some indication that the game is loading something. They serve to get the loading out of the way so it interferes with game play as little as possible. For our game, we'll make a preloader with a progress bar.

In order to make a preloader with a progress bar in Panda3D, we'll have to force the game to render frames to our window during the loading process. When the game is stuck in a function or method, it won't update the window automatically. To force an update, we can call base.graphicsEngine.renderFrame(). This will do two things for us:

Because of this order of operations, we'll have to make the call twice in order to get the results we want.