The Unexpected
Awards
Diary Entries
Twisted TV
Sunday: Devoid of ideas.
Monday morning: Finally, an idea I can live with ... provisionally named Twisted TV.
Monday evening: Started work on it, deciding to try out coroutines and pretending that Python has a shared-nothing, message passing architecture like Erlang. It has been a promising start - no loss of frame rate and it makes for simple logic.
I'm also rather impressed by Pyglet. It shows promise, so I'm using it instead of my usual Pygame/PyOpenGL mix.
Twisted TV - fairly simple processes
Tuesday: Went to the office and worked hard, but unfortunately not on my game. Kept thinking that there had to be a simpler way of implementing coroutines.
Returned home in the evening and improved my code by taking things out, resulting in fsp.py - Fairly Simple Processes.
It means that I can write multitasking code like this, hopefully simplifying the logic a bit. It's all part of a wild and wacky experiment based on reading a few articles about Erlang.
from fsp import spawn, run def producer(consumers): while True: yield True for consumer in consumers: consumer.send(me) def consumer(): while True: yield wait() msg = recv() print me, msg c = spawn(consumer) for i in xrange(10): spawn(producer, (c,)) run()
Next: Re-integrate sprite stuff.