Re: [pygame] fast sqrt? and profiling

2009-01-21 Thread Casey Duncan
On Jan 21, 2009, at 7:28 PM, Jake b wrote: First: Thanks everyone for all the replies. Lots of useful information. On Wed, Jan 21, 2009 at 11:11 AM, Casey Duncan wrote: Others have made good suggestions about reducing the amount of work you do detecting collision (i.e., partitioning) and u

Re: [pygame] Python 2.6

2009-01-21 Thread Brian Fisher
On Wed, Jan 21, 2009 at 6:53 PM, Yanom Mobis wrote: > Is there any good reason to switch to python 2.6, even though 2.5 is the > supported python on my Linux distro? > > one "good reason" is because you want most of the goodness that you can get from 3.0 with very little of the breakage: http://d

Re: [pygame] Python 2.6

2009-01-21 Thread René Dudfield
hi, yeah, python 2.5 is the best python at the moment -- because it's more portable, and there are more libraries for it. Best not to overwrite your system python, as then it could break system tools. It seems new enough to use :) chairs, On Thu, Jan 22, 2009 at 1:53 PM, Yanom Mobis wrote:

[pygame] Python 2.6

2009-01-21 Thread Yanom Mobis
Is there any good reason to switch to python 2.6, even though 2.5 is the supported python on my Linux distro? If I do stick with Python 2.5, is it safe to override python2.5.2 with python2.5.4 ( $ cd Python-2.5.4 && ./configure && make && sudo make install )?

Re: [pygame] fast sqrt? and profiling

2009-01-21 Thread Jake b
First: Thanks everyone for all the replies. Lots of useful information. On Wed, Jan 21, 2009 at 11:11 AM, Casey Duncan wrote: > Others have made good suggestions about reducing the amount of work you do > detecting collision (i.e., partitioning) and using complex numbers instead > of euclid for

Re: [pygame] Pointer module

2009-01-21 Thread Stuart Axon
Just to answer my own question on multiple mice I found this http://code.google.com/p/pymultimouse/ Which seems to work in some quick testing 2009/1/22 Stuart Axon : > Are we still waiting on SDL for support for multiple mice? > > OT: > I want to try multiple pointing device on windows with pytho

Re: [pygame] Pointer module

2009-01-21 Thread Stuart Axon
Some feedback The code is nice and understandable, here are a few suggestions: Might be nice to use properties to access set_pos, get_pos then callers could just use .pos If a name isn't specified for the pointer, perhaps one could be generated? It may be worth differentiating between global p

Re: [pygame] Pointer module

2009-01-21 Thread Stuart Axon
Are we still waiting on SDL for support for multiple mice? OT: I want to try multiple pointing device on windows with python (just test with 2 mice and a tablet), any idea if this is feasable ? 2009/1/11 Thiago Chaves : > Hi, > > I decided to improve the UI on my recent project and decided to al

Re: [pygame] GMArcade Contest, PyGame Users Invited

2009-01-21 Thread Matt Kremer
Quoting Ian Mallett : This is ridiculous. Python is perfect for engineering games, and PyGame is an excellent tool to help. PyGame is supposed to be a tool of game developers. The OP is "look[ing] forward to maybe seeing some PyGame games entered"--why not actually use what PyGame was designed

Re: [pygame] fast sqrt? and profiling

2009-01-21 Thread Marius Gedminas
On Wed, Jan 21, 2009 at 01:43:37PM -0500, Michael George wrote: > Marius Gedminas wrote: >> On Wed, Jan 21, 2009 at 07:45:08AM -0800, Ian Mallett wrote: >> >>> math.hypot() is good for distance calculation. >> >> I did some microbenchmarks a while ago, and math.hypot() was faster than >> x**2 + y**

Re: [pygame] fast sqrt? and profiling

2009-01-21 Thread Michael George
Marius Gedminas wrote: On Wed, Jan 21, 2009 at 07:45:08AM -0800, Ian Mallett wrote: math.hypot() is good for distance calculation. I did some microbenchmarks a while ago, and math.hypot() was faster than x**2 + y**2. I was surprised. Still, avoiding O(n**2) algorithms would be best.

Re: [pygame] fast sqrt? and profiling

2009-01-21 Thread Marius Gedminas
On Wed, Jan 21, 2009 at 07:45:08AM -0800, Ian Mallett wrote: > math.hypot() is good for distance calculation. I did some microbenchmarks a while ago, and math.hypot() was faster than x**2 + y**2. I was surprised. Still, avoiding O(n**2) algorithms would be best. Marius Gedminas -- Anything can

Re: [pygame] fast sqrt? and profiling

2009-01-21 Thread Casey Duncan
Others have made good suggestions about reducing the amount of work you do detecting collision (i.e., partitioning) and using complex numbers instead of euclid for 2d vectors. The latter made a big performance difference for me in a vector-heavy game I was working on. If you don't want to i

Re: [pygame] GMArcade Contest, PyGame Users Invited

2009-01-21 Thread Ian Mallett
This is ridiculous. Python is perfect for engineering games, and PyGame is an excellent tool to help. PyGame is supposed to be a tool of game developers. The OP is "look[ing] forward to maybe seeing some PyGame games entered"--why not actually use what PyGame was designed for? If we say that pro

Re: [pygame] fast sqrt? and profiling

2009-01-21 Thread Ian Mallett
math.hypot() is good for distance calculation.

Re: [pygame] fast sqrt? and profiling

2009-01-21 Thread Emile Kroeger
Yeah, reducing the number of distances compared is probably a bigger improvement than accelerating a single comparison. Still, your star example could also be sped up by using squared distances instead of distances. Squared distances works just as well for sorting and comparison, i.e. finding all

Re: [pygame] fast sqrt? and profiling

2009-01-21 Thread Knapp
On Wed, Jan 21, 2009 at 12:26 PM, Emile Kroeger wrote: > You don't need to use sqrt in your collide_circle > > If you use complex numbers to represent 2D positions (which simplifies > a lot of operations), you can do something like this: > > def sqrlen(vector): >"Returns the square of a vector

Re: [pygame] fast sqrt? and profiling

2009-01-21 Thread Emile Kroeger
You don't need to use sqrt in your collide_circle If you use complex numbers to represent 2D positions (which simplifies a lot of operations), you can do something like this: def sqrlen(vector): "Returns the square of a vector (that's represented as a complex number)" return vector.real**

Re: [pygame] Status of Iphone pygame?

2009-01-21 Thread René Dudfield
Or nokia I guess. They have a store now too... selling directly from the phone. Also they support python. On Wed, Jan 21, 2009 at 6:44 PM, Scott Beckstead wrote: > Damn It's already written in Python, I guess I'll have to re-write it > then. Or maybe port it to the G1 instead. > > > On Tue, J