Greg Ewing | 1 Mar 2007 03:09
Picon
Picon
Favicon

Re: Game idea revised

Charles Joseph Christie II wrote:

> Didn't know you could use C extensions in Python. Is that like saying,
> if I have a library I like to use in C (in this case, Kenta
> Cho's awesome bulletml library) I can use it in python? How much
> hacking would that take?

It's probably not something that a beginning Python user
should attempt. But whatever it is you're trying to do,
it's highly likely that someone has already wrapped a
C library to do it.

--

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiem!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing@...	   +--------------------------------------+

Charles Joseph Christie II | 1 Mar 2007 03:16
Picon

Re: Game idea revised

On Wed, 28 Feb 2007 14:27:45 -0800
"Bob Ippolito" <bob@...> wrote:

> On 2/28/07, Charles Joseph Christie II <sonicbhoc@...> wrote:
> > On Wed, 28 Feb 2007 10:55:30 -0800
> > "Bob Ippolito" <bob@...> wrote:
> >
> > > On 2/28/07, Kordova <kordova@...> wrote:
> > > >
> > > > On Feb 28, 2007, at 8:27 AM, Charles Christie wrote:
> > > >
> > > > > This idea seems more and more feasible, and better for pygame,
> > > > > every time I think about it, and my previous idea of making a
> > > > > danmaku shoot-em-up game out of this typing thing gets less
> > > > > savory due to the speed and accuracy limitations of python
> > > > > (which isn't exactly a bad thing, it's easy to program in for
> > > > > a newbie like me).
> > > >
> > > > I do not know what danmaku is (actually thanks to google I
> > > > think I now do), but I have had success at work and at home
> > > > with intensive 3d applications written primarily in Python. If
> > > > you feel you are able to develop this and are interested in
> > > > doing so, you should try it. In my experience most complaints
> > > > against Python tend to be based on poor design and/or
> > > > implementation of algorithms rather than the language running
> > > > dog slow. (And you can make the plunge into C extensions or
> > > > whatever if it really becomes an issue.)
> > > >
> > >
> > > Python having "accuracy limitations" seems very suspect as well.
(Continue reading)

Charles Joseph Christie II | 1 Mar 2007 03:22
Picon

Re: Game idea revised

On Thu, 01 Mar 2007 15:09:24 +1300
Greg Ewing <greg.ewing@...> wrote:

> Charles Joseph Christie II wrote:
> 
> > Didn't know you could use C extensions in Python. Is that like
> > saying, if I have a library I like to use in C (in this case, Kenta
> > Cho's awesome bulletml library) I can use it in python? How much
> > hacking would that take?
> 
> It's probably not something that a beginning Python user
> should attempt. But whatever it is you're trying to do,
> it's highly likely that someone has already wrapped a
> C library to do it.
> 

Oh hey! Greg Ewing! You're the guy that recommended that I make
movement done by typing. Right. OK, let it be known that I gave him
credit for his idea.

*Ahem* It was Greg's idea. :P

Anyway, someone was writing a C wrapper but they disappeared off of the
face of the Internet some time ago... Google searches got me lots of
pages in Japanese (go figure). I never thought of google searching that
guy's username though, I might try it...

Bob Ippolito | 1 Mar 2007 03:27
Gravatar

Re: Game idea revised

On 2/28/07, Charles Joseph Christie II <sonicbhoc@...> wrote:
> On Wed, 28 Feb 2007 14:27:45 -0800
> "Bob Ippolito" <bob@...> wrote:
>
> > On 2/28/07, Charles Joseph Christie II <sonicbhoc@...> wrote:
> > > On Wed, 28 Feb 2007 10:55:30 -0800
> > > "Bob Ippolito" <bob@...> wrote:
> > >
> > > > On 2/28/07, Kordova <kordova@...> wrote:
> > > > >
> > > > > On Feb 28, 2007, at 8:27 AM, Charles Christie wrote:
> > > > >
> > > > > > This idea seems more and more feasible, and better for pygame,
> > > > > > every time I think about it, and my previous idea of making a
> > > > > > danmaku shoot-em-up game out of this typing thing gets less
> > > > > > savory due to the speed and accuracy limitations of python
> > > > > > (which isn't exactly a bad thing, it's easy to program in for
> > > > > > a newbie like me).
> > > > >
> > > > > I do not know what danmaku is (actually thanks to google I
> > > > > think I now do), but I have had success at work and at home
> > > > > with intensive 3d applications written primarily in Python. If
> > > > > you feel you are able to develop this and are interested in
> > > > > doing so, you should try it. In my experience most complaints
> > > > > against Python tend to be based on poor design and/or
> > > > > implementation of algorithms rather than the language running
> > > > > dog slow. (And you can make the plunge into C extensions or
> > > > > whatever if it really becomes an issue.)
> > > > >
> > > >
(Continue reading)

Greg Ewing | 1 Mar 2007 03:48
Picon
Picon
Favicon

Re: Game idea revised

Charles Joseph Christie II wrote:

> Bounding rect? you mean like something that surrounds an object and
> tells if the two bounding rects touched? That's what I thought he meant
> by pixel perfect detection. Oops. ^_^;;

No, "pixel perfect" usually means taking the actual shape
of the object into account, i.e. comparing their bitmaps.
This is obviously a lot more expensive than just comparing
the bounding rects.

Rest assured that Python has no trouble doing integer
arithmetic accurately, and will tell you for certain
whether the bounding rects intersect or not. :-)

(If you were using floats for your rect coordinates,
you might have some accuracy limitations, but that's
a general feature of float arithmetic, and nothing to
do with Python.)

--

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiem!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing@...	   +--------------------------------------+

Charles Joseph Christie II | 1 Mar 2007 04:40
Picon

Re: Game idea revised

On Thu, 01 Mar 2007 15:48:29 +1300
Greg Ewing <greg.ewing@...> wrote:

> No, "pixel perfect" usually means taking the actual shape
> of the object into account, i.e. comparing their bitmaps.
> This is obviously a lot more expensive than just comparing
> the bounding rects.
> 
> Rest assured that Python has no trouble doing integer
> arithmetic accurately, and will tell you for certain
> whether the bounding rects intersect or not. :-)
> 
> (If you were using floats for your rect coordinates,
> you might have some accuracy limitations, but that's
> a general feature of float arithmetic, and nothing to
> do with Python.)
> 

On Wed, 28 Feb 2007 18:27:42 -0800
"Bob Ippolito" <bob@...> wrote:

> Pixel perfect detection typically means that you're actually comparing
> a bitmap mask of two sprites, to see if the actual pixels overlap.
> 
> Comparing rectangles or circles is a lot cheaper than individual
> pixels. You can check the pixels *after* you've found a collision in
> the rectangles (which means they're at least very close to touching
> visually), but usually you don't have to bother.
> 
> -bob
(Continue reading)

Ethan Glasser-Camp | 1 Mar 2007 04:54
Picon
Favicon

Re: Game idea revised

Greg Ewing wrote:
> Charles Joseph Christie II wrote:
> 
>> Didn't know you could use C extensions in Python. Is that like saying,
>> if I have a library I like to use in C .. I can use it in python?
> 
> It's probably not something that a beginning Python user
> should attempt.

I disagree; when I played with SWIG it was pretty easy to do, and I
had very little experience with Python. The concepts involved were a
little tricky, but in my opinion that would have been the case no
matter how experienced with Python the programmer was.

The important insight is: Python is implemented in C using an API
called the Python C API. This API can be used to embed Python, ie.
wrap the interpreter in another program, or to extend Python, ie. wrap
other C code in a Python-friendly way. Either way requires familiarity
with the C API, but SWIG can generate wrappers for C functions for you.

Ethan

Greg Ewing | 1 Mar 2007 09:15
Picon
Picon
Favicon

Re: Game idea revised

Ethan Glasser-Camp wrote:

> I disagree; when I played with SWIG it was pretty easy to do, and I
> had very little experience with Python.

If you're already experienced with C it's probably
okay. But it sounded like the OP was new to programming
in general, in which case trying to learn Python and C
and how to glue them together all at the same time
might be a bit much.

--
Greg

Ethan Glasser-Camp | 1 Mar 2007 10:03
Picon
Favicon

Re: Game idea revised

Greg Ewing wrote:
> If you're already experienced with C it's probably
> okay. But it sounded like the OP was new to programming
> in general, in which case trying to learn Python and C
> and how to glue them together all at the same time
> might be a bit much.

Yeah, you're probably right -- learning what a header file is and how
to use it could be a challenge. But I do think that the use of SWIG to
glue together Python and C is pretty easy and doesn't require much
"expert knowledge" of Python.

Ethan

Marius Gedminas | 1 Mar 2007 15:46
Picon

Missing fonts on Ubuntu Edgy

This is on Ubuntu Edgy:

    >>> import pygame
    >>> pygame.init()
    open /dev/sequencer: No such file or directory
    (6, 0)
    >>> pygame.version.ver
    '1.7.1release'

    >>> pygame.font.match_font('Verdana')
    '/usr/share/fonts/truetype/freefont/FreeSansOblique.ttf'

I do have Verdana:

    $ fc-match -v Verdana|grep file
            file: "/usr/share/fonts/truetype/msttcorefonts/verdana.ttf"(s)

however /usr/share/fonts/truetype/msttcorefonts/ does not have a
fonts.dir, nor fonts.scale, nor fonts.cache-1.  Only fonts.cache-1 in my
home directory knows about Verdana.

I imagine I would have the same problem with any fonts installed into
~/.fonts/

Suggested fix: have pygame/sysfont.py parse ~/.fonts.cache-1.  (There's
a slight complication: most fonts.cache-1 files have three fields per
line (font name, some number, font properties), while ~/.fonts.cache-1
has four (font name, some number, some other number, font properties).

Actually, as I recall from a discussion about a different bug[1] (that
(Continue reading)


Gmane