Re: [pygame] blit anomalies in pygame 1.8.1release (2)

2008-08-15 Thread Nicholas Dudfield
Lenard, Rene and co,

>> There is no unit test for blitting a SRCALPHA source with non-zero alpha
to a SRCALPHA destination with non-zero alpha

I'm writing some tests for surface.blit atm. What is the expected behaviour
of such an operation?

def test_blit__SRCALPHA_to_SRCALPHA_non_zero(self):
# " There is no unit test for blitting a SRCALPHA source with
non-zero
#   alpha to a SRCALPHA destination with non-zero alpha " LL

w,h = size = 32,32

s = pygame.Surface(size, pygame.SRCALPHA, 32)
s2 = s.copy()

s.fill((32,32,32,111))
s2.fill((32,32,32,31))

s.blit(s2, (0,0))

# TODO:
# what is the correct behaviour ?? should it blend? what algorithm?

self.assertEquals(s.get_at((0,0)), (32,32,32,31))

Cheers. I'm not sure here.

Also, wrt to the blitting opaque source behaviour, are we considering this a
bug? A failed test? I'm that way inclined and have written a test for that,
will wait for approval before committing.

def test_blit__SRCALPHA_opaque_source(self):
src = pygame.Surface( (256,256), SRCALPHA ,32)
dst = src.copy()

for i, j in test_utils.rect_area_pts(src.get_rect()):
dst.set_at( (i,j), (i,0,0,j) )
src.set_at( (i,j), (0,i,0,255) )

dst.blit(src, (0,0))

for pt in test_utils.rect_area_pts(src.get_rect()):
self.assertEquals ( dst.get_at(pt)[1], src.get_at(pt)[1] )


Re: [pygame] Another blitting surface to itself crash

2008-08-15 Thread Nicholas Dudfield
I had a little play with the test_blit_to_self.py:

SDL VERSION:

1.2.13 prebuilts

PYGAME:

Mingw compiled, svn r 1619

OBSERVATIONS:

Unmodified the test wouldn't run at all as noted earlier.

I don't know if it's any help but I noticed after commenting out the
"blitting screen to self" section that I could get the "blitting surface to
self" test and "blitting surface to screen" to run the full 100 cycles if I
instantiated the Surface `a` with pygame.SRCALPHA flags.

Also, if using BLEND_RGB_ADD flags "blitting screen to self" worked. Also
screen.copy() worked as a source... but eh.

CONCLUSIONS:

s.blit(s, (0,0)) works if SRCALPHA bits set for s
screen.blit(screen, step, None, pygame.BLEND_RGB_ADD)

Is that any help for you guys in debugging?? I have no C-fu or I would have
a tinker myself.

Cheers.

ps... attached modified version of test with "use alpha blit" changes


pps.

This is in surface.c around line 1996 ??

/* see if we should handle alpha ourselves */
if (dst->format->Amask && (dst->flags & SDL_SRCALPHA) &&
!(src->format->Amask && !(src->flags & SDL_SRCALPHA)) &&
/* special case, SDL works */
(dst->format->BytesPerPixel == 2 || dst->format->BytesPerPixel ==
4))
{
result = pygame_AlphaBlit (src, srcrect, dst, dstrect, the_args);
}
else if (the_args != 0)
{
result = pygame_Blit (src, srcrect, dst, dstrect, the_args);
}
else
{
result = SDL_BlitSurface (src, srcrect, dst, dstrect);
}
import pygame
import random
import math
import sys

print pygame.get_sdl_version()

# pygame.FULLSCREEN#create a fullscreen display
# pygame.DOUBLEBUF #recommended for HWSURFACE or OPENGL
# pygame.HWSURFACE #hardware accelerated, only in FULLSCREEN
# pygame.OPENGL#create an opengl renderable display
# pygame.RESIZABLE #display window should be sizeable
# pygame.NOFRAME   #display window will have no border or controls

screen = pygame.display.set_mode((800, 600))

num_runs = 100
scroll_step = 100
for i in xrange(num_runs):
print "pass",i
test_width = random.randint(10,400)
test_height = random.randint(10,400)

# An optional special flags is for passing in new in 1.8.0: BLEND_ADD,

# BLEND_SUB, BLEND_MULT, BLEND_MIN, BLEND_MAX new in 1.8.1:
# BLEND_RGBA_ADD, BLEND_RGBA_SUB, BLEND_RGBA_MULT, BLEND_RGBA_MIN,
# BLEND_RGBA_MAX BLEND_RGB_ADD, BLEND_RGB_SUB, BLEND_RGB_MULT,
# BLEND_RGB_MIN, BLEND_RGB_MAX With other special blitting flags
# perhaps added in the future.

a = pygame.Surface((test_width, test_height), pygame.SRCALPHA)

a.fill((random.randint(0,255), random.randint(0,255), random.randint(0,255)))
try:
pygame.draw.line(a, (255,255,255), (0,0), (test_width, test_height), 10)
except:
pass
print "blitting surface to self"
sys.stdout.flush()
a.blit(a, (random.randint(-test_width, test_width), random.randint(-test_height, test_height)))

angle = (2.0*math.pi*i)/num_runs
step = (math.cos(angle)*scroll_step, math.sin(angle)*scroll_step)
print "blitting screen to self"
sys.stdout.flush()
screen.blit(screen, step, None, pygame.BLEND_RGB_ADD)

print "blitting surface to screen"
sys.stdout.flush()
screen.blit(a, (random.randint(-test_width, 800), random.randint(-test_height, 600)))
pygame.event.get()
pygame.display.flip()

Re: [pygame] Physics module status note, more things...

2008-08-15 Thread Greg Ewing

Peter Gebauer wrote:

I don't have a clue about the math involved to calculate the force, but I 
could give it a stab.


As Archimedes pointed out, the upward force on an immersed
body is equal to the weight of water it displaces. So just
apply a force proportional to the volume that is under
the water.

You'll also want a drag force proportional to the velocity
of the body and the immersed volume, to stop it from
accelerating indefinitely while submerged, and to damp
down oscillations when it's floating on the surface.

--
Greg


Re: [pygame] Physics module status note, more things...

2008-08-15 Thread Greg Ewing

[EMAIL PROTECTED] wrote:

you could e.g. split the screen
into "sky" and "sea", being two different worlds. If the body reaches a
certain point, you could remove it from "sea" and add it to "sky"


This wouldn't simulate floating on the surface very
well, though. The body should reach equilibrium when
some proportion of it is under the water, but with
this scheme it would oscillate endlessly between the
sky and water.

--
Greg


Re: [pygame] changes from pygame 1.7.1 to pygame 1.8.1

2008-08-15 Thread René Dudfield
hi,

thanks for the report.

If you could make a small test case that crashes, or just post the
function body that crashes that'd be a big help in tracking down the
problem.


cu.

On Fri, Aug 15, 2008 at 1:21 AM, sy12 <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Here are the changes that I have noticed on Windows XP when porting my
> game from Python 2.4 / pygame 1.7.1 to Python 2.5 / pygame 1.8.1
> (actually after moving back to Python 2.5 / pygame 1.7.1 the changes
> have disappeared, so they are probably linked to pygame 1.8.1).
>
> 1. The F10 keypress event now reaches the window, and activates the
> window menu (maximize, move, close, ...), so the F10 key is not usable
> anymore.
>
> 2. The game crashes after a display feature is activated (I haven't
> located the exact line that causes the crash, but it's a function that
> uses draw_line, display.flip, draw_rect, blit ; I can locate the line
> but I would have to reinstall 1.8.1 ; in the worst case I will check
> if the next version fixes this problem, since there are already
> reports about the blit function).
>
> Additionally, I have noticed that the pygame.mixer.find_channel()
> function still can return a reserved channel (I don't have a simple
> enough program to guarantee this; at least the Sound.play() method
> seemed to avoid the reserved channels).
>
> Hope it helps.
>


Re: [pygame] pgu broken with pygame 1.8.1release ? - patch for one bug(crash)

2008-08-15 Thread Emanuel Berg
http://www.pygame.org/docs/ref/color.html

I found this on wikipedia, but not the other formats. Maybe there is a
better place to look?

http://en.wikipedia.org/wiki/CMYK


On Fri, Aug 15, 2008 at 6:51 PM, Brian Fisher <[EMAIL PROTECTED]> wrote:
> The Color changes in pygame 1.8.1 will only break things that use Color,
> right?
>
> so where is Color documented? I don't see it here:
> http://www.pygame.org/docs/
>
> On Thu, Aug 14, 2008 at 5:49 PM, René Dudfield <[EMAIL PROTECTED]> wrote:
>>
>> This is annoying, because pgu is used by a lot of games.  So the Color
>> changes in pygame 1.8.1 will break a lot of things.  Well, they'll
>> need to patch pgu.
>>
>>
>
>


Re: [pygame] PyGameDB coming along well

2008-08-15 Thread Richie Ward
Nice but its not been updated for almost a year. -
http://svn.python.org/view/python/branches/bcannon-objcap/
I dont think it has full support and I think it needs to be put into
python and enabled/disabled with a module of some sort.

On Fri, Aug 15, 2008 at 9:48 PM, Noah Kantrowitz <[EMAIL PROTECTED]> wrote:
> Look in to Brett's work on a secure interpreter system. He gave a talk at
> pycon '07 about it IIRC.
>
> --Noah
>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> On Behalf Of Richie Ward
>> Sent: Friday, August 15, 2008 1:45 PM
>> To: pygame-users@seul.org
>> Subject: Re: [pygame] PyGameDB coming along well
>>
>> Ok, I tried this in the python code itself and it says "Operation not
>> permitted" on ubuntu. I suppose its unlikely to be able to run as
>> another user without asking for the root password.
>>
>> I cant think of any good way to make it perfectly secure while keeping
>> the cross platform capability and not having to significantly modify
>> all the pygame's. The source code to games will be available and I
>> suppose the community can find and report bad scripts.
>>
>>
>> On Fri, Aug 15, 2008 at 9:10 PM, Dan Krol <[EMAIL PROTECTED]> wrote:
>> > Er, I forgot to add that part of my idea included running the thing
>> in
>> > its own user, so your other files were safe. I wonder if Ubuntu would
>> > want to automatically set up something like that when you install it?
>> >
>> > On Fri, Aug 15, 2008 at 3:06 PM, Dan Krol <[EMAIL PROTECTED]>
>> wrote:
>> >> Ah userland, excellent. I was also thinking about keeping it in
>> >> userland when I was thinking about this concept. That way, you
>> >> wouldn't even need to trust the repo very much.
>> >>
>> >> Again, awesome.
>> >>
>> >> On Fri, Aug 15, 2008 at 2:48 PM, Richie Ward <[EMAIL PROTECTED]>
>> wrote:
>> >>> It will be up to the repo to moderate the security of packages.
>> >>>
>> >>> I plan to have a policy of moderation on my own repository, once
>> its ready.
>> >>> I will give moderation privileges to trusted and experienced python
>> >>> programmers, and ban people that abuse it. Anyone is free to set up
>> >>> their own game repository though!
>> >>>
>> >>> It runs entirely in userland, it does not need administrator
>> >>> privileges. It does not use python's site-packages system.
>> >>>
>> >>> I plan to have a sophisticated searching system including tags, so
>> >>> pyweek games can have a pyweek tag and their website could instruct
>> >>> their users to search for a tag, adventure games get a adventure
>> tag
>> >>> etc...
>> >>> Other plans include translation into other languages.
>> >>>
>> >>> Perhaps i could think of a way to allow more than one picture,
>> >>> dropdown box maybe? or maybe you click it and it shows next one
>> like a
>> >>> slideshow. I want to keep the GUI simple, accessible and easy to
>> use.
>> >>>
>> >>> Also remember, this isnt just for Linux but I have plans to get it
>> >>> packaged into ubuntu :)
>> >>>
>> >>> On Fri, Aug 15, 2008 at 7:43 PM, Dan Krol <[EMAIL PROTECTED]>
>> wrote:
>>  This is fantastic, I didn't know this was in the works. I was
>> always
>>  thinking, for open source games to take off, there needs to be a
>> good
>>  catalog of games that people can browse, and it has to be flashy,
>> but
>>  it has to show off the big advantage of open source games, which
>> is
>>  that unlike other catalogs (like Steam), you can download it and
>> play
>>  the whole thing, right now.
>> 
>>  For it to be attractive to users, though, I think It would be
>> really
>>  nice if the games were categorized, had nice screenshots, etc. It
>>  should be like an advertisement, so people will be likely to check
>> it
>>  out. But that's just my take.
>> 
>>  The only question I have is, is there any regard for security? Are
>> the
>>  games being looked over before they're added to the repo? Etc. I'm
>>  perhaps naive and overly worried, I'm not familiar with how
>> carefully
>>  Linux distros (for instance) usually handle this sort of thing.
>> 
>>  Thanks,
>> 
>>  Dan
>> 
>>  On Fri, Aug 15, 2008 at 12:57 PM, Noah Kantrowitz
>> <[EMAIL PROTECTED]> wrote:
>> > Not to point out the obvious or anything, but why would you not
>> just use
>> > pygame.org, which already has a big database of games. Just add
>> an API for
>> > getting the metadata you need and be done with it.
>> >
>> > --Noah
>> >
>> >> -Original Message-
>> >> From: [EMAIL PROTECTED] [mailto:owner-pygame-
>> [EMAIL PROTECTED]
>> >> On Behalf Of Richie Ward
>> >> Sent: Friday, August 15, 2008 10:25 AM
>> >> To: pygame-users@seul.org
>> >> Subject: [pygame] PyGameDB coming along well
>> >>
>> >> The PyGameDB project which has similarity's to the commercial
>> platform
>> >> "Steam" is coming to a usable state.
>> >>
>> >> It is programmed in Python + W

RE: [pygame] PyGameDB coming along well

2008-08-15 Thread Noah Kantrowitz
Look in to Brett's work on a secure interpreter system. He gave a talk at
pycon '07 about it IIRC.

--Noah

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Richie Ward
> Sent: Friday, August 15, 2008 1:45 PM
> To: pygame-users@seul.org
> Subject: Re: [pygame] PyGameDB coming along well
> 
> Ok, I tried this in the python code itself and it says "Operation not
> permitted" on ubuntu. I suppose its unlikely to be able to run as
> another user without asking for the root password.
> 
> I cant think of any good way to make it perfectly secure while keeping
> the cross platform capability and not having to significantly modify
> all the pygame's. The source code to games will be available and I
> suppose the community can find and report bad scripts.
> 
> 
> On Fri, Aug 15, 2008 at 9:10 PM, Dan Krol <[EMAIL PROTECTED]> wrote:
> > Er, I forgot to add that part of my idea included running the thing
> in
> > its own user, so your other files were safe. I wonder if Ubuntu would
> > want to automatically set up something like that when you install it?
> >
> > On Fri, Aug 15, 2008 at 3:06 PM, Dan Krol <[EMAIL PROTECTED]>
> wrote:
> >> Ah userland, excellent. I was also thinking about keeping it in
> >> userland when I was thinking about this concept. That way, you
> >> wouldn't even need to trust the repo very much.
> >>
> >> Again, awesome.
> >>
> >> On Fri, Aug 15, 2008 at 2:48 PM, Richie Ward <[EMAIL PROTECTED]>
> wrote:
> >>> It will be up to the repo to moderate the security of packages.
> >>>
> >>> I plan to have a policy of moderation on my own repository, once
> its ready.
> >>> I will give moderation privileges to trusted and experienced python
> >>> programmers, and ban people that abuse it. Anyone is free to set up
> >>> their own game repository though!
> >>>
> >>> It runs entirely in userland, it does not need administrator
> >>> privileges. It does not use python's site-packages system.
> >>>
> >>> I plan to have a sophisticated searching system including tags, so
> >>> pyweek games can have a pyweek tag and their website could instruct
> >>> their users to search for a tag, adventure games get a adventure
> tag
> >>> etc...
> >>> Other plans include translation into other languages.
> >>>
> >>> Perhaps i could think of a way to allow more than one picture,
> >>> dropdown box maybe? or maybe you click it and it shows next one
> like a
> >>> slideshow. I want to keep the GUI simple, accessible and easy to
> use.
> >>>
> >>> Also remember, this isnt just for Linux but I have plans to get it
> >>> packaged into ubuntu :)
> >>>
> >>> On Fri, Aug 15, 2008 at 7:43 PM, Dan Krol <[EMAIL PROTECTED]>
> wrote:
>  This is fantastic, I didn't know this was in the works. I was
> always
>  thinking, for open source games to take off, there needs to be a
> good
>  catalog of games that people can browse, and it has to be flashy,
> but
>  it has to show off the big advantage of open source games, which
> is
>  that unlike other catalogs (like Steam), you can download it and
> play
>  the whole thing, right now.
> 
>  For it to be attractive to users, though, I think It would be
> really
>  nice if the games were categorized, had nice screenshots, etc. It
>  should be like an advertisement, so people will be likely to check
> it
>  out. But that's just my take.
> 
>  The only question I have is, is there any regard for security? Are
> the
>  games being looked over before they're added to the repo? Etc. I'm
>  perhaps naive and overly worried, I'm not familiar with how
> carefully
>  Linux distros (for instance) usually handle this sort of thing.
> 
>  Thanks,
> 
>  Dan
> 
>  On Fri, Aug 15, 2008 at 12:57 PM, Noah Kantrowitz
> <[EMAIL PROTECTED]> wrote:
> > Not to point out the obvious or anything, but why would you not
> just use
> > pygame.org, which already has a big database of games. Just add
> an API for
> > getting the metadata you need and be done with it.
> >
> > --Noah
> >
> >> -Original Message-
> >> From: [EMAIL PROTECTED] [mailto:owner-pygame-
> [EMAIL PROTECTED]
> >> On Behalf Of Richie Ward
> >> Sent: Friday, August 15, 2008 10:25 AM
> >> To: pygame-users@seul.org
> >> Subject: [pygame] PyGameDB coming along well
> >>
> >> The PyGameDB project which has similarity's to the commercial
> platform
> >> "Steam" is coming to a usable state.
> >>
> >> It is programmed in Python + WxPython.
> >> It works by adding the game to sys.path and importing the game
> (very
> >> simplified way to put it).
> >> It uses a XML file to get a list of PyGame's. It will also work
> with
> >> other types of python games, including opengl based ones, as
> long as
> >> they are open source.
> >> A huge feature is that it will make it easy to deploy pygame's
> since
> >> you do not need to package

Re: [pygame] PyGameDB coming along well

2008-08-15 Thread Richie Ward
Ok, I tried this in the python code itself and it says "Operation not
permitted" on ubuntu. I suppose its unlikely to be able to run as
another user without asking for the root password.

I cant think of any good way to make it perfectly secure while keeping
the cross platform capability and not having to significantly modify
all the pygame's. The source code to games will be available and I
suppose the community can find and report bad scripts.


On Fri, Aug 15, 2008 at 9:10 PM, Dan Krol <[EMAIL PROTECTED]> wrote:
> Er, I forgot to add that part of my idea included running the thing in
> its own user, so your other files were safe. I wonder if Ubuntu would
> want to automatically set up something like that when you install it?
>
> On Fri, Aug 15, 2008 at 3:06 PM, Dan Krol <[EMAIL PROTECTED]> wrote:
>> Ah userland, excellent. I was also thinking about keeping it in
>> userland when I was thinking about this concept. That way, you
>> wouldn't even need to trust the repo very much.
>>
>> Again, awesome.
>>
>> On Fri, Aug 15, 2008 at 2:48 PM, Richie Ward <[EMAIL PROTECTED]> wrote:
>>> It will be up to the repo to moderate the security of packages.
>>>
>>> I plan to have a policy of moderation on my own repository, once its ready.
>>> I will give moderation privileges to trusted and experienced python
>>> programmers, and ban people that abuse it. Anyone is free to set up
>>> their own game repository though!
>>>
>>> It runs entirely in userland, it does not need administrator
>>> privileges. It does not use python's site-packages system.
>>>
>>> I plan to have a sophisticated searching system including tags, so
>>> pyweek games can have a pyweek tag and their website could instruct
>>> their users to search for a tag, adventure games get a adventure tag
>>> etc...
>>> Other plans include translation into other languages.
>>>
>>> Perhaps i could think of a way to allow more than one picture,
>>> dropdown box maybe? or maybe you click it and it shows next one like a
>>> slideshow. I want to keep the GUI simple, accessible and easy to use.
>>>
>>> Also remember, this isnt just for Linux but I have plans to get it
>>> packaged into ubuntu :)
>>>
>>> On Fri, Aug 15, 2008 at 7:43 PM, Dan Krol <[EMAIL PROTECTED]> wrote:
 This is fantastic, I didn't know this was in the works. I was always
 thinking, for open source games to take off, there needs to be a good
 catalog of games that people can browse, and it has to be flashy, but
 it has to show off the big advantage of open source games, which is
 that unlike other catalogs (like Steam), you can download it and play
 the whole thing, right now.

 For it to be attractive to users, though, I think It would be really
 nice if the games were categorized, had nice screenshots, etc. It
 should be like an advertisement, so people will be likely to check it
 out. But that's just my take.

 The only question I have is, is there any regard for security? Are the
 games being looked over before they're added to the repo? Etc. I'm
 perhaps naive and overly worried, I'm not familiar with how carefully
 Linux distros (for instance) usually handle this sort of thing.

 Thanks,

 Dan

 On Fri, Aug 15, 2008 at 12:57 PM, Noah Kantrowitz <[EMAIL PROTECTED]> 
 wrote:
> Not to point out the obvious or anything, but why would you not just use
> pygame.org, which already has a big database of games. Just add an API for
> getting the metadata you need and be done with it.
>
> --Noah
>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> On Behalf Of Richie Ward
>> Sent: Friday, August 15, 2008 10:25 AM
>> To: pygame-users@seul.org
>> Subject: [pygame] PyGameDB coming along well
>>
>> The PyGameDB project which has similarity's to the commercial platform
>> "Steam" is coming to a usable state.
>>
>> It is programmed in Python + WxPython.
>> It works by adding the game to sys.path and importing the game (very
>> simplified way to put it).
>> It uses a XML file to get a list of PyGame's. It will also work with
>> other types of python games, including opengl based ones, as long as
>> they are open source.
>> A huge feature is that it will make it easy to deploy pygame's since
>> you do not need to package them as a .exe.
>> It allows anyone to make a game repository, the XML file url can be
>> set inside the application!
>>
>> I am currently looking for help with:
>> * The pygamedb-server which is a website programmed in cherrypy or
>> pylons which will allow people to submit/upload games and generates
>> the resulting xml file.
>> * Beta testers for the client and someone that can test it on Mac OSX
>> * Someone to make me a pygamedb logo, I am useless with graphics!
>> * Someone with knowlege of WxPython thats willing to help with the
>

Re: [pygame] Physics module status note

2008-08-15 Thread Hugo Arts
most of python's math functions like asin en atan (from math) return
their values in radians, and sin and tan take their arguments as
radians. So using radians is more common than degrees.
Conversion is also pretty trivial, using math.radians and math.degrees.

Hugo

On Fri, Aug 15, 2008 at 6:53 AM, Peter Gebauer
<[EMAIL PROTECTED]> wrote:
> Hi!
>
> Hm, I've been experimenting a bit now and I wonder about the
> body.rotation, it's using radians. Wouldn't it make more sense to use
> degrees in the API for all angle values?
>
> On 2008-08-14 (Thu) 21:35, Marcus von Appen wrote:
>> On, Thu Aug 14, 2008, Peter Gebauer wrote:
>>
>> [...]
>> > Too early for a wishlist? :)
>>
>> No, but do not expect it to be implemented within the next days
>> ;-). We'd be happy to discuss and put your wishes on the TODO list.
>>
>> Regards
>> Marcus
>
>
>


Re: [pygame] PyGameDB coming along well

2008-08-15 Thread Dan Krol
Er, I forgot to add that part of my idea included running the thing in
its own user, so your other files were safe. I wonder if Ubuntu would
want to automatically set up something like that when you install it?

On Fri, Aug 15, 2008 at 3:06 PM, Dan Krol <[EMAIL PROTECTED]> wrote:
> Ah userland, excellent. I was also thinking about keeping it in
> userland when I was thinking about this concept. That way, you
> wouldn't even need to trust the repo very much.
>
> Again, awesome.
>
> On Fri, Aug 15, 2008 at 2:48 PM, Richie Ward <[EMAIL PROTECTED]> wrote:
>> It will be up to the repo to moderate the security of packages.
>>
>> I plan to have a policy of moderation on my own repository, once its ready.
>> I will give moderation privileges to trusted and experienced python
>> programmers, and ban people that abuse it. Anyone is free to set up
>> their own game repository though!
>>
>> It runs entirely in userland, it does not need administrator
>> privileges. It does not use python's site-packages system.
>>
>> I plan to have a sophisticated searching system including tags, so
>> pyweek games can have a pyweek tag and their website could instruct
>> their users to search for a tag, adventure games get a adventure tag
>> etc...
>> Other plans include translation into other languages.
>>
>> Perhaps i could think of a way to allow more than one picture,
>> dropdown box maybe? or maybe you click it and it shows next one like a
>> slideshow. I want to keep the GUI simple, accessible and easy to use.
>>
>> Also remember, this isnt just for Linux but I have plans to get it
>> packaged into ubuntu :)
>>
>> On Fri, Aug 15, 2008 at 7:43 PM, Dan Krol <[EMAIL PROTECTED]> wrote:
>>> This is fantastic, I didn't know this was in the works. I was always
>>> thinking, for open source games to take off, there needs to be a good
>>> catalog of games that people can browse, and it has to be flashy, but
>>> it has to show off the big advantage of open source games, which is
>>> that unlike other catalogs (like Steam), you can download it and play
>>> the whole thing, right now.
>>>
>>> For it to be attractive to users, though, I think It would be really
>>> nice if the games were categorized, had nice screenshots, etc. It
>>> should be like an advertisement, so people will be likely to check it
>>> out. But that's just my take.
>>>
>>> The only question I have is, is there any regard for security? Are the
>>> games being looked over before they're added to the repo? Etc. I'm
>>> perhaps naive and overly worried, I'm not familiar with how carefully
>>> Linux distros (for instance) usually handle this sort of thing.
>>>
>>> Thanks,
>>>
>>> Dan
>>>
>>> On Fri, Aug 15, 2008 at 12:57 PM, Noah Kantrowitz <[EMAIL PROTECTED]> wrote:
 Not to point out the obvious or anything, but why would you not just use
 pygame.org, which already has a big database of games. Just add an API for
 getting the metadata you need and be done with it.

 --Noah

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Richie Ward
> Sent: Friday, August 15, 2008 10:25 AM
> To: pygame-users@seul.org
> Subject: [pygame] PyGameDB coming along well
>
> The PyGameDB project which has similarity's to the commercial platform
> "Steam" is coming to a usable state.
>
> It is programmed in Python + WxPython.
> It works by adding the game to sys.path and importing the game (very
> simplified way to put it).
> It uses a XML file to get a list of PyGame's. It will also work with
> other types of python games, including opengl based ones, as long as
> they are open source.
> A huge feature is that it will make it easy to deploy pygame's since
> you do not need to package them as a .exe.
> It allows anyone to make a game repository, the XML file url can be
> set inside the application!
>
> I am currently looking for help with:
> * The pygamedb-server which is a website programmed in cherrypy or
> pylons which will allow people to submit/upload games and generates
> the resulting xml file.
> * Beta testers for the client and someone that can test it on Mac OSX
> * Someone to make me a pygamedb logo, I am useless with graphics!
> * Someone with knowlege of WxPython thats willing to help with the
> client gui.
>
> The project is currently missing a big feature, dependency/library
> support (It ignores that in the xml file right now). That will be
> finished very soon.
>
> You can see a screenshot here:
> http://richies.googlepages.com/Screenshot-1.png
> The test repo is hosted here: http://pygamedb.4rensics.org/
> The test XML Data file  is here:
> http://pygamedb.4rensics.org/pygamedb.xml
>
> I plan to get a domain name once pygamedb-server is done.. pygamedb.org
> maybe?
>
> Getting it
> ===
> The project lives at: https://launchpad

Re: [pygame] PyGameDB coming along well

2008-08-15 Thread Dan Krol
Ah userland, excellent. I was also thinking about keeping it in
userland when I was thinking about this concept. That way, you
wouldn't even need to trust the repo very much.

Again, awesome.

On Fri, Aug 15, 2008 at 2:48 PM, Richie Ward <[EMAIL PROTECTED]> wrote:
> It will be up to the repo to moderate the security of packages.
>
> I plan to have a policy of moderation on my own repository, once its ready.
> I will give moderation privileges to trusted and experienced python
> programmers, and ban people that abuse it. Anyone is free to set up
> their own game repository though!
>
> It runs entirely in userland, it does not need administrator
> privileges. It does not use python's site-packages system.
>
> I plan to have a sophisticated searching system including tags, so
> pyweek games can have a pyweek tag and their website could instruct
> their users to search for a tag, adventure games get a adventure tag
> etc...
> Other plans include translation into other languages.
>
> Perhaps i could think of a way to allow more than one picture,
> dropdown box maybe? or maybe you click it and it shows next one like a
> slideshow. I want to keep the GUI simple, accessible and easy to use.
>
> Also remember, this isnt just for Linux but I have plans to get it
> packaged into ubuntu :)
>
> On Fri, Aug 15, 2008 at 7:43 PM, Dan Krol <[EMAIL PROTECTED]> wrote:
>> This is fantastic, I didn't know this was in the works. I was always
>> thinking, for open source games to take off, there needs to be a good
>> catalog of games that people can browse, and it has to be flashy, but
>> it has to show off the big advantage of open source games, which is
>> that unlike other catalogs (like Steam), you can download it and play
>> the whole thing, right now.
>>
>> For it to be attractive to users, though, I think It would be really
>> nice if the games were categorized, had nice screenshots, etc. It
>> should be like an advertisement, so people will be likely to check it
>> out. But that's just my take.
>>
>> The only question I have is, is there any regard for security? Are the
>> games being looked over before they're added to the repo? Etc. I'm
>> perhaps naive and overly worried, I'm not familiar with how carefully
>> Linux distros (for instance) usually handle this sort of thing.
>>
>> Thanks,
>>
>> Dan
>>
>> On Fri, Aug 15, 2008 at 12:57 PM, Noah Kantrowitz <[EMAIL PROTECTED]> wrote:
>>> Not to point out the obvious or anything, but why would you not just use
>>> pygame.org, which already has a big database of games. Just add an API for
>>> getting the metadata you need and be done with it.
>>>
>>> --Noah
>>>
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of Richie Ward
 Sent: Friday, August 15, 2008 10:25 AM
 To: pygame-users@seul.org
 Subject: [pygame] PyGameDB coming along well

 The PyGameDB project which has similarity's to the commercial platform
 "Steam" is coming to a usable state.

 It is programmed in Python + WxPython.
 It works by adding the game to sys.path and importing the game (very
 simplified way to put it).
 It uses a XML file to get a list of PyGame's. It will also work with
 other types of python games, including opengl based ones, as long as
 they are open source.
 A huge feature is that it will make it easy to deploy pygame's since
 you do not need to package them as a .exe.
 It allows anyone to make a game repository, the XML file url can be
 set inside the application!

 I am currently looking for help with:
 * The pygamedb-server which is a website programmed in cherrypy or
 pylons which will allow people to submit/upload games and generates
 the resulting xml file.
 * Beta testers for the client and someone that can test it on Mac OSX
 * Someone to make me a pygamedb logo, I am useless with graphics!
 * Someone with knowlege of WxPython thats willing to help with the
 client gui.

 The project is currently missing a big feature, dependency/library
 support (It ignores that in the xml file right now). That will be
 finished very soon.

 You can see a screenshot here:
 http://richies.googlepages.com/Screenshot-1.png
 The test repo is hosted here: http://pygamedb.4rensics.org/
 The test XML Data file  is here:
 http://pygamedb.4rensics.org/pygamedb.xml

 I plan to get a domain name once pygamedb-server is done.. pygamedb.org
 maybe?

 Getting it
 ===
 The project lives at: https://launchpad.net/pygamedb

 Windows
 http://launchpad.net/bzr/1.6/1.6beta3/+download/bzr-setup-1.6b3.exe
 http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-
 2.8.8.1-py25.exe
 http://sourceforge.net/project/showfiles.php?group_id=78018
 Install all of the above.

 Debian/Ubuntu
 python-wxgtk2.8, bzr

 Once you installed that, Run this 

Re: [pygame] PyGameDB coming along well

2008-08-15 Thread Richie Ward
It will be up to the repo to moderate the security of packages.

I plan to have a policy of moderation on my own repository, once its ready.
I will give moderation privileges to trusted and experienced python
programmers, and ban people that abuse it. Anyone is free to set up
their own game repository though!

It runs entirely in userland, it does not need administrator
privileges. It does not use python's site-packages system.

I plan to have a sophisticated searching system including tags, so
pyweek games can have a pyweek tag and their website could instruct
their users to search for a tag, adventure games get a adventure tag
etc...
Other plans include translation into other languages.

Perhaps i could think of a way to allow more than one picture,
dropdown box maybe? or maybe you click it and it shows next one like a
slideshow. I want to keep the GUI simple, accessible and easy to use.

Also remember, this isnt just for Linux but I have plans to get it
packaged into ubuntu :)

On Fri, Aug 15, 2008 at 7:43 PM, Dan Krol <[EMAIL PROTECTED]> wrote:
> This is fantastic, I didn't know this was in the works. I was always
> thinking, for open source games to take off, there needs to be a good
> catalog of games that people can browse, and it has to be flashy, but
> it has to show off the big advantage of open source games, which is
> that unlike other catalogs (like Steam), you can download it and play
> the whole thing, right now.
>
> For it to be attractive to users, though, I think It would be really
> nice if the games were categorized, had nice screenshots, etc. It
> should be like an advertisement, so people will be likely to check it
> out. But that's just my take.
>
> The only question I have is, is there any regard for security? Are the
> games being looked over before they're added to the repo? Etc. I'm
> perhaps naive and overly worried, I'm not familiar with how carefully
> Linux distros (for instance) usually handle this sort of thing.
>
> Thanks,
>
> Dan
>
> On Fri, Aug 15, 2008 at 12:57 PM, Noah Kantrowitz <[EMAIL PROTECTED]> wrote:
>> Not to point out the obvious or anything, but why would you not just use
>> pygame.org, which already has a big database of games. Just add an API for
>> getting the metadata you need and be done with it.
>>
>> --Noah
>>
>>> -Original Message-
>>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>>> On Behalf Of Richie Ward
>>> Sent: Friday, August 15, 2008 10:25 AM
>>> To: pygame-users@seul.org
>>> Subject: [pygame] PyGameDB coming along well
>>>
>>> The PyGameDB project which has similarity's to the commercial platform
>>> "Steam" is coming to a usable state.
>>>
>>> It is programmed in Python + WxPython.
>>> It works by adding the game to sys.path and importing the game (very
>>> simplified way to put it).
>>> It uses a XML file to get a list of PyGame's. It will also work with
>>> other types of python games, including opengl based ones, as long as
>>> they are open source.
>>> A huge feature is that it will make it easy to deploy pygame's since
>>> you do not need to package them as a .exe.
>>> It allows anyone to make a game repository, the XML file url can be
>>> set inside the application!
>>>
>>> I am currently looking for help with:
>>> * The pygamedb-server which is a website programmed in cherrypy or
>>> pylons which will allow people to submit/upload games and generates
>>> the resulting xml file.
>>> * Beta testers for the client and someone that can test it on Mac OSX
>>> * Someone to make me a pygamedb logo, I am useless with graphics!
>>> * Someone with knowlege of WxPython thats willing to help with the
>>> client gui.
>>>
>>> The project is currently missing a big feature, dependency/library
>>> support (It ignores that in the xml file right now). That will be
>>> finished very soon.
>>>
>>> You can see a screenshot here:
>>> http://richies.googlepages.com/Screenshot-1.png
>>> The test repo is hosted here: http://pygamedb.4rensics.org/
>>> The test XML Data file  is here:
>>> http://pygamedb.4rensics.org/pygamedb.xml
>>>
>>> I plan to get a domain name once pygamedb-server is done.. pygamedb.org
>>> maybe?
>>>
>>> Getting it
>>> ===
>>> The project lives at: https://launchpad.net/pygamedb
>>>
>>> Windows
>>> http://launchpad.net/bzr/1.6/1.6beta3/+download/bzr-setup-1.6b3.exe
>>> http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-
>>> 2.8.8.1-py25.exe
>>> http://sourceforge.net/project/showfiles.php?group_id=78018
>>> Install all of the above.
>>>
>>> Debian/Ubuntu
>>> python-wxgtk2.8, bzr
>>>
>>> Once you installed that, Run this command:
>>> bzr branch lp:pygamedb
>>>
>>> Running it
>>> ===
>>> Windows
>>> rename pygamedb to pygamedb.py and then run it.
>>>
>>> On all other os's just run pygamedb
>>>
>>> --
>>> Thanks, Richie Ward
>>
>>
>



-- 
Thanks, Richie Ward


Re: [pygame] Physics module status note, more things...

2008-08-15 Thread Peter Gebauer
Nice reply Marcus!

> In order to get rid of that, you have to choose matching step times, sizes
> and the speed for bodies according to your simulation needs - at least as
> long as there is no CCD algorithm implemented :-).

Right.

> Simulated bouncing is implemented already. The collision energy, and how it
> is applied on the colliding bodies, depends on the restitution set for them.

All these fancy english words. :)

> Here's how I'd do it.
>
> * create a World with relatively high damping, the gravity vector points to
>   the top (e.g. world.gravity = 0, -3).
> * place body into that world with a certain damping, mass, etc.
> * have fun watching the simulation.

The wold would need more than just a size, it would need a position as well, 
but it'd be very difficult to do body transitions between the worlds anyway.
I think it'd be easier to change the behavior of a body that is inside 
another body.
Of course, the "fluid" body wouldn't be fluid, it would simply apply an 
force (opposite to gravity) based on the displaced mass, but that would be 
enough to simulate an ocean surface or pockets of contained fluids.
As I see it there would be three things to consider: the inverse of gravity, 
displaced mass and friction. I'm not sure about friction, because it would 
involve surface area calculations, but some "estimation" ;) of it will do.

I don't have a clue about the math involved to calculate the force, but I 
could give it a stab.

> Simulating a varying density of the world would require a slightly
> different approach for worlds. Currently the world does not know anything
> about its size and such, that however would be necessary, I think.

I still think doing it per body is easy enough and would have more use 
cases. It would be a rough estimation of water, but it'd work for what this 
library is intended to do, 

One final question: is it possible to lock joint rotation (no rotation)?

/Peter


Re: [pygame] PyGameDB coming along well

2008-08-15 Thread Dan Krol
This is fantastic, I didn't know this was in the works. I was always
thinking, for open source games to take off, there needs to be a good
catalog of games that people can browse, and it has to be flashy, but
it has to show off the big advantage of open source games, which is
that unlike other catalogs (like Steam), you can download it and play
the whole thing, right now.

For it to be attractive to users, though, I think It would be really
nice if the games were categorized, had nice screenshots, etc. It
should be like an advertisement, so people will be likely to check it
out. But that's just my take.

The only question I have is, is there any regard for security? Are the
games being looked over before they're added to the repo? Etc. I'm
perhaps naive and overly worried, I'm not familiar with how carefully
Linux distros (for instance) usually handle this sort of thing.

Thanks,

Dan

On Fri, Aug 15, 2008 at 12:57 PM, Noah Kantrowitz <[EMAIL PROTECTED]> wrote:
> Not to point out the obvious or anything, but why would you not just use
> pygame.org, which already has a big database of games. Just add an API for
> getting the metadata you need and be done with it.
>
> --Noah
>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> On Behalf Of Richie Ward
>> Sent: Friday, August 15, 2008 10:25 AM
>> To: pygame-users@seul.org
>> Subject: [pygame] PyGameDB coming along well
>>
>> The PyGameDB project which has similarity's to the commercial platform
>> "Steam" is coming to a usable state.
>>
>> It is programmed in Python + WxPython.
>> It works by adding the game to sys.path and importing the game (very
>> simplified way to put it).
>> It uses a XML file to get a list of PyGame's. It will also work with
>> other types of python games, including opengl based ones, as long as
>> they are open source.
>> A huge feature is that it will make it easy to deploy pygame's since
>> you do not need to package them as a .exe.
>> It allows anyone to make a game repository, the XML file url can be
>> set inside the application!
>>
>> I am currently looking for help with:
>> * The pygamedb-server which is a website programmed in cherrypy or
>> pylons which will allow people to submit/upload games and generates
>> the resulting xml file.
>> * Beta testers for the client and someone that can test it on Mac OSX
>> * Someone to make me a pygamedb logo, I am useless with graphics!
>> * Someone with knowlege of WxPython thats willing to help with the
>> client gui.
>>
>> The project is currently missing a big feature, dependency/library
>> support (It ignores that in the xml file right now). That will be
>> finished very soon.
>>
>> You can see a screenshot here:
>> http://richies.googlepages.com/Screenshot-1.png
>> The test repo is hosted here: http://pygamedb.4rensics.org/
>> The test XML Data file  is here:
>> http://pygamedb.4rensics.org/pygamedb.xml
>>
>> I plan to get a domain name once pygamedb-server is done.. pygamedb.org
>> maybe?
>>
>> Getting it
>> ===
>> The project lives at: https://launchpad.net/pygamedb
>>
>> Windows
>> http://launchpad.net/bzr/1.6/1.6beta3/+download/bzr-setup-1.6b3.exe
>> http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-
>> 2.8.8.1-py25.exe
>> http://sourceforge.net/project/showfiles.php?group_id=78018
>> Install all of the above.
>>
>> Debian/Ubuntu
>> python-wxgtk2.8, bzr
>>
>> Once you installed that, Run this command:
>> bzr branch lp:pygamedb
>>
>> Running it
>> ===
>> Windows
>> rename pygamedb to pygamedb.py and then run it.
>>
>> On all other os's just run pygamedb
>>
>> --
>> Thanks, Richie Ward
>
>


RE: [pygame] PyGameDB coming along well

2008-08-15 Thread Noah Kantrowitz
Not to point out the obvious or anything, but why would you not just use
pygame.org, which already has a big database of games. Just add an API for
getting the metadata you need and be done with it.

--Noah

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Richie Ward
> Sent: Friday, August 15, 2008 10:25 AM
> To: pygame-users@seul.org
> Subject: [pygame] PyGameDB coming along well
> 
> The PyGameDB project which has similarity's to the commercial platform
> "Steam" is coming to a usable state.
> 
> It is programmed in Python + WxPython.
> It works by adding the game to sys.path and importing the game (very
> simplified way to put it).
> It uses a XML file to get a list of PyGame's. It will also work with
> other types of python games, including opengl based ones, as long as
> they are open source.
> A huge feature is that it will make it easy to deploy pygame's since
> you do not need to package them as a .exe.
> It allows anyone to make a game repository, the XML file url can be
> set inside the application!
> 
> I am currently looking for help with:
> * The pygamedb-server which is a website programmed in cherrypy or
> pylons which will allow people to submit/upload games and generates
> the resulting xml file.
> * Beta testers for the client and someone that can test it on Mac OSX
> * Someone to make me a pygamedb logo, I am useless with graphics!
> * Someone with knowlege of WxPython thats willing to help with the
> client gui.
> 
> The project is currently missing a big feature, dependency/library
> support (It ignores that in the xml file right now). That will be
> finished very soon.
> 
> You can see a screenshot here:
> http://richies.googlepages.com/Screenshot-1.png
> The test repo is hosted here: http://pygamedb.4rensics.org/
> The test XML Data file  is here:
> http://pygamedb.4rensics.org/pygamedb.xml
> 
> I plan to get a domain name once pygamedb-server is done.. pygamedb.org
> maybe?
> 
> Getting it
> ===
> The project lives at: https://launchpad.net/pygamedb
> 
> Windows
> http://launchpad.net/bzr/1.6/1.6beta3/+download/bzr-setup-1.6b3.exe
> http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-
> 2.8.8.1-py25.exe
> http://sourceforge.net/project/showfiles.php?group_id=78018
> Install all of the above.
> 
> Debian/Ubuntu
> python-wxgtk2.8, bzr
> 
> Once you installed that, Run this command:
> bzr branch lp:pygamedb
> 
> Running it
> ===
> Windows
> rename pygamedb to pygamedb.py and then run it.
> 
> On all other os's just run pygamedb
> 
> --
> Thanks, Richie Ward



[pygame] PyGameDB coming along well

2008-08-15 Thread Richie Ward
The PyGameDB project which has similarity's to the commercial platform
"Steam" is coming to a usable state.

It is programmed in Python + WxPython.
It works by adding the game to sys.path and importing the game (very
simplified way to put it).
It uses a XML file to get a list of PyGame's. It will also work with
other types of python games, including opengl based ones, as long as
they are open source.
A huge feature is that it will make it easy to deploy pygame's since
you do not need to package them as a .exe.
It allows anyone to make a game repository, the XML file url can be
set inside the application!

I am currently looking for help with:
* The pygamedb-server which is a website programmed in cherrypy or
pylons which will allow people to submit/upload games and generates
the resulting xml file.
* Beta testers for the client and someone that can test it on Mac OSX
* Someone to make me a pygamedb logo, I am useless with graphics!
* Someone with knowlege of WxPython thats willing to help with the client gui.

The project is currently missing a big feature, dependency/library
support (It ignores that in the xml file right now). That will be
finished very soon.

You can see a screenshot here: http://richies.googlepages.com/Screenshot-1.png
The test repo is hosted here: http://pygamedb.4rensics.org/
The test XML Data file  is here: http://pygamedb.4rensics.org/pygamedb.xml

I plan to get a domain name once pygamedb-server is done.. pygamedb.org maybe?

Getting it
===
The project lives at: https://launchpad.net/pygamedb

Windows
http://launchpad.net/bzr/1.6/1.6beta3/+download/bzr-setup-1.6b3.exe
http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.8.1-py25.exe
http://sourceforge.net/project/showfiles.php?group_id=78018
Install all of the above.

Debian/Ubuntu
python-wxgtk2.8, bzr

Once you installed that, Run this command:
bzr branch lp:pygamedb

Running it
===
Windows
rename pygamedb to pygamedb.py and then run it.

On all other os's just run pygamedb

-- 
Thanks, Richie Ward


Re: [pygame] pgu broken with pygame 1.8.1release ? - patch for one bug(crash)

2008-08-15 Thread Brian Fisher
The Color changes in pygame 1.8.1 will only break things that use Color,
right?

so where is Color documented? I don't see it here:
http://www.pygame.org/docs/

On Thu, Aug 14, 2008 at 5:49 PM, René Dudfield <[EMAIL PROTECTED]> wrote:

> This is annoying, because pgu is used by a lot of games.  So the Color
> changes in pygame 1.8.1 will break a lot of things.  Well, they'll
> need to patch pgu.
>
>
>


Re: [pygame] pgu broken with pygame 1.8.1release ? - patch for one bug(crash)

2008-08-15 Thread Casey Duncan
I would make the argument that this assertion was broken from the  
start. Did pygame ever guarantee that it would be a tuple? Would be  
better to check if its a sequence, maybe something like:


try:
tuple(x)
except TypeError:
# Not a sequence
else:
# A sequence

(the biggest problem with the above is that is will think a string is  
a sequence in this context)


Kinda makes you wish that PySequence_Check was exposed in python  
somehow. Ironically googling for "PySequence_Check" brings up such a  
discussion as the first hit.


-Casey

On Aug 14, 2008, at 5:49 PM, René Dudfield wrote:


ah, bugger.

I don't think we can fix this error in pygame.

As the code was using:
if type(x) == tuple:

Unfortunately we can't make the Color type a tuple type.


This is annoying, because pgu is used by a lot of games.  So the Color
changes in pygame 1.8.1 will break a lot of things.  Well, they'll
need to patch pgu.






On Fri, Aug 15, 2008 at 12:46 AM, claudio canepa  
<[EMAIL PROTECTED]> wrote:
Knowing that a number of pygame games used pgu, and on top of that  
pyweek is

near, I take the liberty to re-post at pygame-users.

pgu broken with pygame 1.8.1release ? - patch for one bug(crash)
Nine of the demos crash with the same (except script name) traceback:

Traceback (most recent call last):
 File "F:\cla 2008 08 13\trunk\examples\gui11.py", line 67, in ?
   app.run(main)
 File "..\pgu\gui\app.py", line 207, in run
   self.loop()
 File "..\pgu\gui\app.py", line 163, in loop
   us = self.update(s)
 File "..\pgu\gui\app.py", line 188, in update
   self.paint(screen)
 File "..\pgu\gui\app.py", line 174, in paint
   container.Container.paint(self,screen)
 File "..\pgu\gui\container.py", line 100, in paint
   w.paint(sub)
 File "..\pgu\gui\theme.py", line 288, in func
   r = m(surface.subsurface(s,w._rect_content))
 File "..\pgu\gui\container.py", line 100, in paint
   w.paint(sub)
 File "..\pgu\gui\theme.py", line 288, in func
   r = m(surface.subsurface(s,w._rect_content))
 File "..\pgu\gui\container.py", line 100, in paint
   w.paint(sub)
 File "..\pgu\gui\theme.py", line 288, in func
   r = m(surface.subsurface(s,w._rect_content))
 File "..\pgu\gui\container.py", line 100, in paint
   w.paint(sub)
 File "..\pgu\gui\theme.py", line 286, in func
   w.background.paint(surface.subsurface(s,w._rect_border))
 File "..\pgu\gui\theme.py", line 473, in paint
   self.theme.render(s,v,r)
 File "..\pgu\gui\theme.py", line 404, in render
   ww,hh=box.get_width()/3,box.get_height()/3
AttributeError: 'pygame.Color' object has no attribute 'get_width'

The offending scripts are:
gui6.py
gui11.py
gui13.py
gui15.py
gui16.py
gui17.py

html2.py
html3.py
html5.py

Besides, gui9.py don't crash but misbehaves: with pygame 1.7.1 you  
can draw

boxes and circles but with pygame 1.8.1release no boxes and circles.

I tried pgu '0.10.6' ( checked out from imitation pickles, rev  
38 ), also

pgu-0.10.6.tar.gz from sourceforge and pgu 0.10.3, same results.

The demos run fine with pygame 1.7.1

Extra info:
win xp + sp2, python 2.4.3

Okay, found the problem for the crashes: will manifest in widgets  
with solid

color background.
Cause: color was a tuple, now it is a pygame.colors.Color instance.  
See

patch for details.
A patch (against pgu svn imitation pickles r38) is attached.
It is pygame 1.7.1 and 1.8.1 compatible.

The other problem (gui9.py misbehaving with pygame 1.8.1release)  
remains.


--
claxo

-





Re: [pygame] Physics module status note, more things...

2008-08-15 Thread mva

Peter Gebauer <[EMAIL PROTECTED]>:


Hi again!

Should have waited with my previous post, but here's a few things I don't
understand:

1) if the mass of a static body is under 1.0 it behaves as a semi-solid,
is this intentional? (i.e other bodies fall "into" the static body and with
mass reaching 0.0 they fall right through)
In test3.py, set the static body mass to 0.1, as an example.


This is due to the fact, that the current collision algorithm is not a CCD
method. Thus the collision detection highly depends on the step time, size
and speed of a body. Other systems, which do not implement a CCD, suffer from
the same issue. Zhang Fan wrote a lot about that in pgShapeObject.c.

In order to get rid of that, you have to choose matching step times, sizes
and the speed for bodies according to your simulation needs - at least as
long as there is no CCD algorithm implemented :-).


2) is there a way to get simulated bouncing? If there was a way to describe
how much energy the object retains (in new direction) after collision, a
float between 0.0 and 1.0 (0-100% energy retained, 0.01 would be a rock and
0.5 would be more of a tennis ball)?


Simulated bouncing is implemented already. The collision energy, and how it
is applied on the colliding bodies, depends on the restitution set for them.
So, whether you will receive an elastic or inelastic collision, depends on
that factor. A quick search for "Coefficient of restitution" and
"elastic collisions" will provide you tons of explanations and even some
values for different materials.
Attached you'll find a small bouncing test script.


3) can we add bouyancy? :) Body 1 is called "floater" and Body 2 is called
"water", if floater is inside water it should, depending on it'
displacement, either pop back up or sink to the bottom. We would
be able to calculate this with the already existing shape, mass and friction
attributes, but it would probably require a new boolean attribute, maybe
"solid"?


Here's how I'd do it.

* create a World with relatively high damping, the gravity vector points to
  the top (e.g. world.gravity = 0, -3).
* place body into that world with a certain damping, mass, etc.
* have fun watching the simulation.

Limiting the world's area would be left to the user. As you can have multiple
worlds, which behave completely different, you could e.g. split the screen
into "sky" and "sea", being two different worlds. If the body reaches a
certain point, you could remove it from "sea" and add it to "sky"
(which reminds of adding remove_* methods, so wait 'til the end of the
 weekend before doing that ;-).

Simulating a varying density of the world would require a slightly
different approach for worlds. Currently the world does not know anything
about its size and such, that however would be necessary, I think.

Regards
Marcus


# The python file is under test

import pygame
import physics
from pygame.locals import *

def render_body(body,surface,color):
l = body.get_points()
pygame.draw.polygon(surface,color,l)

def render_world(world,surface,color):
for body in world.bodies:
render_body(body,surface,color)


def init_world():
w = physics.World()
w.gravity = 0, 2

body1 = physics.Body()
body1.shape = physics.RectShape(30, 28, 0)
body1.position = 400, 40
body1.rotation = i
body1.restitution = 0.9
body1.mass = 20
w.add_body(body1)

body2 = physics.Body()
body2.shape = physics.RectShape (760, 20, 0)
body2.position = 400, 600
body2.restitution = 1.0
body2.mass = 1e100
body2.static = True
w.add_body(body2)
return w


def main():
"""this function is called when the program starts.
   it initializes everything it needs, then runs in
   a loop until the function returns."""
#Initialize Everything
pygame.init()
screen = pygame.display.set_mode((800, 800))
pygame.display.set_caption('physics test')

#Create The Backgound
background = pygame.Surface(screen.get_size())
background = background.convert()
background.fill((0,0,0))


#Display The Background
screen.blit(background, (0, 0))
pygame.display.flip()

#Prepare Game Objects
clock = pygame.time.Clock()

#rect = pygame.Rect(0,0,20,20)
#pointlist = [(0,10),(10,0),(0,0)]
white = 0, 250, 250
theta = 0
world = init_world()



#Main Loop
while 1:
# t = clock.tick(60)
# t = t/1000.0;
world.update(0.02)
#Handle Input Events
for event in pygame.event.get():
if event.type == QUIT:
quit()
elif event.type == KEYDOWN and event.key == K_ESCAPE:
return
elif event.type == MOUSEBUTTONDOWN:
return
elif event.type is MOUSEBUTTONUP:
return


#Draw Everything
background.fill((0,0,0))
#print world.body_list[0]
render_world(world,background,white)
screen

Re: [pygame] Physics module status note, more things...

2008-08-15 Thread Peter Gebauer
Oh dear, I'm spamming the channel.

4) Friction does nothing yet? Can't find it being used except to hold a 
value and changing it makes no difference.

On 2008-08-15 (Fri) 14:14, Peter Gebauer wrote:
> Hi again!
> 
> Should have waited with my previous post, but here's a few things I don't 
> understand:
> 
> 1) if the mass of a static body is under 1.0 it behaves as a semi-solid,
> is this intentional? (i.e other bodies fall "into" the static body and with 
> mass reaching 0.0 they fall right through)
> In test3.py, set the static body mass to 0.1, as an example.
> 
> This isn't really useful for making fluids either since there doesn't seem 
> to be an bouyancy to the falling bodies, i.e they don't pop back up again.
> 
> 2) is there a way to get simulated bouncing? If there was a way to describe 
> how much energy the object retains (in new direction) after collision, a 
> float between 0.0 and 1.0 (0-100% energy retained, 0.01 would be a rock and 
> 0.5 would be more of a tennis ball)?
> 
> 3) can we add bouyancy? :) Body 1 is called "floater" and Body 2 is called 
> "water", if floater is inside water it should, depending on it' 
> displacement, either pop back up or sink to the bottom. We would
> be able to calculate this with the already existing shape, mass and friction
> attributes, but it would probably require a new boolean attribute, maybe 
> "solid"?
> 
> Hm. I'm sure I'll be able to think of something else later. :)
> 
> /Peter
> 


Re: [pygame] Physics module status note, more things...

2008-08-15 Thread Peter Gebauer
Hi again!

Should have waited with my previous post, but here's a few things I don't 
understand:

1) if the mass of a static body is under 1.0 it behaves as a semi-solid,
is this intentional? (i.e other bodies fall "into" the static body and with 
mass reaching 0.0 they fall right through)
In test3.py, set the static body mass to 0.1, as an example.

This isn't really useful for making fluids either since there doesn't seem 
to be an bouyancy to the falling bodies, i.e they don't pop back up again.

2) is there a way to get simulated bouncing? If there was a way to describe 
how much energy the object retains (in new direction) after collision, a 
float between 0.0 and 1.0 (0-100% energy retained, 0.01 would be a rock and 
0.5 would be more of a tennis ball)?

3) can we add bouyancy? :) Body 1 is called "floater" and Body 2 is called 
"water", if floater is inside water it should, depending on it' 
displacement, either pop back up or sink to the bottom. We would
be able to calculate this with the already existing shape, mass and friction
attributes, but it would probably require a new boolean attribute, maybe 
"solid"?

Hm. I'm sure I'll be able to think of something else later. :)

/Peter


Re: [pygame] Physics module status note

2008-08-15 Thread Peter Gebauer
Hi!

Hm, I've been experimenting a bit now and I wonder about the 
body.rotation, it's using radians. Wouldn't it make more sense to use 
degrees in the API for all angle values?

On 2008-08-14 (Thu) 21:35, Marcus von Appen wrote:
> On, Thu Aug 14, 2008, Peter Gebauer wrote:
> 
> [...] 
> > Too early for a wishlist? :)
> 
> No, but do not expect it to be implemented within the next days
> ;-). We'd be happy to discuss and put your wishes on the TODO list.
> 
> Regards
> Marcus