Hi, thanks for your help and uploading the example. I will have a look. Now I only need to find a way to install greenlet on my windows box...
Best regards, Dexter On 29 Aug., 21:05, "naveen.michaudagrawal" <[EMAIL PROTECTED]> wrote: > Hi Dexter, > > I highly recommend using greenlets to integrate both loops (the > gameloop and the UI loop). > > I've been playing around with different turn based games, and I > believe i've come up with a nice architecture. Basically, you > implement the game loop independently of the GUI, and treat it almost > as if the player will interact through the console. Then I install GUI > specific functions into the player class (through monkey-patching) and > so when the game engine calls something like player.get_input(), the > input function will switch to the GUI input loop using greenlets. This > might sound a bit confusing, so I've included a small demo that i've > been working on (implementing the game settlers of catan - so far I've > only done a rudimentary game loop). > > http://groups.google.com/group/cocos-discuss/web/Settlers.tar.gz > > The only requirements are pyglet, cocos, twisted, and the greenlets > package. You'll need to run at least 2 copies and connect them to each > other (just follow the menu - it should be pretty straightforward). > > To run it, just type: > > python2.5 -O Settlers.py > > Start a network game, and then start a new client and connect to the > network game. I've only implemented the initial setup of placing the > first towns and roads (it will tell you what to do in the console > log). > > This code is BSD licensed (except for the PausingReactor, which is > under the PSF license) > > Naveen > > On Aug 29, 10:01 am, "Lucio Torre" <[EMAIL PROTECTED]> wrote: > > > On Fri, Aug 29, 2008 at 10:50 AM, dexters <[EMAIL PROTECTED]> wrote: > > > The flow is more or less like this: > > > > init() > > > while not isGameEnd(): > > > ##wait for event## > > > changePlayer() > > > checkGameEnd() > > > endScoring() > > > > The question is now, how can I implement the ##wait for event## part. > > > The idea is, > > > that the player, e.g. placed a tile and afterwards the control is > > > given back to the > > > main flow above. I would like to avoid having a callback mechanism as > > > it would > > > obfuscate the flow. > > > Cocos es events based, so you do not own the main loop. > > > What you can do is fake it using threads or greenlets. We discussed > > this in the list a month ago (or so), maybe the archive helps you. > > > Lucio. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
