Sample Framework

Shaun

14-08-2009 13:55:37

Guys, all of the tutorials that I have viewed are fantastic by me. But I believe that they all use the SampleFramework.py file. If I'm not wrong the SampleFramework.py file is one to build your game/gameengine over. Can I not create my own such framework? and use that to create my game. I mean that all of us know that python is really slow right? So I thought if I could create a framework generically meant to be the base of the kind of game I want perhaps I could optimize a base framework and build on it right?

So do we have any tutorials based on creating frameworks?

bharling

15-08-2009 10:15:51

Yep:

http://wiki.python-ogre.org/index.php/CodeSnippets_Minimal_Application

You can use this as a starting point, but you can also be very flexible with this. For example you dont need to use root.startRendering(), you can control the renderer however you want. Ogre just provides 'easy' methods like framelisteners etc that can help with organising the render loop, but its entirely up to you whether or not to use them. It really depends what you want to do. I recently did an app that uses no framelisteners at all, just a pure python main loop system that just calls root.renderOneFrame() as and when required. Key thing to remember is that Ogre is purely a render engine, it does not impose anything on how you code your game, all its there to do is draw stuff on the screen, the rest is entirely up to you.

See the discussion on Twisted below, as that goes into some detail about using Twisted as the control point for the renderer instead of relying on Ogre's built in methods.