Re: [pygame] Opinions on the status of GUI libraries

2010-09-29 Thread Thiago Chaves
Boy, and do many of them need contributions. =P

At the moment I can't keep stacking projects on top of my real priorities,
but I can guess queue "contribute to some Pygame GUI library".

-Thiago

On Wed, Sep 29, 2010 at 5:34 AM, Leif Theden  wrote:

> Well, the beauty of OSS is that you can make a contribution to
> existing libraries.
>
> On Mon, Sep 20, 2010 at 1:12 AM, Thiago Chaves 
> wrote:
> > Hi,
> >
> > I'd like to know what is the opinion of the list members regarding Pygame
> > website's GUI libraries. Which ones are good, which ones are bad, what is
> > missing, what projects do you know of which are unlisted.
> >
> > Personally I liked using SPG
> > (http://www.pygame.org/project-simple+game+gui-740-1326.html) for one
> > Pyweek, but I found the widgets in the 0.9.2 version to be hard to
> extend,
> > and the newer version (https://launchpad.net/simple-pygame-gui) is in a
> > (hopefully not permanent) draft stage.
> >
> > I downloaded GooeyPy today, but due to the lack of cellulose installed on
> my
> > machine I postponed testing it for now.
> >
> > A couple years ago everyone and their moms were posting new GUI libraries
> > there, there's not so many new ones right now (not necessarily bad), but
> I
> > believe the old ones have much room for improvement.
> >
> > -Thiago
> >
>


Re: [pygame] "Pyttle.net"?

2010-09-22 Thread Thiago Chaves
Short update:

I'm posting a first draft version of "Pyttlebot" and I would just like to
post it here before I scrap the thing. Thanks to RB[0] I was able to give
consideration to the possibility of one not being able to host a game though
I'm on the workings of finding out what to do about it. I'm leaving it
running on irc.freenode.net #pyttle.net for the following 12 hours or so,
with possible interruptions if problems occur.

As the next thing I'm gonna do is use a Pygame GUI library to create a
minimalist IRC client that automatically connects to irc.freenode.net and
joys #pyttle.net and supports some basic functionalities such as chatting
and private messages. I'll worry about the bot and protocol again once that
is done.

What needs to change in the bot:
* Instead of the user informing the bot "I can host" or "I can't host", the
bot itself should attempt connection to the user's machine and verify if the
user can host, unless the user specifies a lack of desire for hosting a
game.
* Its code should look prettier than it looks now, seriously. If there's any
hope for me to get people using it for their own games.
* It should respond to channel messages directed at it, rather than having
the person wondering on how to use it.
* Accept registering of dedicated servers. The bot has registered dedicated
servers, then it doesn't need to wait for a hosting-capable user to show up,
but it should ask the dedicated server if there's a free game slot available
before announcing the game to the players.

Alex, if you're interested in building the bot, could you check the code (or
visit it and test its behavior) and get a new one in the workings? You can
change the grammar / syntax of the bot, but make it easy to parse by the
client.

I would say that if the bot accomplishes this much, and the client is able
to make these requests to the bot and react to a match announcement by
launching a game, then Milestone 1 has been achieved. =)

If anyone is interested in trying it out the bot is on #pyttle.net at
irc.freenode.org. To get instructions from it, you need to enter a private
conversation and say something random.

-Thiago

PS: In case anyone is wondering why trying a connection is necessary, I'm
also posting a log from a conversation I had in #twisted.

On Mon, Sep 20, 2010 at 9:07 PM, RB[0]  wrote:

> Everything except the actual code and the "RB[0]'s design docs" wiki page
> on here is outdated, but:
>
> http://code.google.com/p/galaxymageredux/
>
> Cheers, and good luck :)
>
>
> On Mon, Sep 20, 2010 at 1:02 PM, Thiago Chaves wrote:
>
>> Can you provide a link to your library, RB[0]? I googled Galaxymage but I
>> keep bumping into galaxymage.org, and the address is cybersquatted from
>> here.
>>
>> I understand what you said about the routing issues, and that's quite true
>> and I run into that problem quite often and shamefully enough, I haven't
>> considered that.
>>
>> I'm pushing on anyways and finishing a first draft of the first bot (to
>> which I won't give that much more thought if someone else is willing to take
>> the job) and then I'll get a minimalist client and network game going. But
>> thanks a lot for the input. =)
>>
>> -Thiago
>>
>>
>> On Mon, Sep 20, 2010 at 7:41 PM, RB[0]  wrote:
>>
>>> Hmm, perhaps I should explain better.
>>> The users/hosts wouldn't interact on the master server, except to connect
>>> to game servers, start servers and possibly chat.
>>> The game servers would be programmed by the games using them, so either
>>> one server = one game, or like in GMR, one game server hosts multiple
>>> games...
>>>
>>>
>>> On Mon, Sep 20, 2010 at 11:39 AM, RB[0]  wrote:
>>>
>>>> Well, this is something we had an issue with in GMR.
>>>> Not everyone can "host" a game, if you have a router like mine is it is
>>>> quite nearly impossible to create a server that others can connect to.
>>>> The way we planned to do it in GMR, was to have people create their own
>>>> server, and register it with the master server.
>>>> The master server in turn would check to ensure the game server was
>>>> really visible, then load up it's data (game, version, max users/games,
>>>> password, etc.) and provide that to people wanting to use the service.
>>>>
>>>> You could do this via irc, but I think a simple PB solution would be
>>>> simpler and more extensible. But if you make this up and it takes off we'll
>>>> definitely at least support it in GMR :)
>>>>
>>>>
>

Re: [pygame] "Pyttle.net"?

2010-09-20 Thread Thiago Chaves
Can you provide a link to your library, RB[0]? I googled Galaxymage but I
keep bumping into galaxymage.org, and the address is cybersquatted from
here.

I understand what you said about the routing issues, and that's quite true
and I run into that problem quite often and shamefully enough, I haven't
considered that.

I'm pushing on anyways and finishing a first draft of the first bot (to
which I won't give that much more thought if someone else is willing to take
the job) and then I'll get a minimalist client and network game going. But
thanks a lot for the input. =)

-Thiago

On Mon, Sep 20, 2010 at 7:41 PM, RB[0]  wrote:

> Hmm, perhaps I should explain better.
> The users/hosts wouldn't interact on the master server, except to connect
> to game servers, start servers and possibly chat.
> The game servers would be programmed by the games using them, so either one
> server = one game, or like in GMR, one game server hosts multiple games...
>
>
> On Mon, Sep 20, 2010 at 11:39 AM, RB[0]  wrote:
>
>> Well, this is something we had an issue with in GMR.
>> Not everyone can "host" a game, if you have a router like mine is it is
>> quite nearly impossible to create a server that others can connect to.
>> The way we planned to do it in GMR, was to have people create their own
>> server, and register it with the master server.
>> The master server in turn would check to ensure the game server was really
>> visible, then load up it's data (game, version, max users/games, password,
>> etc.) and provide that to people wanting to use the service.
>>
>> You could do this via irc, but I think a simple PB solution would be
>> simpler and more extensible. But if you make this up and it takes off we'll
>> definitely at least support it in GMR :)
>>
>>
>> On Mon, Sep 20, 2010 at 12:37 AM, Thiago Chaves wrote:
>>
>>> Missing end of sentence here: a default bot could/should exist for use by
>>> developers with no interest in customizing it for their own game, or to be
>>> extended by developers who want to add other features specific to their
>>> game.
>>>
>>>
>>> On Mon, Sep 20, 2010 at 8:11 AM, Thiago Chaves wrote:
>>>
>>>> It's very cool to hear about two other people so soon after the initial
>>>> post interested in getting this going. =)
>>>>
>>>> For purposes of not commenting about how much I'd like to get a better
>>>> name for the thing everytime I mention it, I'm gonna use "Pyttle.net" on 
>>>> the
>>>> email, but leave here stated that I'm not suggesting this as a name for the
>>>> system. =P
>>>>
>>>> So, things I was thinking of:
>>>>
>>>> 0. Users have a collection of more than zero games that support getting
>>>> started by Pyttle.net / having matches started by.
>>>> 1. Chatting between users, emoting actions, registering and confirming
>>>> of usernames is handled by the chosen protocol and the chosen protocol's
>>>> servers.
>>>> 2. The client connects automatically to the chat server(s) and joins
>>>> channels according to the collection of Pyttle.net-capable games present in
>>>> the user's machine. #fog-of-war-chess, #galaxymage, #ssof, for instance.
>>>> 3. Each game/channel has it's own bot running in there, which deals with
>>>> negotiation of matches, scorekeeping (if there's any interest in the game
>>>> for that), messages-of-the-day, etc. A default bot could/should.
>>>> 4. Once a match has been arranged, the bot informs all involved clients
>>>> that the match is gonna start, who are the players and in which IP's they
>>>> can be found.
>>>> 5. Once a client has been informed of a match, it takes care of
>>>> launching the game and it deals with the network connections and data on 
>>>> its
>>>> own accord.
>>>> 6. Once a match is over, if there's interest by the developers to have
>>>> some scoreboard, the clients inform the results back to the bot, who logs 
>>>> it
>>>> and whatever.
>>>>
>>>> I'm totally open to negotiating/discarding/changing any/all of these. I
>>>> want something like a game-agnostic "battle.net" to happen. =)
>>>>
>>>> Opinions? What is missing? What could be added? What is poorly
>>>> explained?
>>>>
>>>> -Thiago
>>>>
>>>>
>>>> On Sun, Sep 19, 2010 at 9:25 PM, Alex Nordlund <
>>>> deep.alexan...@gmail.com> wrote:
>>>>
>>>>> On Sun, Sep 19, 2010 at 7:22 PM, RB[0]  wrote:
>>>>> > I've been reading Twisted documentation and this sounds like a
>>>>> > less-than-guru-level thing to build on top of the IRC protocol.
>>>>>
>>>>> I'd like to contribute to this project!
>>>>>
>>>>> I enjoy IRC and have been building bots that play games over IRC for a
>>>>> while.
>>>>>
>>>>> ---
>>>>> //Alex
>>>>>
>>>>
>>>>
>>>
>>
>


Re: [pygame] "Pyttle.net"?

2010-09-19 Thread Thiago Chaves
Missing end of sentence here: a default bot could/should exist for use by
developers with no interest in customizing it for their own game, or to be
extended by developers who want to add other features specific to their
game.

On Mon, Sep 20, 2010 at 8:11 AM, Thiago Chaves  wrote:

> It's very cool to hear about two other people so soon after the initial
> post interested in getting this going. =)
>
> For purposes of not commenting about how much I'd like to get a better name
> for the thing everytime I mention it, I'm gonna use "Pyttle.net" on the
> email, but leave here stated that I'm not suggesting this as a name for the
> system. =P
>
> So, things I was thinking of:
>
> 0. Users have a collection of more than zero games that support getting
> started by Pyttle.net / having matches started by.
> 1. Chatting between users, emoting actions, registering and confirming of
> usernames is handled by the chosen protocol and the chosen protocol's
> servers.
> 2. The client connects automatically to the chat server(s) and joins
> channels according to the collection of Pyttle.net-capable games present in
> the user's machine. #fog-of-war-chess, #galaxymage, #ssof, for instance.
> 3. Each game/channel has it's own bot running in there, which deals with
> negotiation of matches, scorekeeping (if there's any interest in the game
> for that), messages-of-the-day, etc. A default bot could/should.
> 4. Once a match has been arranged, the bot informs all involved clients
> that the match is gonna start, who are the players and in which IP's they
> can be found.
> 5. Once a client has been informed of a match, it takes care of launching
> the game and it deals with the network connections and data on its own
> accord.
> 6. Once a match is over, if there's interest by the developers to have some
> scoreboard, the clients inform the results back to the bot, who logs it and
> whatever.
>
> I'm totally open to negotiating/discarding/changing any/all of these. I
> want something like a game-agnostic "battle.net" to happen. =)
>
> Opinions? What is missing? What could be added? What is poorly explained?
>
> -Thiago
>
>
> On Sun, Sep 19, 2010 at 9:25 PM, Alex Nordlund 
> wrote:
>
>> On Sun, Sep 19, 2010 at 7:22 PM, RB[0]  wrote:
>> > I've been reading Twisted documentation and this sounds like a
>> > less-than-guru-level thing to build on top of the IRC protocol.
>>
>> I'd like to contribute to this project!
>>
>> I enjoy IRC and have been building bots that play games over IRC for a
>> while.
>>
>> ---
>> //Alex
>>
>
>


Re: [pygame] "Pyttle.net"?

2010-09-19 Thread Thiago Chaves
It's very cool to hear about two other people so soon after the initial post
interested in getting this going. =)

For purposes of not commenting about how much I'd like to get a better name
for the thing everytime I mention it, I'm gonna use "Pyttle.net" on the
email, but leave here stated that I'm not suggesting this as a name for the
system. =P

So, things I was thinking of:

0. Users have a collection of more than zero games that support getting
started by Pyttle.net / having matches started by.
1. Chatting between users, emoting actions, registering and confirming of
usernames is handled by the chosen protocol and the chosen protocol's
servers.
2. The client connects automatically to the chat server(s) and joins
channels according to the collection of Pyttle.net-capable games present in
the user's machine. #fog-of-war-chess, #galaxymage, #ssof, for instance.
3. Each game/channel has it's own bot running in there, which deals with
negotiation of matches, scorekeeping (if there's any interest in the game
for that), messages-of-the-day, etc. A default bot could/should.
4. Once a match has been arranged, the bot informs all involved clients that
the match is gonna start, who are the players and in which IP's they can be
found.
5. Once a client has been informed of a match, it takes care of launching
the game and it deals with the network connections and data on its own
accord.
6. Once a match is over, if there's interest by the developers to have some
scoreboard, the clients inform the results back to the bot, who logs it and
whatever.

I'm totally open to negotiating/discarding/changing any/all of these. I want
something like a game-agnostic "battle.net" to happen. =)

Opinions? What is missing? What could be added? What is poorly explained?

-Thiago

On Sun, Sep 19, 2010 at 9:25 PM, Alex Nordlund wrote:

> On Sun, Sep 19, 2010 at 7:22 PM, RB[0]  wrote:
> > I've been reading Twisted documentation and this sounds like a
> > less-than-guru-level thing to build on top of the IRC protocol.
>
> I'd like to contribute to this project!
>
> I enjoy IRC and have been building bots that play games over IRC for a
> while.
>
> ---
> //Alex
>


Re: [pygame] "Pyttle.net"?

2010-09-19 Thread Thiago Chaves
It was actually your entry that inspired me to write about this, Matt. =)

It doesn't need to be IRC, but my initial idea was to pick an existing chat
protocol for which servers and chat room names are freely available to
anyone.

Anyways, through such thing one could skip the "building the UI for
inputting peer IP addresses, talking about connection errors, negotiating
matches, making a chat room for the gamers" part of building a network game.

And as a bonus, that could result in an increase of network-capable pyweek
entries. I'd love to have my next entry for Pyweek be network-capable if I
can skip past through the "building the UI within a week" part. =P

-Thiago

On Sun, Sep 19, 2010 at 9:11 PM, RB[0]  wrote:

> Actually that sounds similar to a project I'm considering starting.
> During Pyweek we made a networked game, and were going to have a master
> server where you can register your own servers, and other can find them.
>
> It would be fairly simple to create and other games could use it...
> I wasn't thinking about using irc though.
>
> But yes, definitely sounds feasible...
>
> Matt
>
>
> On Sun, Sep 19, 2010 at 12:20 PM, Thiago Chaves wrote:
>
>> Email vaguely related to my first one.
>>
>> How about coming up with a "Pyttle.net" client (and server) (and not with
>> that name), which would basically be an IRC chat that launches networked
>> games between people? Games that utilized it could register to the thing
>> locally so the chat knows which games you have that support it and the
>> client could launch the games with the appropriate command-line arguments to
>> get a game between people going. (or maybe "importing" the game and
>> launching it from withing the client, if there's a game skeleton provided)
>>
>> The server-side could also support assigning random matches and ladder
>> games.
>>
>> I've been reading Twisted documentation and this sounds like a
>> less-than-guru-level thing to build on top of the IRC protocol.
>>
>> Does it sound feasible?
>>
>> -Thiago
>>
>
>


[pygame] "Pyttle.net"?

2010-09-19 Thread Thiago Chaves
Email vaguely related to my first one.

How about coming up with a "Pyttle.net" client (and server) (and not with
that name), which would basically be an IRC chat that launches networked
games between people? Games that utilized it could register to the thing
locally so the chat knows which games you have that support it and the
client could launch the games with the appropriate command-line arguments to
get a game between people going. (or maybe "importing" the game and
launching it from withing the client, if there's a game skeleton provided)

The server-side could also support assigning random matches and ladder
games.

I've been reading Twisted documentation and this sounds like a
less-than-guru-level thing to build on top of the IRC protocol.

Does it sound feasible?

-Thiago


[pygame] Opinions on the status of GUI libraries

2010-09-19 Thread Thiago Chaves
Hi,

I'd like to know what is the opinion of the list members regarding Pygame
website's GUI libraries. Which ones are good, which ones are bad, what is
missing, what projects do you know of which are unlisted.

Personally I liked using SPG (
http://www.pygame.org/project-simple+game+gui-740-1326.html) for one Pyweek,
but I found the widgets in the 0.9.2 version to be hard to extend, and the
newer version (https://launchpad.net/simple-pygame-gui) is in a (hopefully
not permanent) draft stage.

I downloaded GooeyPy today, but due to the lack of cellulose installed on my
machine I postponed testing it for now.

A couple years ago everyone and their moms were posting new GUI libraries
there, there's not so many new ones right now (not necessarily bad), but I
believe the old ones have much room for improvement.

-Thiago


Re: [pygame] are individual midi instruments sounds copyrighted

2010-08-19 Thread Thiago Chaves
Ding! We have a winner!

http://techdirt.com/articles/20100818/04421010666.shtml

"Chair Designer Sues Disney Over Chair Used In Alice In Wonderland Movie"

=(

-Thiago

On Wed, Jul 21, 2010 at 7:00 PM, David Taylor  wrote:
> You guys are working much too hard at this. All you have to do is download
> the Furniture Genuine Advantage patch from Microsloth.com. Then you will
> have the comfort of knowing that your furniture is truly your own property
> and not a pirated copy of someone else’s furniture. You will also be able to
> move the furniture around within the house any time you like. Just don’t
> plan on remodeling your house. If the furniture notices any structural
> changes in the house that might suggest that it is not actually the same
> house, it will immediately refuse to let you sit on it, dine on it, or use
> it in any other way. But, hey, all ‘advantages’ have to come at some small
> cost, right?
>
>
>
> 
>
> From: owner-pygame-us...@seul.org [mailto:owner-pygame-us...@seul.org] On
> Behalf Of B W
> Sent: Wednesday, July 21, 2010 7:15 AM
> To: pygame-users@seul.org
> Subject: Re: [pygame] are individual midi instruments sounds copyrighted
>
>
>
> Relocating the furniture voids the warranty. If you need to move the
> furniture under warranty to a new location, you'll either need to contract
> an authorized, insured mover, or get the furniture re-certified by an
> authorized representative of the manufacturer at the new location. These
> expensive services are not covered under the maintenance agreement.
>
> Gumm
>
> On Tue, Jul 20, 2010 at 6:38 PM, Greg Ewing 
> wrote:
>
> Thiago Chaves wrote:
>
> Sorry. Evidently you'll be able to buy "professional broadcaster"
> versions of the furniture, which is pretty much the same thing, but
> incredibly more expensive.
>
>
>
> Also, if you want other members of your family to be able
> to use the furniture, they will have to buy their own
> furniture, or you will have to get a special "household"
> furniture licence.
>
> And don't even think about letting visitors sit on your
> sofa...
>
> --
> Greg
>
>


Re: [pygame] Forcing sprites to use specific palette entries?

2010-08-15 Thread Thiago Chaves
Have you seen this?
http://www.pygame.org/docs/ref/display.html#pygame.display.set_palette

If that's not the missing piece in your puzzle, then it's time for you
to start posting sample code and images so we can reproduce your
issue.

-Thiago

On Sun, Aug 15, 2010 at 10:12 PM, John Anderson
 wrote:
> I actually have one, but I would like if it were possible to alter which
> palette entries are used by pygame in real-time, what it seems happens when
> I .convert() an image, it loses it's unique palette data and just uses the
> basic pygame palette, but if I don't convert it, it makes it difficult to
> blit images and adds extra performance issues which might be a problem
> later.  The weird thing is that when I choose not to convert the images, it
> seems to make no difference, the sprites just seem to use whatever indicies
> they want anyway, is there some parameter in convert i dont know about, or
> is it my display setup?
>
> On Sun, Aug 15, 2010 at 10:01 AM, Thiago Chaves  wrote:
>>
>> You need an image editor that gves you an easy way to keep track of
>> the color index of your palettes. =)
>>
>> -Thiago
>>
>> On Fri, Aug 13, 2010 at 6:32 PM, John Anderson
>>  wrote:
>> > yes, I have, unfortunatley that still doesnt mean I can specify where
>> > the
>> > colours are placed on even the sprite's palette.  For example, I have a
>> > particular sprite with a slightly coloured outline, in the sprite's
>> > palette,
>> > entries from 0 - 15 are empty, and the outline is entry 16.  I'm not
>> > even
>> > sure where any of the other colours are, and that position might change
>> > with
>> > an excess of differently coloured sprites on screen, or worse, even
>> > disappear entirely.  What I would like to do is have the palette fill
>> > from
>> > the bottom, or preferably from a specified index with new palette
>> > entries
>> > loaded from .gif files, rather than try and find a close approximate
>> > colour
>> > on the existing palette, is this possible to do without changing the
>> > surface
>> > implementation in pygame, or even SDL?
>> >
>> > On Fri, Aug 13, 2010 at 4:59 AM, Thiago Chaves 
>> > wrote:
>> >>
>> >> Have you looked at the palette functions on surfaces?
>> >>
>> >> http://www.pygame.org/docs/ref/surface.html#Surface.get_palette
>> >>
>> >> -Thiago
>> >>
>> >> On Thu, Aug 12, 2010 at 8:56 PM, John Anderson
>> >>  wrote:
>> >> > Hi, I was wondering if it was possible to force an 8-bit colour
>> >> > sprite
>> >> > to
>> >> > use a very particular set of palette entries, like say, Sprite A uses
>> >> > colour
>> >> > indicies 0 - 16, and Sprite B uses 17 - 32.  As it stands, pygame
>> >> > automatically assigns the colours in a sprite to the closest colour
>> >> > on
>> >> > the
>> >> > main palette, meaning that it is very hard to predict which colours
>> >> > are
>> >> > where, and thus makes palette swapping a nightmare, is there any way
>> >> > around
>> >> > this?
>> >> >
>> >
>> >
>
>


Re: [pygame] Forcing sprites to use specific palette entries?

2010-08-15 Thread Thiago Chaves
You need an image editor that gves you an easy way to keep track of
the color index of your palettes. =)

-Thiago

On Fri, Aug 13, 2010 at 6:32 PM, John Anderson
 wrote:
> yes, I have, unfortunatley that still doesnt mean I can specify where the
> colours are placed on even the sprite's palette.  For example, I have a
> particular sprite with a slightly coloured outline, in the sprite's palette,
> entries from 0 - 15 are empty, and the outline is entry 16.  I'm not even
> sure where any of the other colours are, and that position might change with
> an excess of differently coloured sprites on screen, or worse, even
> disappear entirely.  What I would like to do is have the palette fill from
> the bottom, or preferably from a specified index with new palette entries
> loaded from .gif files, rather than try and find a close approximate colour
> on the existing palette, is this possible to do without changing the surface
> implementation in pygame, or even SDL?
>
> On Fri, Aug 13, 2010 at 4:59 AM, Thiago Chaves  wrote:
>>
>> Have you looked at the palette functions on surfaces?
>>
>> http://www.pygame.org/docs/ref/surface.html#Surface.get_palette
>>
>> -Thiago
>>
>> On Thu, Aug 12, 2010 at 8:56 PM, John Anderson
>>  wrote:
>> > Hi, I was wondering if it was possible to force an 8-bit colour sprite
>> > to
>> > use a very particular set of palette entries, like say, Sprite A uses
>> > colour
>> > indicies 0 - 16, and Sprite B uses 17 - 32.  As it stands, pygame
>> > automatically assigns the colours in a sprite to the closest colour on
>> > the
>> > main palette, meaning that it is very hard to predict which colours are
>> > where, and thus makes palette swapping a nightmare, is there any way
>> > around
>> > this?
>> >
>
>


Re: [pygame] Forcing sprites to use specific palette entries?

2010-08-13 Thread Thiago Chaves
Have you looked at the palette functions on surfaces?

http://www.pygame.org/docs/ref/surface.html#Surface.get_palette

-Thiago

On Thu, Aug 12, 2010 at 8:56 PM, John Anderson
 wrote:
> Hi, I was wondering if it was possible to force an 8-bit colour sprite to
> use a very particular set of palette entries, like say, Sprite A uses colour
> indicies 0 - 16, and Sprite B uses 17 - 32.  As it stands, pygame
> automatically assigns the colours in a sprite to the closest colour on the
> main palette, meaning that it is very hard to predict which colours are
> where, and thus makes palette swapping a nightmare, is there any way around
> this?
>


Re: [pygame] are individual midi instruments sounds copyrighted

2010-07-19 Thread Thiago Chaves
Sorry. Evidently you'll be able to buy "professional broadcaster"
versions of the furniture, which is pretty much the same thing, but
incredibly more expensive. And you're still not allowed to utilize the
furniture in any way that looks offensive to the company that provided
it i.e. implying the furniture is not resistant, not pleasant to the
eyes or displaying the furniture in a controversial video.

-Thiago

On Tue, Jul 20, 2010 at 6:36 AM, Thiago Chaves  wrote:
> Goddamn this Copyright madness. There is no month in which I don't see
> a bizarre copyright question being asked.
>
> Within a few years people will be blurring images of furniture in
> television because displaying the furniture will potentially infringe
> a design.
>
> A decade ago things seemed to be so much simpler, how the hell did all
> of this happen?
>
> -Thiago
>
> On Tue, Jul 20, 2010 at 2:43 AM, Bryce Schroeder
>  wrote:
>> Hear, hear. I imagine Yamaha just wants to keep people from taking
>> their samples and using them in another instrument or midi rendering
>> software...
>>
>> On Mon, Jul 19, 2010 at 4:36 PM, Brian Fisher  
>> wrote:
>>> Well the midi version of your composition is absolutely your own and no-one
>>> else's, and there are other ways to render it to wav/ogg/whatever besides
>>> the line out of your keyboard, which don't restrict your ability to
>>> distribute and sell your product, so you always have options. If you have
>>> access to a mac, for instance, garageband instrument samples give a
>>> royalty-free license to use to make renderings of midi music.
>>>
>>> That being said, I would be *amazed* if rendering down your own music wasn't
>>> an "authorized use" of the yamaha keyboard. That copyright notice you have
>>> there isn't clear at all at what is and isn't authorized, it just says that
>>> "personal use" is always OK, and that's basically a meaningless statement
>>> because what they say is already given by copyright law. I think bottom line
>>> is you are in a grey area with that keyboard unless you find something more
>>> about what is exactly authorized or licensed. You could try emailing Yamaha
>>> support if you really cared, but if I were you, I would assume it's totally
>>> fine and just use my own rendered music however I like, cause it would be
>>> ridiculous and stupid if yamaha ever tried to claim infringement in a case
>>> like yours, bad for their business. The reality of copyright and IP law is
>>> that the only thing that is actually in violation is what is enforced by the
>>> copyright holder.
>>>
>>>
>>> On Mon, Jul 19, 2010 at 1:14 PM, Brian Brown  wrote:
>>>>
>>>> I think I have an idea of what to do now.
>>>> I think I will just keep making my music and if I find it is unusable
>>>> for my game, I should just use it personally.
>>>> Thanks everybody for all your help. I appreciate it.
>>>> Matt
>>>
>>>
>>
>


Re: [pygame] are individual midi instruments sounds copyrighted

2010-07-19 Thread Thiago Chaves
Goddamn this Copyright madness. There is no month in which I don't see
a bizarre copyright question being asked.

Within a few years people will be blurring images of furniture in
television because displaying the furniture will potentially infringe
a design.

A decade ago things seemed to be so much simpler, how the hell did all
of this happen?

-Thiago

On Tue, Jul 20, 2010 at 2:43 AM, Bryce Schroeder
 wrote:
> Hear, hear. I imagine Yamaha just wants to keep people from taking
> their samples and using them in another instrument or midi rendering
> software...
>
> On Mon, Jul 19, 2010 at 4:36 PM, Brian Fisher  
> wrote:
>> Well the midi version of your composition is absolutely your own and no-one
>> else's, and there are other ways to render it to wav/ogg/whatever besides
>> the line out of your keyboard, which don't restrict your ability to
>> distribute and sell your product, so you always have options. If you have
>> access to a mac, for instance, garageband instrument samples give a
>> royalty-free license to use to make renderings of midi music.
>>
>> That being said, I would be *amazed* if rendering down your own music wasn't
>> an "authorized use" of the yamaha keyboard. That copyright notice you have
>> there isn't clear at all at what is and isn't authorized, it just says that
>> "personal use" is always OK, and that's basically a meaningless statement
>> because what they say is already given by copyright law. I think bottom line
>> is you are in a grey area with that keyboard unless you find something more
>> about what is exactly authorized or licensed. You could try emailing Yamaha
>> support if you really cared, but if I were you, I would assume it's totally
>> fine and just use my own rendered music however I like, cause it would be
>> ridiculous and stupid if yamaha ever tried to claim infringement in a case
>> like yours, bad for their business. The reality of copyright and IP law is
>> that the only thing that is actually in violation is what is enforced by the
>> copyright holder.
>>
>>
>> On Mon, Jul 19, 2010 at 1:14 PM, Brian Brown  wrote:
>>>
>>> I think I have an idea of what to do now.
>>> I think I will just keep making my music and if I find it is unusable
>>> for my game, I should just use it personally.
>>> Thanks everybody for all your help. I appreciate it.
>>> Matt
>>
>>
>


Re: [pygame] Working with maps

2010-05-18 Thread Thiago Chaves
Computational geometry alternative:

You can do it with geometric shapes. Make the states/countries
polygons. Triangularize the polygons and then it is a matter of
finding out whether the (x,y) coordinate is inside one of the
polygon's triangles.

See here: http://en.wikipedia.org/wiki/Polygon_triangulation

-Thiago

On Tue, May 18, 2010 at 11:02 AM, Timothy Baldock  wrote:
> Hi Kenny,
>
> I'd do this by making each country a sprite with a transparent
> background (colour-key transparency would work), then whenever the user
> clicks doing a collision detection between the position of the mouse
> cursor (first use rect-collision to build a small number of tiles which
> match, then do pixel-perfect collision based on alpha - i.e. using the
> sprite's mask). Easiest way to do this IMO is to draw an "invisible"
> (e.g. position the sprite, but don't actually draw it to the screen)
> 1x1px sprite at the position of the mouse cursor, then collide that
> against the group containing all the country sprites.
>
> This technique means the countries can be any colour you want, or the
> colour can change without messing things up. I used this method for my
> isometric game engine to allow selection of tiles and other objects and
> found it to be quite fast.
>
> Thanks,
>
> Timothy
>
>
> On 18/05/2010 05:09, Kenny Meyer wrote:
>> Hey,
>>
>> I'd like to work with irregular formed geometric shapes like those in of
>> country maps in pygame.
>>
>> I want to do the following:
>> "Divide" a country map into its states and provinces and make each of them
>> "click-able", where the map could be an image (*.png) or maybe a vector 
>> graphic
>> (*.svg).
>>
>> The result should be:
>> A game where to guess and click the name of the state and province on a map.
>>
>> Observations:
>> It would be quite difficult to assign each state/province fixed coordinates 
>> as
>> those are irregular geometric shapes.
>>
>> Any ideas, pointers to other projects or suggestions?
>>
>


Re: [pygame] Layout module for Pygame surfaces

2010-05-17 Thread Thiago Chaves
Aha. How's the project going, by the way? =)

-Thiago

On Mon, May 17, 2010 at 1:26 PM, Pablo Recio Quijano
 wrote:
> The main reason here is to make that file portable between Pygame and SDL.
>
> 2010/5/17 Thiago Chaves 
>>
>> XML is kiinda nice for language-independent and editor-independent
>> file formats, just because so many languages are so unfriendly at
>> parsing text and happen to have a good XML library.
>>
>> But, yeah, don't see much reason for XML here either.
>>
>> -Thiago
>>
>> On Mon, May 17, 2010 at 7:37 AM, Luke Paireepinart
>>  wrote:
>> > I agree. Never understood why people love xml so much. I've always had
>> > my cfg files be python files that I import. Works awesomely.
>> > and if you ever want to programmatically generate your data you can
>> > always include that code in the cfg file. Super easy and flexible.
>> > Only downside that i can see is non-python interaction. But you can
>> > always write code to dump to/from xml if you really need that.
>> >
>> > On 5/16/10, David Taylor  wrote:
>> >>
>> >> I like that idea a whole lot more than XML.
>> >>
>> >>> -Original Message-
>> >>> From: owner-pygame-us...@seul.org [mailto:owner-pygame-us...@seul.org]
>> >>> On
>> >> Behalf Of
>> >>> Mark Reed
>> >>> Sent: Saturday, May 15, 2010 12:07 PM
>> >>> To: pygame-users@seul.org
>> >>> Subject: Re: [pygame] Layout module for Pygame surfaces
>> >>>
>> >>> Why does it need to be XML? Write it out as python dict's and eval the
>> >>> file. 2 lines of code.
>> >>>
>> >>> And use an existing library and write an editor for it. Thats really
>> >>> the thrust of what you are trying to do. Support the code that is out
>> >>> there instead of rewriting it.
>> >>>
>> >>> Mark
>> >>>
>> >>> On Sat, May 15, 2010 at 5:16 PM, Pablo Recio Quijano
>> >>>  wrote:
>> >>> > There's no GUI behind the the XML right now. I wrote the XML by
>> >>> > hand.
>> >>> >
>> >>> > The idea is to do the library and write an application like Glade,
>> >>> > but
>> >> for
>> >>> > Pygame.
>> >>> >
>> >>> > 2010/5/15 jake b 
>> >>> >>
>> >>> >> What GUI are you using behind the xml?
>> >>> >> I'd be interested in seeing the code.
>> >>> >
>> >>> >
>> >>> >
>> >>> > --
>> >>> > Pablo Recio Quijano
>> >>> >
>> >>> > Estudiante de Ingeniería Informática (UCA)
>> >>> > Alumno colaborador del Departamento de Lenguajes y Sistemas
>> >>> > Informáticos
>> >>> >
>> >>
>> >>
>> >>
>> >
>> > --
>> > Sent from my mobile device
>> >
>
>
>
> --
> Pablo Recio Quijano
>
> Estudiante de Ingeniería Informática (UCA)
> Alumno colaborador del Departamento de Lenguajes y Sistemas Informáticos
>


Re: [pygame] Pygame community platform?

2010-05-16 Thread Thiago Chaves
A few of them do.

What is REALLY needed is some program/website/whatever that generates
those packages on demand. =)

-Thiago

On Mon, Jan 18, 2010 at 11:55 PM, Alex Nordlund
 wrote:
> On Mon, Jan 18, 2010 at 9:50 PM, Evan Kroske  wrote:
>> Your platform should use whichever is the most widely used by your intended
>> audience.
>
> You're missing the point, anyways.
> What game developer has the time and knowledge required to make their
> game available in all package managers?
>
> ---
> //Alex
>


Re: [pygame] Layout module for Pygame surfaces

2010-05-16 Thread Thiago Chaves
XML is kiinda nice for language-independent and editor-independent
file formats, just because so many languages are so unfriendly at
parsing text and happen to have a good XML library.

But, yeah, don't see much reason for XML here either.

-Thiago

On Mon, May 17, 2010 at 7:37 AM, Luke Paireepinart
 wrote:
> I agree. Never understood why people love xml so much. I've always had
> my cfg files be python files that I import. Works awesomely.
> and if you ever want to programmatically generate your data you can
> always include that code in the cfg file. Super easy and flexible.
> Only downside that i can see is non-python interaction. But you can
> always write code to dump to/from xml if you really need that.
>
> On 5/16/10, David Taylor  wrote:
>>
>> I like that idea a whole lot more than XML.
>>
>>> -Original Message-
>>> From: owner-pygame-us...@seul.org [mailto:owner-pygame-us...@seul.org] On
>> Behalf Of
>>> Mark Reed
>>> Sent: Saturday, May 15, 2010 12:07 PM
>>> To: pygame-users@seul.org
>>> Subject: Re: [pygame] Layout module for Pygame surfaces
>>>
>>> Why does it need to be XML? Write it out as python dict's and eval the
>>> file. 2 lines of code.
>>>
>>> And use an existing library and write an editor for it. Thats really
>>> the thrust of what you are trying to do. Support the code that is out
>>> there instead of rewriting it.
>>>
>>> Mark
>>>
>>> On Sat, May 15, 2010 at 5:16 PM, Pablo Recio Quijano
>>>  wrote:
>>> > There's no GUI behind the the XML right now. I wrote the XML by hand.
>>> >
>>> > The idea is to do the library and write an application like Glade, but
>> for
>>> > Pygame.
>>> >
>>> > 2010/5/15 jake b 
>>> >>
>>> >> What GUI are you using behind the xml?
>>> >> I'd be interested in seeing the code.
>>> >
>>> >
>>> >
>>> > --
>>> > Pablo Recio Quijano
>>> >
>>> > Estudiante de Ingeniería Informática (UCA)
>>> > Alumno colaborador del Departamento de Lenguajes y Sistemas Informáticos
>>> >
>>
>>
>>
>
> --
> Sent from my mobile device
>


Re: [pygame] Rect Behavior

2010-05-16 Thread Thiago Chaves
Check if n == 1. If so, use line. =P

-Thiago

2010/5/17 机械唯物主义 : linjunhalida :
> maybe Ian want to draw random rect, and n*1 is randomized and failed to
> show...
> so I suggest skip n*1 and use n*2 or n*3..
>
> On Mon, May 17, 2010 at 4:39 AM, Kris Schnee  wrote:
>>
>> On 2010.5.16 3:25 PM, Ian Mallett wrote:
>>>
>>> Hi,
>>>
>>> So, I've noticed that, when trying to draw a n*1 or 1*n rectangle (yes I
>>> know a line does the job too) with pygame.draw.rect(...), the behavior
>>> is different for different fills.  When the fill is 0, nothing draws!
>>> When the fill is 1, the desired rectangle is drawn.  Is this the
>>> expected behavior of pygame.draw.rect(...)?
>>>
>>> Thanks,
>>> Ian
>>
>> Probably because the rect function assumes a variable-width border. (
>> http://www.pygame.org/docs/ref/draw.html#pygame.draw.rect ) There's no
>> "fill" argument, only a "border width" argument. So if that's 0, Pygame
>> probably gets confused and draws 0 pixels of border, 0 of interior.
>>
>> Why not use pygame.draw.line if you only want one pixel width anyway?
>
>


Re: [pygame] antialiased circles

2010-03-14 Thread Thiago Chaves
Speaking of which. Are we expected to use Pygame1.9 or Pygame2 for the Pyweek?

-Thiago

On Thu, Mar 4, 2010 at 8:50 AM, René Dudfield  wrote:
> On Thu, Mar 4, 2010 at 2:48 AM, Luke Paireepinart
>  wrote:
>> gfxdraw is from pygame2, I assume?
>> Thanks Rene, I'll give it a try.  Pygame2 looks quite awesome.  Is the 1.9
>> branch gonna keep being maintained when pygame2 is official?  it breaks
>> backwards compatibility, I guess, are you just going to keep it with a
>> different name so they can be installed together?
>>
>
> No need to use pygame2 for gfxdraw, it's in pygame.
>
> yeah, pygame is still going.  But might be renamed to pygame10... or pygame12 
> ;)
>


Re: [pygame] PyGame Error

2010-03-14 Thread Thiago Chaves
http://vlaurie.com/computers2/Articles/environment.htm

Ctrl+F: Adding or Editing Environment Variables

Do it there once and you're good.

Or switch to Linux. =D

-Thiago

On Sun, Mar 14, 2010 at 3:25 AM, Ian Mallett  wrote:
> The problem must have had something to do with Py3.  After uninstalling it,
> PyGame worked fine, even though PyGame was installed for 2.5.
> On Sat, Mar 6, 2010 at 8:19 PM, Alex Nordlund 
> wrote:
>>
>> PATH=%PATH%;C:\Python26
>> Provided that it's on windows
>
>  Typing that into the command fixes my problem, but after closing and
> reopening the console window, I have to do it again?
>


Re: [pygame] Regarding two Pygame-related events

2010-02-12 Thread Thiago Chaves
I cast "RAISE THREAD"! >=O

-Thiago

On Mon, Oct 19, 2009 at 9:19 PM, pymike  wrote:
>
>> PyMike: Are you on the list? Care to get the Pyday event going and
>> kicking again? =D
>
> I've been "lightly" dev'ing a new PyDay site on and off during the past few
> months. I'm not sure when it'll be up and running, though I'm hoping I'll
> have it ready in time for a compo this holiday. :)
>
> Cheers,
>
> --
> - pymike
>


Re: [pygame] author & license of the pygame_logo (the snake) ?

2010-02-11 Thread Thiago Chaves
Copyright law is broken. =(

-Thiago

On Sun, Jan 24, 2010 at 10:39 PM, Noah Kantrowitz  wrote:
> Not sure where you got that idea, but in every western legal system I know
> of the opposite is true. If no license is given, then there is none.
> Copyright is automatically granted (and applying a license doesn't alter
> copyright in general), and by default all rights are retained by the author.
> I very much doubt the author of this particular image would ever exercise
> their rights to sue, but it is worth mentioning since many people use stuff
> from Google images or whatnot in games.
>
> --Noah
>
> On Jan 24, 2010, at 9:07 AM, Shadd wrote:
>
>> When an item is distributed freely without any mention to licenses, it is
>> considered of public domain, so you can use it as you please. That is, if
>> really there is no copyright on it.
>>>
>>> Where can i find the author & exact license of the pygame snake
>>> graphic ? It's the logo on top of the www.pygame.org website and can be
>>> downloaded at http://www.pygame.org/download.shtml but i see no license
>>> information. I want to put the snake graphic as sprite in some python /
>>> pygame tutorials.
>>>
>>> greetings,
>>>        -Horst
>
>


Re: [pygame] Help - Events

2009-11-17 Thread Thiago Chaves
Sure, share the code.

-Thiago

On Tue, Nov 17, 2009 at 6:26 PM, Thiago Petruccelli
 wrote:
> Hi!
>
> I am making a game in wich the player has to fill an area with tiles. It's
> an educational game. But I got a problem with pygame events... Actually I
> think it's a simple problem, but I don't know how to solve.
>
> There are two functionalities for the left click of the mouse: the first is
> to put a tile in the area, when dragging one tile, and the other is to
> remove one tile of the area (when not dragging). The problem is that, when I
> put both codes together, the two things happen at the same time - it puts
> the tile and then removes it. I've tried to block the removal of the tile
> setting a variable, "placed", which blocks the action of removing the tile
> until the next event handling. But it didn't work.
>
> Can someone help me solve this?
>
> Thanks in advance,
> --
> Thiago Henrique Petruccelli
>


Re: [pygame] Spam problem with joystick module

2009-11-13 Thread Thiago Chaves
Rouiller, check if these work for you.

Teste1.py controls a circle (and a line, if you have 2 or more directional
pads) on the window.
Teste2.py outputs button numbers and directional axes information (it's a
bit spammy when you're dealing with analog directional buttons, it's just
because there's so many different values the axes can take in that case).

-Thiago

On Fri, Nov 13, 2009 at 2:15 AM, rouiller olivier wrote:

> ok thank's let's try to build it, should be a good exercise after all.
>
> 2009/11/13 Lorenz Quack 
>
> Hi,
>>
>>
>> rouiller olivier wrote:
>>
>>> The calls to get_axis and get_button cause these outputs...
>>> Maybee there is another way of getting the values?..
>>>
>>
>> Not sure if there is another way.
>> Note that this is already fixed in svn trunk.
>> So I guess you can either try to build pygame from source from the svn
>> version or
>> wait for the next release.
>>
>>
>> regards
>> //Lorenz
>>
>
>
>
> --
> Rouiller Olivier
> 06 79 66 89 63
> Résidence Léonard de Vinci
> App. A008
> 59650 Villeneuve d'Ascq
>
#!/usr/bin/python

import pygame
import math
import random

#Constants
black  = (0,0,0)
color  = (255,255,255)
speed  = 3.0
size   = 7
length = 20

#Pygame initialization
pygame.init()
pygame.display.set_mode((500,500))
s = pygame.display.get_surface()
t = pygame.time.Clock()

#Checking for joysticks
print "Joysticks:", pygame.joystick.get_count()
j = pygame.joystick.Joystick(0)
j.init()

print "Using joystick:",j.get_name(),"With",j.get_numbuttons(),"buttons and",j.get_numaxes(),"axes."
print "Press button 1 to change color (or button 0, if you start counting from 0)"
print "Press button",j.get_numbuttons(),"to quit. (or button", j.get_numbuttons()-1,"if you start counting from 0)"

x = s.get_width()/2.0
y = s.get_height()/2.0
angle = 0.0

def loop():
global s, x, y, b, j, black, size, length, angle, color
while pygame.event.get(pygame.QUIT) == []:
s.fill(black)
pygame.event.pump()

x += j.get_axis(0)*speed
y += j.get_axis(1)*speed
pygame.draw.circle(s, color, (int(round(x)),int(round(y))), size)

if(j.get_numaxes() >= 4):
fx = j.get_axis(2)
fy = j.get_axis(3)
if math.fabs(fx)+math.fabs(fy) > 0.5:
angle = math.atan2(fy, fx)
pygame.draw.line(s, color, (int(round(x)),int(round(y))), (int(round(x+math.cos(angle)*length)),int(round((y+math.sin(angle)*length)

if j.get_button(j.get_numbuttons()-1):
print "Quit button pressed!"
return
if j.get_button(0):
color = (random.randint(50,255),random.randint(50,255),random.randint(50,255))

pygame.display.flip()
t.tick(80)

loop()
#!/usr/bin/python

import pygame

#Pygame initialization
pygame.init()
#pygame.display.set_mode((500,500))
#s = display.get_surface()
t = pygame.time.Clock()

print "Joysticks:", pygame.joystick.get_count()
j = pygame.joystick.Joystick(0)
j.init()
print "Using joystick:",j.get_name(),"With",j.get_numbuttons(),"buttons and",j.get_numaxes(),"axes."
print "Press joystick button 0 to quit"

def loop():
global t, j
while pygame.event.get(pygame.QUIT) == []:
#Getting joystick motion
axes = pygame.event.get(pygame.JOYAXISMOTION)
if axes != []:
axes_data = []
for c in range(0, j.get_numaxes()):
axes_data += [str(round(j.get_axis(c),1))]
print axes_data

#Getting button presses
buttonsdown = pygame.event.get(pygame.JOYBUTTONDOWN)
for button in buttonsdown:
print "Pressed button", button.button
if button.button == 0:
return

#Getting button releases
buttonsup = pygame.event.get(pygame.JOYBUTTONUP)
for button in buttonsup:
print "Released button", button.button

t.tick(80)

loop()


Re: [pygame] Spam problem with joystick module

2009-11-12 Thread Thiago Chaves
You might want to be more specific.

-Thiago

On Thu, Nov 12, 2009 at 7:36 PM, rouiller olivier wrote:

> Hi everyone,
>
> I am trying to use a gamepad for a game project but whenever I check for a
> pad event I get some printing in the console.
> I saw some discutions about the subject but no solution.
>
> I am on windows7 python26 pygame191 and I develop on Eclipse with pydev.
>
> Does someone have encounter the same problem and found a solution?
>
> Thx for your help.
>
> Regards.
> Olivier
>
> --
> Rouiller Olivier
> 06 79 66 89 63
> Résidence Léonard de Vinci
> App. A008
> 59650 Villeneuve d'Ascq
>
>
>
> --
> Rouiller Olivier
> 06 79 66 89 63
> Résidence Léonard de Vinci
> App. A008
> 59650 Villeneuve d'Ascq
>


[pygame] Regarding two Pygame-related events

2009-10-19 Thread Thiago Chaves
Yo, two things:

PyMike: Are you on the list? Care to get the Pyday event going and
kicking again? =D

Richard: Can it be Pygame.draw challenge time again? =D

Emailing on the list rather than personally so you get spammed with
"me too" emails and get angry at me*.

-Thiago

* - But hopefully not enough to moderate me.


Re: [pygame] multi-width aalines and aacircles

2009-03-23 Thread Thiago Chaves
I'd be very happy to see those too, specially because I've been doing
lots of drawing with primitives on SSoF. =D

-Thiago

On Mon, Mar 23, 2009 at 6:32 PM, pymike  wrote:
> PyGame desperately needs multi-width aalines and aacircles. Are there any
> plans to implement these during GSoC or the next PyGame release?
>
> It'd really open up possibilities for pretty apps, vector art, and even SVG
> libraries.
>
> --
> - pymike
> "Python eggs me on."
>


[pygame] Re: Sprite group drawing with offset

2009-03-10 Thread Thiago Chaves
Oops. I forgot to attach mine.

Also, the idea would be to have the offset having a default value, so
code that uses the current sprite code still works after updating.

-Thiago

On Tue, Mar 10, 2009 at 11:15 PM, Thiago Chaves  wrote:
> Hi,
>
> I just had a conversation with some people at #pygame on IRC, and it
> seems that at least me and unlucky777 agree that it would be cool to
> be able to pass an offset value to the drawing function on pygame
> sprite groups. The idea is that people who think about a "camera" (or
> when writing games have something more natural to work with).
>
> Anyway, unlucky777 came up wth some modified renderUpdates sprite
> group to solve a scrolling problem, while I caught myself putting
> offset information on the update method of my sprite classes so I
> could deal with the same problem (but apparently in an uglier way).
>
> I'm attaching unlycky777's relevant piece of code, and also what I
> came up with. Personally, I like unlucky's idea better.
>
> Any thoughts?
>
> -Thiago
>
def update(self, screenRect, world, inputObjects, time):
'''Takes as parameters:
screenRect:   The screen's rectangle in relation to the map's (0,0)
world:The collection of game objects, map information, etc.
inputObjects: Input objects. It may be reading information from one of
them.
time: Time passed since last update call.'''
self.rect.left = self.position[0] - screenRect.left
self.rect.top  = self.position[1] - screenRect.top



[pygame] Sprite group drawing with offset

2009-03-10 Thread Thiago Chaves
Hi,

I just had a conversation with some people at #pygame on IRC, and it
seems that at least me and unlucky777 agree that it would be cool to
be able to pass an offset value to the drawing function on pygame
sprite groups. The idea is that people who think about a "camera" (or
when writing games have something more natural to work with).

Anyway, unlucky777 came up wth some modified renderUpdates sprite
group to solve a scrolling problem, while I caught myself putting
offset information on the update method of my sprite classes so I
could deal with the same problem (but apparently in an uglier way).

I'm attaching unlycky777's relevant piece of code, and also what I
came up with. Personally, I like unlucky's idea better.

Any thoughts?

-Thiago
#from the sprite (module?) class RenderUpdates(Group):

def draw(self, surface, offset):
spritedict = self.spritedict
surface_blit = surface.blit
dirty = self.lostsprites
self.lostsprites = []
dirty_append = dirty.append
for s in self.sprites():
r = spritedict[s]
newrect = surface_blit(s.image, s.rect.move(offset))
if r is 0:
dirty_append(newrect)
else:
if newrect.colliderect(r):
dirty_append(newrect.union(r))
else:
dirty_append(newrect)
dirty_append(r)
spritedict[s] = newrect
return dirty

Re: [pygame] Re: Python path problem in vista?

2009-02-11 Thread Thiago Chaves
Thanks a lot for the help, folks.

I've tried RB[0]'s suggestion and it seems to work well. =)

The new code is:

import sys
sys.path.insert(0, 'lib')
import main
main.main()

I've already updated the file for next release.

-Thiago

On Tue, Feb 10, 2009 at 8:47 PM, RB[0]  wrote:
> It is an IDLE problem - I ran into the same thing on Ubuntu and XP, IDLE
> doesn't like the way they do it.
> A simple fix is to just put this line in:
> sys.path.insert(0, "lib")
> Instead of all that try/except nonsense. The above line works just as well,
> and I have never had a problem with it failing anywhere.
> I have actually used that stuff in my teams entry for pyweek ever sense the
> skellington was released :)
>
> HTH :)
>
> On Tue, Feb 10, 2009 at 11:40 AM, Brian Fisher 
> wrote:
>>
>> I can reproduce the problem (on vista), but it looks like an idle problem,
>> not really a vista problem
>>
>> when running the script, "__file__" is "C:\Python25\Lib\idlelib\idle.pyw"
>>
>> so "libdir" becomes "C:\Python25\Lib\idlelib\lib"
>>
>>
>>
>> On Tue, Feb 10, 2009 at 2:48 AM, Thiago Chaves 
>> wrote:
>>>
>>> Can anyone in the list also reply if they do NOT get problems running
>>> programs with skellington-compliant structure on Vista? So far I've
>>> got only one person informing of problems executing the program and
>>> I'd like to hear if that's widespread or not.
>>>
>>> -Thiago
>>>
>>> On Sun, Feb 8, 2009 at 10:02 PM, Thiago Chaves 
>>> wrote:
>>> > Hi,
>>> >
>>> > recently I was informed that my most recent project is not running
>>> > properly in Vista. I'm using the skellington structure suggested by
>>> > Pyweek administration and I'm wondering if that's somehow related.
>>> >
>>> > File structure for the project (as far as it is relevant to this post):
>>> > ssof/run_game.py
>>> > ssof/lib/main.py
>>> >
>>> > run_game.py's contents:
>>> >
>>> > 
>>> > #! /usr/bin/env python
>>> >
>>> > import sys
>>> > import os
>>> >
>>> >
>>> > try:
>>> >__file__
>>> > except NameError:
>>> >pass
>>> > else:
>>> >libdir = os.path.abspath(os.path.join(os.path.dirname(__file__),
>>> > 'lib'))
>>> >sys.path.insert(0, libdir)
>>> >
>>> > import main
>>> > main.main()
>>> > ___
>>> >
>>> > User feedback:
>>> >
>>> > Alright then,
>>> > Open fully-updated Windows Vista. Open IDLE. Python version number is
>>> > 2.5.2. Open run_game.py. Hit F5 (runs the script).
>>> > Traceback (most recent call last):
>>> > File "C:\Users\Andy
>>> > Hanson\Desktop\ssof-2009-01-31-fixed\ssof_alpha4\run_game.py", line
>>> > 15, in 
>>> > import main
>>> > ImportError: No module named main
>>> >
>>> > This is certainly a very simple problem!
>>> >
>>> > 
>>> >
>>> > Any thoughts? What am I doing wrong here?
>>> >
>>> > (I'm attaching run_game.py just in case the formatting gets messed up)
>>> >
>>> > -Thiago
>>> >
>>
>
>


[pygame] Re: Python path problem in vista?

2009-02-10 Thread Thiago Chaves
Can anyone in the list also reply if they do NOT get problems running
programs with skellington-compliant structure on Vista? So far I've
got only one person informing of problems executing the program and
I'd like to hear if that's widespread or not.

-Thiago

On Sun, Feb 8, 2009 at 10:02 PM, Thiago Chaves  wrote:
> Hi,
>
> recently I was informed that my most recent project is not running
> properly in Vista. I'm using the skellington structure suggested by
> Pyweek administration and I'm wondering if that's somehow related.
>
> File structure for the project (as far as it is relevant to this post):
> ssof/run_game.py
> ssof/lib/main.py
>
> run_game.py's contents:
>
> 
> #! /usr/bin/env python
>
> import sys
> import os
>
>
> try:
>__file__
> except NameError:
>pass
> else:
>libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))
>sys.path.insert(0, libdir)
>
> import main
> main.main()
> ___
>
> User feedback:
>
> Alright then,
> Open fully-updated Windows Vista. Open IDLE. Python version number is
> 2.5.2. Open run_game.py. Hit F5 (runs the script).
> Traceback (most recent call last):
> File "C:\Users\Andy
> Hanson\Desktop\ssof-2009-01-31-fixed\ssof_alpha4\run_game.py", line
> 15, in 
> import main
> ImportError: No module named main
>
> This is certainly a very simple problem!
>
> 
>
> Any thoughts? What am I doing wrong here?
>
> (I'm attaching run_game.py just in case the formatting gets messed up)
>
> -Thiago
>


[pygame] Python path problem in vista?

2009-02-08 Thread Thiago Chaves
Hi,

recently I was informed that my most recent project is not running
properly in Vista. I'm using the skellington structure suggested by
Pyweek administration and I'm wondering if that's somehow related.

File structure for the project (as far as it is relevant to this post):
ssof/run_game.py
ssof/lib/main.py

run_game.py's contents:


#! /usr/bin/env python

import sys
import os


try:
__file__
except NameError:
pass
else:
libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))
sys.path.insert(0, libdir)

import main
main.main()
___

User feedback:

Alright then,
Open fully-updated Windows Vista. Open IDLE. Python version number is
2.5.2. Open run_game.py. Hit F5 (runs the script).
Traceback (most recent call last):
File "C:\Users\Andy
Hanson\Desktop\ssof-2009-01-31-fixed\ssof_alpha4\run_game.py", line
15, in 
import main
ImportError: No module named main

This is certainly a very simple problem!



Any thoughts? What am I doing wrong here?

(I'm attaching run_game.py just in case the formatting gets messed up)

-Thiago
#! /usr/bin/env python

import sys
import os


try:
__file__
except NameError:
pass
else:
libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))
sys.path.insert(0, libdir)

import main
main.main()


Re: [pygame] Finding the exact point of collision between a circle and a line

2009-02-03 Thread Thiago Chaves
Hi Ian,

I haven't tested your suggestion yet. But it really looks that this is
what I was looking for. Thank you very much. =)

-Thiago

On Sun, Feb 1, 2009 at 8:20 PM, Ian Mallett  wrote:
> Hello,
>
> If you know the distance it's a good deal simpler.  It's quite easy to find
> and store, if you have the position.  It looks like you can use
> line_segment_point_distance().
>
> Let d1 be the distance to the line at t0.
> Let d2 be the distance to the line at t1.
> Let x be the spell's position in x.
> Let y be the spell's position in y.
> Let xD be the speed in the x direction.  It is linear.
> Let yD be the speed in the y direction.  It is linear.
>
> if d2 < radius: #the spell hit the line
> #fraction of frame at collision
> #I figured this out through linear interpolation.  Given constant time
> and known distances,
> #here's how you find an imaginary frame where distance = radius in the
> middle.
> portion = float(d1-radius)/float(d1-d2) #multiply by 100 to get % of
> time until next frame
> position_of_collision = [x + xD*portion,
>   y + yD*portion]
>
> I hope this is what you're looking for.
> Cheers,
> Ian
>
>


Re: [pygame] pygame, LGPL and iPhone

2009-02-02 Thread Thiago Chaves
I'm quite disturbed by this policy of not allowing shared libraries.
Is there a reason for that at all?

-Thiago

On Tue, Feb 3, 2009 at 9:37 AM, Jussi Toivola  wrote:
> I'm not sure if most people are aware of this, but on iPhone, one can
> not create shared libraries, only static libraries are allowed for
> user applications. This is troublesome if somebody(*hint*) wants to
> create commercial pygame applications for iPhone. If pygame is linked
> as static library, all the sources fall under LGPL. The same goes for
> SDL, but there is a mention of an alternative commercial license for
> SDL 1.3( http://www.libsdl.org/license.php ). No details yet.
>
> Are there any plans to change the licensing of pygame? For example,
> cocos2d has a special license for iPhone(
> http://cocos2d-iphone.googlecode.com/svn/trunk/LICENSE ).
>
> 
> Jussi Toivola
>


Re: [pygame] Pyggy Awards Judging Underway

2009-02-01 Thread Thiago Chaves
Shouldn't Piggy Awards contest announcements also belong in the
pygame.org's news, since Pyweek is announced there too?

-Thiago

On Mon, Feb 2, 2009 at 2:16 AM, Greg Ewing  wrote:
> Thiago Chaves wrote:
>>
>> What? How come I entirely missed this Piggy contest announcement? =(
>
> Beats me. As far as I remember, I announced it on the pygame
> list as well as the main python list/newsgroup.
>
> If anyone has any suggestions for further lists I should
> post Pyggy announcements to, I'll keep them in mind for
> next time.
>
> --
> Greg
>


Re: [pygame] Pyggy Awards Judging Underway

2009-02-01 Thread Thiago Chaves
What? How come I entirely missed this Piggy contest announcement? =(

-Thiago

On Sun, Feb 1, 2009 at 2:50 AM, Greg Ewing  wrote:
> Judging for the Feb'09 Pyggy Awards has started. All registered
> users of the PyWeek web site are eligible to rate entries, so
> even if you haven't submitted an entry, you can still be a judge
> if you want. And if you're not a PyWeek user, it's not too late
> to sign up.
>
> The entries are here:
>
>  http://pyggy.pyweek.org/1007/entries/
>
> --
> Greg
>


[pygame] Finding the exact point of collision between a circle and a line

2009-02-01 Thread Thiago Chaves
Hi,

On my current game, I got the following situation (displayed in the
attached drawing):

1 - On instant t0 an ideally circular spell C (displayed as a blue
circle in the image) moves toward a line segment AB in a straight and
predictable collision path with speed (dX, dY)/frame.
2 - On instant t1 the spell is intersecting with the line. The
intersection indicates that the circle has collided with the line.
3 - I am, however, unable to tell how to calculate the exact position
of the circle (displayed as a dotted circle in the image) when it
collided with the line, and there are no instants between t0 and t1.

Here's the math code I have available for calculating the distance
between a circle's origin and a line segment.



def dot_product(A, B, C):
'''Computes the dot product AB . BC'''
AB = (B[0]-A[0], B[1]-A[1])
BC = (C[0]-B[0], C[1]-B[1])
return AB[0]*BC[0] + AB[1]*BC[1]

def cross_product(A, B, C):
'''Computes the cross product AB x AC'''
AB = (B[0]-A[0], B[1]-A[1])
BC = (C[0]-B[0], C[1]-B[1])
return AB[0]*BC[1] - AB[1]*BC[0]

def line_point_distance(A, B, P):
'''Computes the distance from the line formed by AB to the point P'''
return fabs(cross_product(A, B, P) / hypot(A, B))

def line_segment_point_distance(A, B, P):
'''Computes the distance from the line segment AB to the point P'''
if dot_product(A, B, P) > 0:
return point_point_distance(B, P)
if dot_product(B, A, P) > 0:
return point_point_distance(A, P)
return fabs(cross_product(A, B, P) / point_point_distance(A, B))

---

And here's how the test is done:

--
pos0 = C.origin
pos1 = C.get_next_position()

distance = line_segment_point_distance(A, B, pos1)
if distance < C.radius:
print "A collision was detected!"
#MOVE CIRCLE TO COLLISION POINT
else:
C.pos = pos1

--

If I know the circle's position on both t0 and t1 (let's call them
pos0 and pos1, respectively), how do I calculate the exact collision
point?

Thanks,

-Thiago
<>

Re: [pygame] How to get text from a surface

2009-01-22 Thread Thiago Chaves
Well, the problem you ran into is more like a problem of Optical
Character Recognition (OCR) than a Pygame problem.

Maybe you should look for better OCR algorithms. Which one are you
currently using, by the way?

-Thiago

On Thu, Jan 22, 2009 at 11:33 AM,   wrote:
> Hi,
>
> I am loading an image into pygame.i am trying to get the text from the
> surface. I used pyTesser to read the text from a surface but if the font
> size of the text is less then 16, it doesn't give me back the correct text
> from the surface.
>
> Is there any other way to get the text from the pygame surface.
>
> Thanks,
> Sibtey
>
>
>


Re: [pygame] Re: Pointer module

2009-01-13 Thread Thiago Chaves
I was thinking more of something like just giving each "pointer"
device a cursor of it's own, because then I can tell them apart in the
program. This would come in handy in apps or programs that accept
multiple local users and requires them to use a pointer device. I'd
post mouse events directly if I could assign "mouse id" to each one.

I'll consider also adding a mouse emulation (rather than the generic
"pointer") mode anyways.

Thanks, =)

-Thiago


Though I could also make some mouse emulation mode for the joystick.

On Wed, Jan 14, 2009 at 12:51 AM, René Dudfield  wrote:
> hey,
>
> I'm sure that's a really good idea for some apps.
>
> Would definitely be cool to have the joystick generate mouse events :)
>
> Note, that often code for joystick can be very different for mice.
> They're just quite different.   However, definitely for some things a
> mouse emulation mode would be cool.
>
> cu,
>
>
>
>
> On Wed, Jan 14, 2009 at 6:48 AM, Thiago Chaves  wrote:
>> Just wondering, with all the feedback on font size on the other
>> thread. Is there anyone else on the list who would agree that there's
>> some benefit in having a simple way to implement pointing through
>> joysticks in a way that's easily interchangeable with the mouse or is
>> the idea really that pointless?
>>
>> -Thiago
>>
>> On Sun, Jan 11, 2009 at 10:53 PM, Thiago Chaves  wrote:
>>> Hi,
>>>
>>> I decided to improve the UI on my recent project and decided to allow
>>> users to use joysticks as pointing devices too. To do that I defined a
>>> class that encapsulates both mouse and joystick and gives them an
>>> interface (slightly) similar to the mouse module. I figure the pointer
>>> classes could still be improved, but I decided to release one early
>>> version of it along with an example to get some early feedback on the
>>> idea.
>>>
>>> There's really no advantage on using this over mouse module if you're
>>> using only mouse. It'd make sense in situations where you got both
>>> joysticks and mouse as pointing devices. (local multiplayer
>>> point-and-click games, anyone?)
>>>
>>> There's an example, which just uses the mouse and as many joysticks as
>>> you have as pointing devices. Notice the joystick devices start
>>> pointing at (0, 0)
>>>
>>> Could anyone give this a try and give me some feedback? What is good?
>>> What is bad? What is missing? What is unnecessary?
>>>
>>> Thanks,
>>>
>>> -Thiago
>>>
>>
>


[pygame] Re: Pointer module

2009-01-13 Thread Thiago Chaves
Just wondering, with all the feedback on font size on the other
thread. Is there anyone else on the list who would agree that there's
some benefit in having a simple way to implement pointing through
joysticks in a way that's easily interchangeable with the mouse or is
the idea really that pointless?

-Thiago

On Sun, Jan 11, 2009 at 10:53 PM, Thiago Chaves  wrote:
> Hi,
>
> I decided to improve the UI on my recent project and decided to allow
> users to use joysticks as pointing devices too. To do that I defined a
> class that encapsulates both mouse and joystick and gives them an
> interface (slightly) similar to the mouse module. I figure the pointer
> classes could still be improved, but I decided to release one early
> version of it along with an example to get some early feedback on the
> idea.
>
> There's really no advantage on using this over mouse module if you're
> using only mouse. It'd make sense in situations where you got both
> joysticks and mouse as pointing devices. (local multiplayer
> point-and-click games, anyone?)
>
> There's an example, which just uses the mouse and as many joysticks as
> you have as pointing devices. Notice the joystick devices start
> pointing at (0, 0)
>
> Could anyone give this a try and give me some feedback? What is good?
> What is bad? What is missing? What is unnecessary?
>
> Thanks,
>
> -Thiago
>


Re: [pygame] How the get a font size

2009-01-12 Thread Thiago Chaves
I'm also sure that  "not working" is hardly a serious issue. =P

-Thiago

On Tue, Jan 13, 2009 at 2:04 AM, James Paige  wrote:
> The only bad thing I can say about it is that it simply doesn't work :(
>
>>>> f = pygame.font.Font(None, 12)
>>>> f.size = 12
> Traceback (most recent call last):
>  File "", line 1, in 
> AttributeError: 'pygame.font.Font' object attribute 'size' is read-only
>
> And that is not just because Font already has a method named .size()
>
>>>> f.pointsize = 12
> Traceback (most recent call last):
>  File "", line 1, in 
> AttributeError: 'pygame.font.Font' object has no attribute 'pointsize'
>
> I'm guessing that since pygame.font.Font is impelmented in C, it doesn't
> allow new members to be added as it would if it was implemented in
> python (Correct me if I am wrong)
>
> ---
> James Paige
>
> On Tue, Jan 13, 2009 at 01:54:30AM +0200, Thiago Chaves wrote:
>> You can also just violate the object by giving it an extra attribute:
>>
>> f = pygame.font.Font(filename, size)
>> f.new_attribute = size
>>
>> I'm pretty sure any OO enthusiast would applaud this method. There is
>> certainly nothing bad that can be said about my method. No sir. =D
>>
>> -Thiago
>>
>> On Tue, Jan 13, 2009 at 12:48 AM, James Paige  
>> wrote:
>> > Seems to me like this should work:
>> >
>> > class SizeFont(pygame.font.Font):
>> >
>> >  def __init__(self, filename, size):
>> >  pygame.font.Font.__init__(self, filename, size)
>> >  self.size = size
>> >
>> > ---
>> > James Paige
>> >
>> > On Mon, Jan 12, 2009 at 04:07:11PM -0600, Jake b wrote:
>> >>Create a basic Font() wrapper. When you create the font, save the size.
>> >>On Mon, Jan 12, 2009 at 2:02 AM, Luca  wrote:
>> >>
>> >>  On Sun, Jan 11, 2009 at 10:36 PM, Noah Kantrowitz 
>> >> 
>> >>  wrote:
>> >>
>> >>  >> As far as I know, there's no way to get the size of the font that
>> >>  way.
>> >>  >>  What I do is name the font names in an intuitive way:
>> >>  >> Font12 = pygame.font.Font("", 12)
>> >>  >> Font18 = pygame.font.Font("", 18)
>> >>  >> Font36 = pygame.font.Font("", 36)
>> >>
>> >>  Thanks all, but in this way is impossible to get the size on an 
>> >> unknow
>> >>  font? I'm making a library for developer that need to know what is 
>> >> the
>> >>  font size that the developer can have choosen...
>> >>
>> >>  --
>> >>  -- luca
>> >>
>> >>--
>> >>Jake
>> >
>>
>>
>


Re: [pygame] How the get a font size

2009-01-12 Thread Thiago Chaves
You can also just violate the object by giving it an extra attribute:

f = pygame.font.Font(filename, size)
f.new_attribute = size

I'm pretty sure any OO enthusiast would applaud this method. There is
certainly nothing bad that can be said about my method. No sir. =D

-Thiago

On Tue, Jan 13, 2009 at 12:48 AM, James Paige  wrote:
> Seems to me like this should work:
>
> class SizeFont(pygame.font.Font):
>
>  def __init__(self, filename, size):
>  pygame.font.Font.__init__(self, filename, size)
>  self.size = size
>
> ---
> James Paige
>
> On Mon, Jan 12, 2009 at 04:07:11PM -0600, Jake b wrote:
>>Create a basic Font() wrapper. When you create the font, save the size.
>>On Mon, Jan 12, 2009 at 2:02 AM, Luca  wrote:
>>
>>  On Sun, Jan 11, 2009 at 10:36 PM, Noah Kantrowitz 
>>  wrote:
>>
>>  >> As far as I know, there's no way to get the size of the font that
>>  way.
>>  >>  What I do is name the font names in an intuitive way:
>>  >> Font12 = pygame.font.Font("", 12)
>>  >> Font18 = pygame.font.Font("", 18)
>>  >> Font36 = pygame.font.Font("", 36)
>>
>>  Thanks all, but in this way is impossible to get the size on an unknow
>>  font? I'm making a library for developer that need to know what is the
>>  font size that the developer can have choosen...
>>
>>  --
>>  -- luca
>>
>>--
>>Jake
>


Re: [pygame] easy way to check pygame.Color() equality?

2009-01-11 Thread Thiago Chaves
Maybe comparing their hsva or hsla values instead?

-Thiago

On Mon, Jan 12, 2009 at 9:24 AM, Jake b  wrote:
> How do I check for color equality?
>
 r = pygame.Color("red")
 r == pygame.Color("red")
> returns False # expected True, since I don't care if they are the same
> instance of a Color() class
>
> I thought it would be an equality test., like this: [ The print out has
> equivalent values. ]
>
> def ceq(c1,c2):
> return c1.r == c2.r and c1.g == c2.g and c1.b == c2.b and c1.a == c2.a
> --
> Jake
>


Re: [pygame] screen.fill() not working

2009-01-11 Thread Thiago Chaves
pygame.display.flip() is used by lazy people like me who don't want to
worry about updating only dirty rectangles.

Here's an article that explains Dirty Rectangle updating in detail, as
well as reasons to why would one use it:
http://www.geocities.com/SiliconValley/Heights/6547/dirtyrectangles.html

Also, take the opportunity to read the documentation on those two functions. =)

-Thiago

On Sun, Jan 11, 2009 at 7:47 PM, Casey Duncan  wrote:
> http://www.pygame.org/docs/ref/display.html#pygame.display.flip
>
> -Casey
>
> On Jan 11, 2009, at 8:07 AM, Yanom Mobis wrote:
>
>> what's the difference between pygame.display.update() and
>> pygame.display.flip()  ?
>>
>> --- On Sat, 1/10/09, Thiago Chaves  wrote:
>>
>> From: Thiago Chaves 
>> Subject: Re: [pygame] screen.fill() not working
>> To: pygame-users@seul.org
>> Date: Saturday, January 10, 2009, 7:16 PM
>>
>>
>> -Inline Attachment Follows-
>>
>> Hi,
>>
>> You forgot to update the screen.
>>
>> http://www.pygame.org/docs/ref/display.html#pygame.display.flip
>>
>> You should call either pygame.display.flip or pygame.display.update
>> after you finish drawing on the screen.
>>
>> -Thiago
>>
>> On Sat, Jan 10, 2009 at 10:26 PM, Yanom Mobis 
>> wrote:
>> > Ok, I was starting to write a game, so i wrote this code:
>> >
>> > import sys, pygame
>> > from pygame.locals import *
>> > screen = pygame.display.set_mode((500, 200),0,32)
>> > clock = pygame.time.Clock()
>> > bgc = 150, 150, 80
>> > redcar = pygame.image.load("redcar.png").convert_alpha()
>> > while True: #main loop
>> >clock.tick(30)
>> >for event in pygame.event.get(): #every game has one
>> >if event.type == QUIT:
>> >exit()
>> >screen.fill(bgc)
>> >
>> >
>> > but when I run it, the screen is black, not the color I specified.
>> >
>> >
>> >
>> >
>> >
>> >
>>
>
>


Re: [pygame] screen.fill() not working

2009-01-10 Thread Thiago Chaves
Hi,

You forgot to update the screen.

http://www.pygame.org/docs/ref/display.html#pygame.display.flip

You should call either pygame.display.flip or pygame.display.update
after you finish drawing on the screen.

-Thiago

On Sat, Jan 10, 2009 at 10:26 PM, Yanom Mobis  wrote:
> Ok, I was starting to write a game, so i wrote this code:
>
> import sys, pygame
> from pygame.locals import *
> screen = pygame.display.set_mode((500, 200),0,32)
> clock = pygame.time.Clock()
> bgc = 150, 150, 80
> redcar = pygame.image.load("redcar.png").convert_alpha()
> while True: #main loop
>clock.tick(30)
>for event in pygame.event.get(): #every game has one
>if event.type == QUIT:
>exit()
>screen.fill(bgc)
>
>
> but when I run it, the screen is black, not the color I specified.
>
>
>
>
>
>


Re: [pygame] The Giant - 'cool project I'm working on now' - thread.

2008-08-09 Thread Thiago Chaves
Designing caracters for a metroidvania-style game for gamejam. Due to
the late start, only a demo will be delivered in time. =(

-Thiago

On Sat, Aug 9, 2008 at 10:59 AM, DR0ID <[EMAIL PROTECTED]> wrote:
> Hi
>
> here is a good tutorial about 2d collision (probably you already know):
> http://www.harveycartel.org/metanet/tutorials.html
>
> The most important thing to understand is the 'Separating axis theorem' (as
> you probably already know it and you can use it for 3D too). It only handles
> convex polygons. For concave polygons it is a bit more complex (I haven't
> done such, so I have no idea how to handle them, but the internet sure has
> an answer).
>
> I used the same techniques for my pyweek entry Murmel and it worked quite
> well (it is not perfect because of the crappy collision response and it has
> the bullet-paper problem).
>
> ~DR0ID
>
>
> Michael George schrieb:
>>
>> 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
>> algorithm to solve it.
>>
>> This is a subproject/distraction from my game, PEN (puzzles from the
>> engineer's notebook) which was loosely inspired by the incredible machine:
>> http://sourceforge.net/projects/pen/.  You can see a buggy, circles-only
>> version of the dragging problem in the code there if you're curious.  I'm
>> hoping a library would be something useful to other game designers.  What do
>> you think?
>>
>> --Mike
>>
>


[pygame] Gamejam

2008-08-02 Thread Thiago Chaves
Hi pygamers,

Another game-developing contest has recently started, it's called
GameJam and it's being hosted at http://gamejam.org/

Though I was rather uninspired by the chosen theme, it's still yet
another contest and some creative people might come up with something
interesting there. =)

-Thiago


[pygame] Procedural Generation Competition

2008-05-13 Thread Thiago Chaves
Hi all,

hopefully this is not off-topic. But a new game programming competition has
recently started. It's name is Procedural Generation Competition and should
prove interesting.

It begun on 5th of May
It ends on 2nd of June

More information about the competition here (including several articles
which talk about procedural content generation. Even if you're not
participating, it's worth browsing)
http://forums.tigsource.com/index.php?topic=1646.0

-Thiago


Re: [pygame] Help needed with basic 2D collision detection

2008-04-26 Thread Thiago Chaves
It's easier to answer if a piece of the buggy code is pasted here.

But one solution would be making the movement in two steps, for
instance (warning, bad pseudocode ahead):

#Step one, horizontal movement.
x, y = guy.get_position()
xd, yd = guy.get_speed()
xend, yend = x+xd, y+yd

for each block in blocks:
   if block.collide(xend, y):
  xend = block.adjust_position_horizontally(xend, xd) #xd is
passed so that block knows in which direction it should push the
caracted

#Step two, vertical movement
for each block in blocks:
   if block.collide(xend, yend):
  yend = block.adjust_position_vertically(yend, yd)

guy.position = (xend, yend)

-Thiago

On Sat, Apr 26, 2008 at 5:58 PM, Bruno <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Recently started learning Python (my first experience with a programming
> language since actionscript back in the time of Flash 5) and have been
> making a simple 2d platformer to learn the basics. So far the collision
> detection (using only rectangles) is pretty much done and works on a basic
> "stop moving, adjust position" function being called by the player
> character, but the problem I'm having is that it's a little too precise - if
> two squares are stacked one on top of the other, rather than the player
> hitting the upper square and sliding to the floor it will snag on the top of
> the lower square.
>
> Obviously this could be avoided by just making the two squares one
> rectangle, but I'd like to be able to build levels out of many small squares
> (plus the fact I can't work it out has made me all the more determined).
> I've tried various different techniques, such as having a smaller collision
> rect, or unifying the rects of the two squares on the fly, but to no avail.
>
> Provided that all made sense, would anyone be able to suggest a new approach
> I could try? It's pretty simple I know, and I could just rip someone else's
> engine out and use it, but I wouldn't learn much in the process.
>
> Thanks,
>
> Bruno
>


Re: [pygame] networking example

2008-04-26 Thread Thiago Chaves
Whenever I think of networking I get depressed. The only thing I have
ever done so far with networking was junk like "Hello world, through a
socket!".

This is how I wish I could do networking with pyagme

#Setting up a connection
link = pygame.net.connection(address) #address is either a string with
an IP address or an URL.

#Checking for data
net_events = pygame.event.get(NET_DATA)
print net_events[0].source, "sent: ", net_events[0].data

#Checking for errors
net_events = pygame.event.get(NET_ERROR)
foreach event in net_events:
   print event.source, event.error_type #error_type can have values
like "connection refused", "connection lost", "ping timeout"...

#Sending data
link.send_data("B7 B6") #Moving a piece from B7 to B6

#Closing a connection
link.close()

But I guess we don't have anything that simple, do we?

-Thiago

On Sat, Apr 26, 2008 at 11:17 AM, Patrick Mullen <[EMAIL PROTECTED]> wrote:
> Well yes, LAN makes this easier, because you can pick a latency to
>  work with and it will be fairly consistent.  With a consistent
>  latency, you can send a message like: "bullet will be here by the time
>  you get this message" and it should be fairly accurate.  Unfortunately
>  there is currently no networking built into pygame, and yes I think
>  there were some people working on such a thing.  I think your best bet
>  at this point is to use something like twisted or raknet and build
>  your own scheme that fits your game.
>


Re: [pygame] No data from joystick

2008-04-21 Thread Thiago Chaves
Before you get state-changing values such as get_button(n),
get_axis(n) or get_hat(n), you should get (or clear) joystick events
from the queue, otherwise those values are not updated.

Also, if holding a button down doesn't make a difference in your
program, I'd reccomend that you check button presses through the event
queue instead.

Anyway, once again, order is

joystick.init()
...
MAIN LOOP BEGIN
e = event.get(X)
joystick.get_button(0)
joystick.get_axis(0)
joystick.get_hat(0)
...
MAIN LOOP END

-Thiago

On Mon, Apr 21, 2008 at 7:39 PM, Neil Fraser <[EMAIL PROTECTED]> wrote:
> pygame.joystick correctly detects my joystick, reads its name, number
>  of axies, buttons and hats.  But all data relating to the position of
>  these controls is 0.
>
>   joystick.init()
>   print joystick.get_name()
>   -> "Logitech Extreme 3D Pro USB"
>   print joystick.get_numaxes()
>   -> 4
>   print joystick.get_axis(0)
>   -> 0.0
>   print joystick.get_numbuttons()
>   -> 4
>   print joystick.get_button(0)
>   -> 0
>   print joystick.get_numhats()
>   -> 1
>   print joystick.get_hat(0)
>   -> (0, 0)
>
>  The Windows XP game controller window correctly shows control data.
>
>  Any ideas why pygame doesn't see any data?
>
>  --
>  Neil Fraser, Programmer & Wizard
>  http://neil.fraser.name
>


Re: [pygame] image collision

2008-04-11 Thread Thiago Chaves
There are several different ways to do it. Since your question is so
vague, I'll assume that you want to know about rectangle collision,
though.

On Pygame, you got a very useful unit called pygame.rect (
http://www.pygame.org/docs/ref/rect.html ) which, in turn, has a class
called Rect, with a method called colliderect (
http://www.pygame.org/docs/ref/rect.html#Rect.colliderect )

Basically, it means that it is better to pass instances of Rect
whenever you're blitting (drawing) images on the screen, and using
those same instances of rect to verify if they are overlapping each
other through rect1.colliderect(rect2)

I hope that answers your question.

-Thiago


On Fri, Apr 11, 2008 at 7:24 PM, Jan Filip Tristan <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  How to check wheather two images collided?
>
>  TIA blenderkid
>
>


Re: [pygame] is there any limit of surface size?

2008-04-11 Thread Thiago Chaves
Is that:
* The size of a single dimension, meaning that you can at most get a
surface of 16384 pixels per 16384 pixels (given that you have enough
memory to do so)?
* The total area of the image, meaning that you shouldn't be able to
instantiate images bigger than 128 pixels per 128 pixels?
* The total memory used to store the image, in which case, are we
talking about bits, bytes, kilobytes, kibibytes (=P), megabytes or
what?

-Thiago

On Fri, Apr 11, 2008 at 9:43 AM, René Dudfield <[EMAIL PROTECTED]> wrote:
> yeah, 16384 or 16383 I think.
>
>
>
>
>  On Fri, Apr 11, 2008 at 4:25 PM, Madhubala <[EMAIL PROTECTED]> wrote:
>  >
>  >
>  > Hi,
>  >
>  > Is there any limit for the size for a surface creation?
>  >
>  > Regards,
>  > Madhubala
>  >
>  >
>


Re: [pygame] hoe to create the RoundRect ?

2008-03-27 Thread Thiago Chaves
You can also combine rectangles and arcs, I guess.

-Thiago

On Thu, Mar 27, 2008 at 10:45 AM, Ian Mallett <[EMAIL PROTECTED]> wrote:
> Do you mean like a rectangle with rounded edges?  As far as I know, PyGame
> doesn't go that.  You can, however, make several rectangles of different
> sizes, and draw them over each other.  Because they overlap, they will
> appear to form a rounded rectangle.
>  Ian
>


Re: [pygame] scaling the entire screen

2008-03-18 Thread Thiago Chaves
Pardon my ignorance, but isn't it simpler to just scale every separate
image only once when you're loading them? Then you'd keep scale
information in a variable so you can tell what's the apropriate
spacing between images. What's flawed in my idea?

-Thiago

On Wed, Mar 19, 2008 at 6:53 AM, Sibtey Mehdi <[EMAIL PROTECTED]> wrote:
>
>  I am creating a offscreen surface, size (5000, 3200) and drawing Rect then I
>  am scaling down that offscreen surface to fit in to the real surface but I
>  will get the scattered lines on the screen or half rect. Is there any way to
>  solve this problem?
>
>


Re: [pygame] Ideas about storing questions/answers for a boardGame.

2008-01-24 Thread Thiago Chaves
> from os import listdir
>
> from filename in listdir:
>file = open(filename, "rb")
>text = file.read()
>(topic, question, answer) = text.split("--")
>if not base.has_key(topic):
>   base[topic] = []
>base[topic] += [(question, answer)]

Sorry, buggy code. Corrections:

from os import listdir

(...)

base = {}

(...)

from filename in listdir(QUESTIONS_DIR):
   file = open(filename, "rb")
   text = file.read()
   (topic, question, answer) = text.split("--")
   if not base.has_key(topic):
  base[topic] = []
   base[topic] += [(question, answer)]
   file.close()

The code abode does not deal with errors in the text files, but it
builds a dictionary with all the topics you have under the variable
"base".

-Thiago


Re: [pygame] Ideas about storing questions/answers for a boardGame.

2008-01-24 Thread Thiago Chaves
On Jan 25, 2008 12:08 AM, marta sanz <[EMAIL PROTECTED]> wrote:
> I see..
>
> I'm thinking of having questions grouped by subjects (p.e- maths,
> science,English,spanish,..), what do you see better, to have only a text
> file with all the questions/answers that the first word is the key :
>
> p.e-
> maths -- how much is 2+2? -- 4
> science -- which kind of animal is an eagle? -- a bird

from os import listdir

from filename in listdir:
   file = open(filename, "rb")
   text = file.read()
   (topic, question, answer) = text.split("--")
   if not base.has_key(topic):
  base[topic] = []
   base[topic] += [(question, answer)]





> With this option the problem I find is that I have to know how many subjects
> there are, because the number of colours of the squares depend on that (I
> mean, if the teacher wants to play with questions only of maths and science,
> the board will have squares red and other green, so when the player goes to
> a red square the game will show a math question, but if it's a green square,
> the question showed will be about science. If the teacher want to play also
> with questions about English language, the board will show red, green and
> yellow squares, and so on).
>
> Another solution I find is to have a text file for each subject (math.txt,
> science.txt,..) which I find more easy to work with since I don't have to
> check the first word of each line.
>
> I thought also that making a question editor would be a good idea...maybe if
> doing that, parsing the file with XML won't be much dificult since the
> teacher won't need to touch it directly...

The thing is: even "Notepad" or "gedit" have lots of features that
will take you a considerable effort to write, and you still have to go
through the testing and debugging of those editors. If they're there,
why not use them instead? By now those programs should be mature
enough not to be crashing for strange, obscure reasons.

>
> And finally, a thing I'm also not sure of, is the way of representing the
> question or/and answer during the game (maybe a pop-up?, maybe integrated
> on the screen of the game?..)
>
> Thanks so much to all ;)
>
> Marta.
>
>
> El 24/01/2008, a las 10:38, Chris Smith escribió:
>
>
> I too would go with just putting all the questions into a text editor. That
> way it's easy to edit and easy to spell-check the questions and answers.
> You'd need a little bit of code to parse the text files but Python is pretty
> good for that. Anything else would probably be overload.
>
> On 24/01/2008, Thiago Chaves <[EMAIL PROTECTED]> wrote:
> > There's not so much difference in "editing the text file manually" or
> > editing it inside a python program. Both require a similar amount of
> > typing.
> >
> > Plus Ethan's suggestion already takes care of the problem in a much
> > simpler way, and code is already provided.along wth his suggestion.
> > XML is overkill for that task.
> >
> > -Thiago
> >
> > On Jan 24, 2008 2:22 AM, James Paige <[EMAIL PROTECTED] > wrote:
> > > On Wed, Jan 23, 2008 at 07:15:05PM -0500, Ethan Glasser-Camp wrote:
> > > > marta sanz wrote:
> > > > >This game is aimed to be used by my sister's school teacher in her
> class
> > > > >of 10 years old kids. I said this because, despite the fact that I
> will
> > > > >give this game with some questions so they can play from the moment I
> > > > >give it to them, I would like the teacher to make her own question
> bank
> > > > >once the kids have learned the questions I give at the beginning, but
> > > > >have no idea of how can i do a simple bank and how can I access it
> from
> > > > >the pygame code.
> > > >
> > > > Hi,
> > > >
> > > > Someone else suggested XML, but personally that seems too heavyweight
> > > > for a teacher (with possibly no computing experience) to edit. Here is
> > > > what I would do:
> > >
> > > There is absolutely no reason the teacher has to edit the file maually.
> > >
> > > Make an "Edit Questions" mode, or a separate question_editor.py program
> > > that operates on the same data files. Provide one box where the teacher
> > > types the question, and a second box where the teacher types the answer.
> > > Then save the Q/A data in whatever format you decide on (XML, or text,
> > > or other)
> > >
> > >
> > > ---
> > > James Paige
> > >
> >
>
>
>


Re: [pygame] Ideas about storing questions/answers for a boardGame.

2008-01-23 Thread Thiago Chaves
There's not so much difference in "editing the text file manually" or
editing it inside a python program. Both require a similar amount of
typing.

Plus Ethan's suggestion already takes care of the problem in a much
simpler way, and code is already provided.along wth his suggestion.
XML is overkill for that task.

-Thiago

On Jan 24, 2008 2:22 AM, James Paige <[EMAIL PROTECTED]> wrote:
> On Wed, Jan 23, 2008 at 07:15:05PM -0500, Ethan Glasser-Camp wrote:
> > marta sanz wrote:
> > >This game is aimed to be used by my sister's school teacher in her class
> > >of 10 years old kids. I said this because, despite the fact that I will
> > >give this game with some questions so they can play from the moment I
> > >give it to them, I would like the teacher to make her own question bank
> > >once the kids have learned the questions I give at the beginning, but
> > >have no idea of how can i do a simple bank and how can I access it from
> > >the pygame code.
> >
> > Hi,
> >
> > Someone else suggested XML, but personally that seems too heavyweight
> > for a teacher (with possibly no computing experience) to edit. Here is
> > what I would do:
>
> There is absolutely no reason the teacher has to edit the file maually.
>
> Make an "Edit Questions" mode, or a separate question_editor.py program
> that operates on the same data files. Provide one box where the teacher
> types the question, and a second box where the teacher types the answer.
> Then save the Q/A data in whatever format you decide on (XML, or text,
> or other)
>
>
> ---
> James Paige
>


Re: [pygame] Pygame and GUIs

2008-01-22 Thread Thiago Chaves
Thanks for the feedback everyone.

I'm checking both GUI libraries at the moment.

-Thiago

On Jan 22, 2008 3:37 PM, Lukasz <[EMAIL PROTECTED]> wrote:
> Thiago Chaves pisze:
> > Hey all,
> >
> > I know that recently it has been said hat "keeping things simple" is
> > one of the goals of the library,
>
> we can keep it simple by adding GUI libraries into game data files; PGU
> is very small and it's easy to make new bottons, switches etc... style
>


[pygame] Pygame and GUIs

2008-01-22 Thread Thiago Chaves
Hey all,

I know that recently it has been said hat "keeping things simple" is
one of the goals of the library, I am wondering anyways, is there any
intention of adding some GUI widgets in Pygame? (such as buttons,
lists, text fields). If not, is there any libraries that depend solely
on Pygame and have documentation as good as it?

If there are such libraries, think that it would be possible to have
some special section talking about them on www.pygame.org? (I dunno,
something on the documentation or a mere link on the left menu) GUI
Widgets are very commonly used in most games anyway.

-Thiago


Re: PIL/Pygame interoperability Re: [pygame] white line on an image's edge

2008-01-04 Thread Thiago Chaves
Aha

Thanks for the info. I'll try it out here. =)

-Thiago

On Jan 4, 2008 5:46 PM, Dave LeCompte (really) <[EMAIL PROTECTED]> wrote:

> "Thiago Chaves" <[EMAIL PROTECTED]> wrote:
> > If anyone knows of a better method of using Pygame + PIL together, let
> me
> > know, by the way. saving images into HD and reloading them kinda
> disturbs
> > me, but couldn't find a more straightforward way.
>
> I always use the tostring/fromstring methods - it's the same number of
> steps, but it saves hitting the file system.
>
> -Dave LeCompte
>