[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] using opengl in pygame?
On Fri, 3 Sep 2004, Jan Ekholm wrote:
> On Thu, 2 Sep 2004, Jasper Phillips wrote:
>
> >My experimentation with Twisted stopped more than a year ago. Now I simply
> >use it, and it works nicely. I highly recommend it.
>
> Can you also recommend some tutorial material that helped you along the
> way? I think I had better have a look at this thing, so that I don't later
> in my life wake up and know I've missed out on something exceptional. :)
I just used the ones that are on the Twisted website. The examples I used
for "Perspective Broker" TCP connections were pretty good, but I can't
comment on the rest of the expansive framework.
> >I don't understand people's fixation with the "main loop". It's a very
> >small bit of code, which does little of interest. You can still plug
> >whatever you like into it's thin wrapper -- and honestly, what do you gain
> >from scheduling network events in your own loop? It's not like you have
> >complete control anyway, since the OS handles the true "main loop". The
> >only problem I've seen is that it's a bit tricky to combine with other
> >frameworks that want to do the same thing (e.g. wxPython), but only just a
> >bit since it's easy to time slice one into the other.
>
> Well, if you do animation and other stuff that is somewhat time critical
> it's nice to know that you have control of when the system will perform
> heavy and/or blocking stuff. You can also decide that some parts of your
> loop are less important and can be scheduled only every tenth iteration or
> something similar.
You have good control of scheduling, enough to schedule things at different
times and rates, etc. I don't have any problem with animation, but I have a
turn based game, so of course Twisted isn't doing anything most of the time.
If you had a real time game this might be more complex, but even then UDP
packets come in pretty small chunks so it shouldn't be a problem getting
your main loop's scheduled time slices.
In any event, it's certainly possible to time slice Twisted's framework into
your own loop. IMHO this is a bad idea, but it's not difficult. You can
also spawn other processes for work if necessary.
-Jasper