Implementing a game loop: Possible?

Mr. Anonymous aeronautics2412 at hotmail.com
Thu Feb 15 21:37:27 PST 2007


Hello Again,

This is related to my 2d gaming/simulation question (Hardware accelerated 
graphics...).  Specifically I’m finding myself in a bit of a bind when it 
comes to implementing a game loop.  Is it possible to poll for events and/or 
control the main application loop?  I dug through the _core.py module code 
and saw that PyApp and its MainLoop method appear to be proxies to C++ 
classes, correct?  I suppose this is what is preventing me from overriding 
and controlling the execution flow myself?  Do I have any options to create 
a work around or is this a limitation of the wxPython framework and why 
PyGame is preferred?

I’m trying to essentially create a game/simulation that runs in its own 
panel while the main frame also contains other widgets to interact and 
monitor the underlying agent applications (the program will serve as an 
interface to some artificial intelligence programs).  This is why I am not 
using PyGame directly as I’m under the impression I won’t have an easy GUI 
framework to work with without having to create my own from within the 
PyGame framework.  Any thoughts on how I could do this with python (as the 
agents are written in python)?



***Questions***
- Is it possible to create a game loop?
   --> Would it be ideally placed in a method bound to the ON_IDLE event for 
wx.frame?
   --> Or should I create a separate thread to handle the game running in 
the panel?
- Is it possible to poll for events?
- Is it possible to control the application loop by overriding wx.App 
MainLoop?
- Will the wxPython event handling scheme just create too many problems for 
2d gaming?



Please Note:  I've worked with several game engines and frameworks before.  
I am aware of the limitations of using GUI frameworks for gaming versus 
frameworks like DirectX or SDL which have hardware access.  Regardless can I 
use wxPython much like I would with win32 api or another windowing toolkit 
to create small 2d games?

Thank you for your time and help,
-Paul

_________________________________________________________________
Don’t miss your chance to WIN 10 hours of private jet travel from Microsoft® 
Office Live http://clk.atdmt.com/MRT/go/mcrssaub0540002499mrt/direct/01/





More information about the wxpython-users mailing list