Actually, despite the slightly lower activity recently, I've found this
forum to be active and helpful and was quite surprised at the initial
complaint in the thread. I think the pygame developers and community do
a great job given that it's a completely volunteer effort.
Thanks guys!
You might consider cairo.
--Mike
Bill Coderre wrote:
So I've been hacking Mac OS X's Core Graphics as a way of learning iPhone coding (gotta
sharpen those job skills), and I was wondering if there's an extension to pygame or python
somewhere that implements path based graphics.
In this
No. They support cvs and svn if you want to use them, but you can also
upload any kind of file to the files section.
-M
Yanom Mobis wrote:
I know about SourceForge, but don't they make you use that SVN thing?
I just distribute my games as source code in .zip files.
--- On *Fri, 1/1/10,
jukebox = gumm_sound.Jukebox()
NameError: global name 'gumm_sound' is not defined
--Mike
B W wrote:
For those of you who yawned at v0.0.3... :)
http://www.pygame.org/project-Trolls+Outta+Luckland-1358-2419.html#
Many thanks to Michael George and Bryce Schroeder for the first round
of discussions
...@gmail.com wrote:
On Sat, Jan 2, 2010 at 8:27 AM, Michael George
mdgeo...@cs.cornell.edu mailto:mdgeo...@cs.cornell.edu wrote:
In 0.0.4:
ImportError: Bad magic number in lib/game_globals.pyc
$ cd /home/mdgeorge/tmp/trolls_outta_luckland
$ ./Trolls_Outta_Luckland.py
B W wrote:
On Mon, Dec 21, 2009 at 9:33 AM, Michael George mdgeo...@cs.cornell.edu wrote:
Nevertheless, because there's a lot of hand-eye involved in wielding
an invisible mouse there probably needs to be a visual cue. But I
think I get what you're saying. Correct me if I'm wrong. Picturing
B W wrote:
I'm not sure what you mean.
If I move the mouse east, the cursor moves east. If I then start moving
the mouse west, the cursor immediately jumps to the west of the ship,
even if it's currently on the east.
--Mike
B W wrote:
bryce.schroe...@gmail.com wrote:
Control scheme interesting and somewhat novel but a little difficult
(probably to at least in part to unfamiliarity); there is potential
there but it needs refinement. I think I would like mouse to aim, keys
to move the ship, personally.
I would create separate surfaces and masks for each frame. If you want
to keep all the frames in one surface, you can use subsurfaces for each
frame: http://www.pygame.org/docs/ref/surface.html#Surface.subsurface.
Then create the masks out of the subsurfaces and use Mask.overlap to do
the
My approach is to choose a development platform and then use whatever
comes with. For example, I use ubuntu, and then apt-get install python
python-pygame. That way things will be painless for me and anyone using
the same platform as me. If I later decide I want to make it available
then I
Greg Ewing wrote:
Michael George wrote:
I'm not sure, but I think using that terminology, if you have a
quaternion representing your position/orientation on the surface of
the sphere, then converting it to euler angles gives your (longitude,
latitude, heading) = their (heading, attitude
Massimo Di Stefano wrote:
to learn more maybe i need numerical examples, so now i'm creating 2
first function to :
transform lon-lat-heading to quaternion representation and viceversa
from quaternion to euler angles.
something like :
euler2quat(lon,lat,heading)
quat2euler(q) # where q =
Hi Massimo,
You may find the quaternions in pyeuler useful:
http://code.google.com/p/pyeuclid/
I'm not sure, but I think using that terminology, if you have a
quaternion representing your position/orientation on the surface of the
sphere, then converting it to euler angles gives your
Michael George wrote:
Hi Massimo,
You may find the quaternions in pyeuler useful:
And of course it's euclid, not euler.
--Mike
DR0ID wrote:
Michael George schrieb:
Hello,
For my game I need to represent right isosceles triangles, and do
operations including translation and rotation in 15 degree
increments. Unfortunately, I cannot tolerate rounding error, because
it will cause bad visual and gameplay artifacts
Greg Ewing wrote:
But the back of my envelope is not wide enough
to accommodate any more of this.
A little bit further and you would have seen the fail: sqrt(3) * sqrt(6)
= 3 * sqrt(2) and we're back where we started. However my algebra book
assures me (non-constructively) that {1, sqrt(2),
Michael George wrote:
Greg Ewing wrote:
But the back of my envelope is not wide enough
to accommodate any more of this.
A little bit further and you would have seen the fail: sqrt(3) *
sqrt(6) = 3 * sqrt(2) and we're back where we started. However my
algebra book assures me (non
Hello,
For my game I need to represent right isosceles triangles, and do
operations including translation and rotation in 15 degree increments.
Unfortunately, I cannot tolerate rounding error, because it will cause
bad visual and gameplay artifacts. I'm thinking of representing points
as
Michael George, NY USA
John Eriksson wrote:
I started to search the net to find inspiration for names and
nationalities to the AI-players. But then I thought it would be much
nicer to use the names and nationalities of pygame developers instead
of just using fictive names.
[snip]
If you
If you find this is too slow, you'll get much better performance by
removing the **'s, they're quite slow compared to other arithmetic. Use
x*x instead of x**2 and square both sides of the inequality to remove
the **0.5.
P.F.C. wrote:
I'm not getting the attachment but this might help.
If
You can use a function from my game:
http://pen.svn.sourceforge.net/viewvc/pen/data/parts/cannon.py?revision=31view=markup
see the rotate_point function
--Mike
Paulo Silva wrote:
hi,
i confess it seems a bad handle from me about sprite rotation on
Pygame - do someone know better how we can
on Pygame, and i still struggle a lot about
how Python deals with variables, arrays, lists, and methods )
if someone know how to fix it, be welcome on editing that, and sharing
us the resulting pastebin url - thanks a lot in advance! :)
On 7/19/09, Michael George mdgeo...@cs.cornell.edu wrote
Oops, I made a type. See attached
Michael George wrote:
Actually, after looking more closely, rotate_point wasn't what you
needed. The problem was because when you rotate the image, the output
is still an upright rectangle, and you were placing (the upper left
corner of) that rectangle
Note that you would need rotate_point or something similar if you want
to rotate around a point that's not the center.
Michael George wrote:
Oops, I made a type. See attached
Michael George wrote:
Actually, after looking more closely, rotate_point wasn't what you
needed. The problem
Because python modules are just like classes, I tend to avoid the
singleton pattern in python and simply use module-level variables. For
example, in my game I have:
---globals.py---
import pygame
pygame.display.init()
screen = pygame.display.set_size(...)
# a handful other commonly used
One option I've been investigating is the use of convolutions for
bitmask collision response. I've been using it for drag-and-drop
collision response, but you might find it useful for other kinds of
response as well.
The way it works is as follows: if I have an object that's moving
through
My game pen (http://sf.net/projects/pen) uses XML to save levels and
solutions. It's possibly a little fancier than you need because the
game itself is extensible, so it uses some python dynamic dispatching.
Anyway, you can take a look at the save and load methods of level.py at
. How else would you find even one host?
On Thu, Mar 19, 2009 at 7:27 PM, Michael George mdgeo...@cs.cornell.edu wrote:
Tyler Laing wrote:
Haha, point taken. Sorry about that. As a student, I think that one or
the other would make a good project, as both would be too much work.
-Tyler
I'm making a game similar to fantastic contraption (
http://fantasticcontraption.com/ ). One of the cool features of that
game is that users can create their own levels and solutions, and they
can be shared, ranked and played by other players. I'd love to have
that functionality, but like
Tyler Laing wrote:
Hi,
That sounds remarkably like Bittorrent. If you check the internet
archive or other sites, you should be able to find the Python code for
Bittorrent before it was closed.
I agree - it's very like bittorrent, but with different properties.
With BitTorrent every client
Tyler Laing wrote:
Haha, point taken. Sorry about that. As a student, I think that one or
the other would make a good project, as both would be too much work.
-Tyler
I totally agree.
--Mike
pymike wrote:
if keys[LEFT]:
print True
This works, because you're checking to see if the 3rd numeral in the
list is positive/true.
Just a minor point - it's actually checking if the 3rd numeral is
non-zero/true.
--Mike
Yanom Mobis wrote:
ok, i didn't get any of that
There's a mask module in pygame with a Mask class that contains one bit
per pixel. It's not in the online docs yet, but in svn head there's a
method called convolve that takes in another Mask. If you start with a
Mask (lets call it map) which
Yanom Mobis wrote:
is it easier to make the game tile-based?
if I make every pixel a node, and there are 2 obstacles really close
together, how will I make sure something 20 pixels wide doesn't
try to go into a 2 pixel wide opening?
One possibility is to use the new convolution code in
Marius Gedminas wrote:
My personal snag with A* is that the NPCs seem to know too much about
the map and directly walk the most optimal path without exploration.
One possibility to solving this is to have the npc move as it's
performing the algorithm. i.e. as your search explores a path,
Brian Fisher wrote:
On Mon, Jan 26, 2009 at 9:01 AM, Michael George
mdgeo...@cs.cornell.edu mailto:mdgeo...@cs.cornell.edu wrote:
One possibility to solving this is to have the npc move as it's
performing the algorithm.
i.e. as your search explores a path, the character walks along
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.
Wayne Koorts wrote:
I'm not personally interested in this, but I don't think it's off-topic for
the list.
Ditto.
+1
-M
The Music Guy wrote:
Good point. I was sort of thinking the same thing, actually. I don't
think I'll be able to start testing anything, though, until I have a
basic world editor ready, otherwise it will be very difficult to
create any test levels.
Don't know if this is useful, but the game
Nirav Patel wrote:
Sorry about the very long delay on this, but I finally committed
Mike's convolve function and tests as revision 1796.
Nirav
Thanks!
--Mike
Michael Phipps wrote:
Yanom -
A decorator is a method that takes another method as a parameter so that it can
do something. It is usually used for aspect oriented programming.
For example:
def logThisMethodCall(methodCall)
# Do some logging here
@logThisMethodCall
def myMethod(a,b,c)
in the state.
--Mike
Michael George wrote:
Hello,
I'm trying to make a animation which may involve moving the window
around, but I want to keep the mouse in the same virtual place.
I've got the following snippet:
xoff = (xres - xpos) / 2
yoff = (yres - ypos) / 2
x, y
I've had good luck using colorkey blitting, if the mask is just binary,
and if you have a color you know isn't in the image you want to blit.
For example, if you know the image doesn't have any magenta, blit the
mask in magenta over black, set the color key to black, then blit the
mask onto
If you import a module, it introduces the name of that module (pygame in
this case) into the local scope. That means you can access things
inside that module using that name (e.g. pygame.Rect). On the other
hand, the from module import name construct imports the name itself.
For example,
.
--Mike
René Dudfield wrote:
Committed revision 1736.
I think it looks ok. Did you want to add anything else to it?
On Thu, Dec 4, 2008 at 3:26 PM, Michael George [EMAIL PROTECTED] wrote:
I've attached a patch that exposes the mask api in a separate header file.
Right now it only
Lenard Lindstrom wrote:
I see that the distutils package has an option for exporting names
from an extension module on Windows. So if only the init function is
non-static why provide a way to export other non-static names? I would
like to know where in the Python documentation is says that
I've attached a patch that exposes the mask api in a separate header
file. Right now it only provides the type object. It follows the same
convention as the other exported apis.
--Mike
/*
Copyright (C) 2002-2007 Ulf Ekstrom except for the bitcount function.
This wrapper code was
Greetings,
I have some extensions to the mask module for my game, and I'm trying to
figure out how to build/package them. For the sake of getting it
working I've just hacked them into the pygame source and been building a
custom pygame, but obviously that's not a good solution.
However as
being multi threaded if they release the python GIL.
... so I think it'd be best to submit your extensions into pygame I
think. Since there's no real C API at the moment. Then we can make
sure your extensions are in pyreloaded too.
cheers,
On Wed, Dec 3, 2008 at 12:36 PM, Michael George [EMAIL
Nirav Patel wrote:
The mask module is kind of strange because the Python additions were
all after the fact. bitmask.c and bitmask.h were/are a separate C
library that is just included in Pygame. That explains the exported
functions in bitmask. I'm not clear on exactly what you wanted to do,
Yep :) I heeded your advice.
--Mike
René Dudfield wrote:
ps. are there tests and docs for the new function too?
On Wed, Dec 3, 2008 at 2:51 PM, Michael George [EMAIL PROTECTED] wrote:
Nirav Patel wrote:
I've still got checking in convolution on my to do list. I've been
busy
Perhaps overkill, and not portable, but you could use the curses module.
--Mike
Fiona Burrows wrote:
I know this isn't directly related to PyGame but I figured there were
worse places to ask a question like this.
Does anybody know the best way to get input from the command line?
Michael George wrote:
Perhaps overkill, and not portable, but you could use the curses module.
--Mike
Fiona Burrows wrote:
I tried using Curses, but it didn't work out too well. I got the
input great, but I came across problems when adding strings that went
off screen (lol). Rather than
I'm working on something along these lines -
http://sf.net/projects/pen/ Any interest in joining me?
--Mike
Joe Strout wrote:
Hi all,
I'm new to pygame, and only recently returned to Python after nearly a
decade in the REALbasic world. So I hope you'll speak slowly and use
small words.
or python bindings for gstreamer (no link, too lazy)
-M
Brad Montgomery wrote:
Just another though, you might be OK just using the python interface to ALSA
http://pypi.python.org/pypi/pyalsaaudio/0.3
On Wed, Oct 29, 2008 at 12:44 PM, Luke Paireepinart
[EMAIL PROTECTED] wrote:
pymedia may
Install the python-dev packages for your distro. On ubuntu: sudo
apt-get install python-dev (or sudo apt-get build-dep pygame)
--Mike
yanom @linuxmail.org wrote:
how do i get the Python header files?
- Original Message -
From: Charlie Nolan [EMAIL PROTECTED]
To:
You might be able to do it using the composite extension. With
compositing, windows are rendered into textures in video memory, and
then you can use these textures with opengl to actually build the
display. You might be able to hack it up so that you can use these
textures from pyopengl. I
I think pygame could do much better with degenerate/empty rects. This
also comes up in the union and unionall methods - it would be nice to be
able to have an empty rect that when unioned into another rect yields
that other rect. Then you could write something like
u = Rect((0,0),(0,0))
for
!
On Thu, Oct 16, 2008 at 5:40 AM, Michael George [EMAIL PROTECTED] wrote:
Nirav Patel wrote:
It's not necessarily a good idea to have stuff that specific to an app
in a library. I think it would be good to have the convolution
function built into mask, and leave the rest
Would it make sense for me to build this right into the Mask module and
send you a patch then, or would it be better for me to develop it
separately as I have been and share the source with you when it's
finished so that you can put it together?
I'm still not entirely sure about the interface
Nirav Patel wrote:
It's not necessarily a good idea to have stuff that specific to an app
in a library. I think it would be good to have the convolution
function built into mask, and leave the rest of the implementation up
to the user. As for how to deal with the interface for convolving,
On Tue, Oct 14, 2008 at 10:44 AM, Michael George
[EMAIL PROTECTED] wrote:
Thanks,
what I need is different - I need to compute overlap_mask for each possible
offset, so that I can search for an optimal placement. Of course I could
write a loop and call overlap_mask for each offset, but I think
the typedef and defines into your file.
Nirav
On Tue, Oct 14, 2008 at 9:11 AM, Michael George [EMAIL PROTECTED] wrote:
hello,
I've been working on some code that generates what I've been calling a
hitmask, namely a mask with the (x,y) bit set if placing one mask on
another offset by (x,y) would
Attached. It's not integrated w/ python yet, but the tricky part is
mostly done.
--Mike
Nirav Patel wrote:
Mike
Ah, very interesting. Can I see the source on that? I would love to
see that included in the Mask module.
Nirav
On Tue, Oct 14, 2008 at 10:44 AM, Michael George
[EMAIL
Knapp wrote:
Yes, I thought that perhaps I did not get it also. So now that I think
I do get it. What about using to sprites and pixel perfect collision?
One would be the shape and the other would be the hole. If sprites
with holes don't work then use a bunch of sprites to create the hole's
It's still somewhat on the back burner, but I've been working on a
library to allow you to drag and drop irregularly shaped objects (esp.
circles and polygons) while preventing interpenetration. It's a
surprisingly hard problem and I'm reading a lot of computational
geometry papers to find an
perhaps it is double buffering? Did you try pygame.display.flip()?
--Mike
Gabriel Hasbun wrote:
Hello there,
I open python 2.5.2 and pygame 1.7.1 is being used on the MSDOS
command prompt, I initialize python and create a display, and the
window opens normally. The problem arises when I
I usually either use time directly in my calculations (rather than fps),
because I find it more natural. Does the velocity depend linearly on
thrust, or is thrust an acceleration? If the units on thrust are
something like meters per tick squared, then I think you will need to
compensate
True, although that constant is often on the order of 20, and 40 FPS is
a lot different than 2FPS.
--Mike
Casey Duncan wrote:
On Apr 18, 2008, at 9:23 AM, Ian Mallett wrote:
OK, my point here is that if C languages can do it, Python should be
able to too. I think all of this answers my
I know my dad wrote programs for and with me when I was little.
Probably not when I was one though :)
--Mike
Ian Mallett wrote:
On Sun, Apr 13, 2008 at 6:08 PM, Brad Montgomery
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
PS: Do all Father/Mother programmers try to write a game
You might look into gstreamer python bindings if they exist. That's the
first place I'd look, although I don't know if that would be portable to
windows.
--Mike
Josh Smith wrote:
Does anyone know of a workaround for piping the sound to the sound
card?
On Windows and even Linux with
Lenard Lindstrom wrote:
This is less than the Planck length of 1.6 * 10 ** -35 meters so
becomes moot. The Planck length would make a natural cutoff for any
game physics. :-)
I've thought of writing a game with physics operating at the quantum
scale, but I couldn't think of anything
At those speeds you need to use relativity to get the right answer
anyway. A 1kg mass needs to be moving at roughly the speed of light to
accelerate the earth to 1m/s.
Ian Mallett wrote:
So, if our object masses 1kg., to move the Earth 1m/s., the object
must move
I'm not sure exactly what you want, but
for x in object:
deadStar.grav(x)
will call deadStar.grav on each sprite in the sprite group object.
--Mike
Miguel Sicart wrote:
hi all,
thanks a bunch for the answers - I have learnt much, and everything
seems to work.
I have an extra question,
If you're doing using a predefined image, I think the easiest way is to
blit the mask over the image using the foreground as a colorkey, and
then set the background of the mask as the color key on the result.
This will leave holes in the puzzle piece if the picture contains the
background
Do you want to cut them into curvy non-recangular pieces or are
rectangular pieces good enough? I'm not sure how to do non-rectangular
pieces although it's an interesting puzzle :) I think you'd need to use
the surfarray module.
--Mike
Marcus von Appen wrote:
On, Tue Nov 06, 2007, Joseph
Like has been said here before, use something like:
if i = 9 and i = 1:
...and python is cool enough that you can just write
if 1 = i = 9:
and it does the right thing.
--Mike
Everything after the is what you type at the dos prompt. Everything
after the is what you type at the python prompt. Everything else is
what you should expect the system to respond
--Mike
kevin hayes wrote:
I don't understand the format of your email. Can you perhaps write it
in a
Yes you are. if i == range(1,9) compares i against the iterator
returned by the range function. Assuming i is a number, it will never
be equal (since a number is not an iterator). Your function would print
It worked! if you called print_i(range(1,9)).
I think what you probably want is if 1
It sounds like you might find the python tutorial very helpful if you haven't
read it already:
http://docs.python.org/tut/tut.html
There should probably be a prominent link on the pygame website for this,
since a lot of people seem to have questions on the mailing list about
classes and basic
Eric Hunter wrote:
i'm working on a game that i've been coding between my
desktop(windows) and my lappy(ubuntu - feisty fawn). So far I haven't
had any problems. but as lately, i did a lot of programming on my
desktop(windows) and now it won't run on my linux laptop. I haven't
really changed
You might have your students look at the pyweek entries
(http://pyweek.org) since they were written in a week they should have
manageably small codebases, and they cover a wide variety of game genres.
--Mike
Clare Richardson wrote:
Exactly! I'm very familiar with Pygame already, and the
So if I understand correctly, you want a game with holes:
- pedagogical holes that the students can fill in to learn basic
programming constructs such as functions, loops, simple data structures
- content holes so that the students can brand the game
but you want to avoid technical details
You might be able to restructure your code a little less if you use
generators to simulate coroutines. For example:
def anim1():
for frame in frames:
self.image = frame
yield
def anim2():
for i in range(10):
self.rect.move_ip(0, 10)
yield
anims = [anim1(),
Michael George wrote:
You might be able to restructure your code a little less if you use
generators to simulate coroutines. For example:
def anim1():
for frame in frames:
self.image = frame
yield
def anim2():
for i in range(10):
self.rect.move_ip(0, 10)
yield
You may want to look at the cannon code in my nascent game pen:
http://pen.svn.sourceforge.net/viewvc/pen/
The cannon part (code is in data/parts/cannon.py) has a barrel that can
be rotated around a base, but only in a certain range. If you want to
see it in action, download the game, run
Ian Mallett wrote:
That's why I put it in reverse order.
I'm assuming you're replying to my comment. The algorithm is still
wrong: i % j is 0 if i is a multiple of j, not if the last digit of i is
j. Your scheme yields the wrong answer if the frame number is bigger
than 10:
def
A much easier approach would simply be:
# draw frame (frame_number % 10)
In fact now that I think about it the way you wrote it isn't even
correct: frame % 2 == 0 whenever the frame number is even so every other
frame you'll get frame 9.
--Mike
Lamonte Harris wrote:
Nvm I fixed it. :D
On
I'm not sure, but after briefly looking through your code I'd guess that
your problem is due to the fact that you test which buttons are down
(none to start) then wait for a click, and then check which button had
been down before the click. You'll probably have better luck using the
event.pos
You might try pyode. It's pretty simple to set up springy things using
it, and you might be able to use simple joints to do the positioning.
--Mike
Ian Mallett wrote:
The molecular project has been canceled; not because of the problem we
were discussing, but because I don't want to try to
Richard is right if you want to run your program from the commandline by
typing
./example.py
but if so you also need to set the executable bit by running
chmod u+x example.py
(read change the mode to add eXecutable permissions for the current
User on example.py). On linux when you run a
I'm not entirely sure, but I think what you actually want is
http://pyopengl.sourceforge.net/documentation/manual/gluPickMatrix.3G.xml
this lets you render a small portion of the scene (like the portion
that's under the cursor) and stores the rendered objects into a
selection buffer.
--Mike
Another thing you can do is use rpm to compile the rpm file (I use
fedora/redhat so ymmv)
rpmbuild --rebuild sdl.src.rpm
which should output both the sdl-dev and sdl rpms in some useful place.
--Mike
Jason Ward wrote:
hahahaa
I can't believe it.
I didn't know. I thought I had to install
In fact I was just reading a bit more on picking since I was a little
curious myself and I came across this tutorial (also in C) which
describes both approaches:
http://www.lighthouse3d.com/opengl/picking/
--Mike
Jason Massey wrote:
Doesn't OpenGL have something similar to the surface
Just out of curiousity, have you compared your approach the gluPick and
the selection buffer infrastructure in openGL?
Also, some of the things I've read about selection suggest using the
back buffer for selection but not flipping. This means you can actually
really use different colors for
I'm not sure if this is exactly what you want, but there's an exec
command that takes a file object and interprets it as a python script.
I think there are also variants that take a file name, and there might
also be variants to run the file in a sandbox.
--Mike
Ian Mallett wrote:
Hi,
I'd
I think subversion has a mechanism for referencing the contents of
another subversion repository, which might make this type of solution
easier. I agree though, that I don't want multiple versions of
everything being installed by pygame - that's what my package manager is
for, and subverting
Hi,
I was wondering if anyone can suggest a good 2D computational geometry
library for use with pygame. I'm currently planning to use CGAL for my
game, because it seems to have the features I need, but
a) it's in C++ so it will make distributing my game much more of a pain
b) it's hugely
I'm pretty sure the answer is no...but maybe somebody who knows more
than me thinks otherwise.
--Mike
Ian Mallett wrote:
Awesome! That works! Thanks! Just one more question though... I
want to have two or more pygame windows running at the same time. Can
you do that?
Ian
On 6/28/07, *
99 matches
Mail list logo