Re: [pygame] How to prevent mouse initialization in Pygame

2017-07-01 Thread Jake b
The best SE to post this would probably be stack overflow. There's quite a
few pygame questions.

Do you always require sudo to run, or only if using ssh?

On Jun 30, 2017 1:29 PM, "Роман Мещеряков" 
wrote:

> Hi all,
>
> In my Python application running on Raspberry Pi under Raspbian I use
> Pygame to display some software-generated images via framebuffer. I don’t
> need any input from mouse, keyboard or any other devices, all I need is a
> convenient way of using framebuffer.
>
>
>
> I initialize Pygame in the following way:
>
>
> class FramebufferStaticImage(object):
>
>
>
> black = (0, 0, 0)
>
> white = (255, 255, 255)
>
>
>
> _ENV_VAR_DISPLAY = "DISPLAY"
>
> _instance = None
>
>
>
> def __init__(self, log):
>
> "Ininitializes a new pygame screen using the framebuffer"
>
> # Based on "Python GUI in Linux frame buffer"
>
> # http://www.karoltomala.com/blog/?p=679
>
> if FramebufferStaticImage._instance != None:
>
> raise Exception("No more than 1 instance of
> FramebufferStaticImage is allowed!")
>
> FramebufferStaticImage._instance = self
>
> self._log = log
>
> self._log.info("[fb_static_image] Init: entered")
>
> self._screen = None
>
>
>
> # Try ensure using framebuffer and not X11 display even if it
> exists
>
> if self._ENV_VAR_DISPLAY in os.environ:
>
> del os.environ[self._ENV_VAR_DISPLAY]
>
>
>
> os.putenv('SDL_FBDEV', '/dev/fb0')
>
> os.putenv('SDL_VIDEODRIVER', 'fbcon')
>
> os.environ['SDL_NOMOUSE'] = '1'
>
> os.putenv('SDL_NOMOUSE', '1')
>
> self._log.debug("Current environment is: {env}", env = os.environ)
>
> import pygame
>
> pygame.display.init()
>
>
>
> self._width = pygame.display.Info().current_w
>
> self._height = pygame.display.Info().current_h
>
> self._log.info("[fb_static_image] Framebuffer size: {width} x
> {height}",
>
>width = self._width, height = self._height)
>
> self._screen = pygame.display.set_mode(
>
> (self._width, self._height), pygame.FULLSCREEN)
>
> # Clear the screen to start
>
> self._screen.fill(self.black)
>
> # Initialise font support
>
> pygame.font.init()
>
> # Render the screen
>
> pygame.display.update()
>
> self._log.info("[fb_static_image] Init: leaving")
>
>
>
>
> Problem #1: I have mouse pointer at the top left corner of Pygame-drawn
> images. I want mouse pointer to be hidden.
>
> I know that I can disable mouse pointer using pygame.mouse.set_visible,
> but here comes
>
> Problem #2: I have to run my application with sudo in order for pygame to
> not raise “unable to open a console terminal” exception. But I want to run
> my application without root rights, because this increases my application’s
> security.
>
> There are some posts on forums that recommend setting SDL_NOMOUSE=1
> environment variable before initializing pygame which should skip mouse
> initialization and maybe make it possible to get rid of sudo, but this
> doesn’t work for me: I still need to use sudo and mouse pointer is still
> there.
>
> If this makes any difference, I have no mouse or keyboard attached to the
> Raspberry Pi, I connect to it using SSH.
>
> I use
>
> Pygame version 1.9.2~pre~r3348-2~bpo8+rpi1
>
> libsdl-image1.2 version 1.2.12-5+b1
>
> libsdl1.2debian version 1.2.15-10+rpi1
>
>
>
> Does SDL_NOMOUSE work for anyone using recent Pygame versions?
>
> Is it possible to skip mouse initialization in Pygame?
>
> P.S. This question was originally posted on StackExchange
> ,
> but it seems I chose the wrong section. For this reason or another, I
> haven’t got any straight answer yet, so I write here and hope for the best
> :)
>


Re: [pygame] How much blit costs?

2017-06-14 Thread Jake b
Have you profiled your code?

On Jun 14, 2017 4:39 PM, "babaliaris"  wrote:

> Hello. I'm trying to create a game engine with the maximum possible game
> objects per scene. These days, i'm trying to understand how much the blit
> method costs, so for this purpose i created a mini game engine and
> impremented it to create a game which all it does is blitting 15000 images
> on the screen (Actually six, because as you will see below, the other 14996
> are off the screen). So this is how my engine works: Download the source
> code: Github Repository
>  Engine Structure
>  Game Result
>  As you can see, the game
> runs in 50-60 fps. My processor is: AMD FX™ - 6350 Six Core 3.90 GHz. Can i
> do better?
> --
> View this message in context: How much blit costs?
> 
> Sent from the pygame-users mailing list archive
>  at Nabble.com.
>


Re: [pygame] Re: Pygame doesn't close properly so I can't delete the file it's using

2017-05-28 Thread Jake b
That's because my_file is a string, not a file handle.

my_file = "Text To Speech.mp3"



When using with open, the file is closed when the context handler ends


This might be of help:
https://jeffknupp.com/blog/2016/03/07/python-with-context-managers/

Note: In the email, your code did not get posted. I think it has something
to do with nabble. When I clicked on that, then, I do see a couple
different versions.


Re: [pygame] BUG: pygame leaks memory (?)

2016-12-21 Thread Jake b
I don't see any obvious pygame reason. What if you remove numpy? -- if it
still leaks, that would be interesting.

On Dec 20, 2016 7:42 AM, "Christoph Stahl"  wrote:

>
> Hello,
>
> I use pygame to visualize locally on my computer what otherwise can be
> viewed on my self build led matrix that is driven by a raspberry pi.
>
> When I do not use the local display, but the LED matrix, the memory used
> by the python process stays flat.
>
> But when I use the local pygame display - memory usage is steadily
> increasing.
>
> The whole code is on github: https://github.com/stahlfabrik/RibbaPi
>
> Here is an example script, that mimics my code and leaks memory as well. I
> think the code is leaked by pygame - or my usage of pygame.
>
> ###
>
> #!/usr/bin/env python3
>
> import numpy as np
> import pygame
> import sys
>
>
> class Computer():
> def __init__(self, width=16, height=16, margin=5, size=30):
> self.width = width
> self.height = height
> self.margin = margin
> self.size = size
>
> self.window_size = (width * size + (width + 1) * margin,
> height * size + (height + 1) * margin)
>
> pygame.init()
> self.surface = pygame.display.set_mode(self.window_size)
> pygame.display.set_caption("Leak {}x{}".format(width, height))
>
> self.buffer = np.array([255, 255, 255] * width * height,
>dtype=np.uint8).reshape(height, width, 3)
>
> def show(self, gamma=False):
> for event in pygame.event.get():
> if event.type == pygame.QUIT:
> pygame.quit()
> sys.exit()
>
> self.surface.fill((0, 0, 0))
>
> it = np.nditer([self.buffer[:, :, 0],
> self.buffer[:, :, 1],
> self.buffer[:, :, 2]], flags=['multi_index'])
> while not it.finished:
> color = (it[0], it[1], it[2])
> (row, column) = it.multi_index
> pygame.draw.rect(self.surface, color,
>  [(self.margin + self.size) * column +
> self.margin,
>   (self.margin + self.size) * row +
> self.margin,
>   self.size,
>   self.size])
> it.iternext()
>
> pygame.display.update()
>
>
> if __name__ == "__main__":
> import time
> display = Computer()
> while True:
> display.show()
> time.sleep(1/60)
> ###
>
> OS is mac OS 10.12.2. python3 is from homebrew Python 3.5.2. From pip3
> there is numpy==1.11.3 and pygame==1.9.2.
>
> Any hint on what goes wrong here is greatly appreciated!
>
> Best regards,
> Chris
>


Re: [pygame] Pygame 1.9.2 released!

2016-12-16 Thread Jake b
IIRC SDL1 has the same limited support, they just bundle lib SDL_gfx with
SDL1.

On Fri, Dec 16, 2016 at 1:03 PM, Paul Vincent Craven 
wrote:

> SDL2 has limited support for drawing primitives. I think it would be
> difficult to create a complete API compatible Pygame 2.
>
> Paul Vincent Craven
>
> On Fri, Dec 16, 2016 at 11:46 AM, Thomas Kluyver  wrote:
>
>> There's an issue about that:
>> https://bitbucket.org/pygame/pygame/issues/174/pygame-20-the-sdl2-edition
>>
>> The current thinking is that we might bless pygame_sdl2 as the
>> recommended SDL2 version of pygame, and try to share code where it's
>> practical.
>>
>> On 16 December 2016 at 17:16, Jake b  wrote:
>>
>>> I thought 2.0 was for when  pygame uses SDL 2.0
>>>
>>> On Tue, Dec 13, 2016 at 12:58 PM, DiliupG  wrote:
>>>
>>>> congratulations on this! LONG OVERDUE!
>>>>
>>>> next Pygame 2.0
>>>>
>>>> Lets's skip the 1.9.3, 1.9.4, 1.9.agony-of-waiting, and jump straight
>>>> to the future!
>>>>
>>>> Congratulations to all involved once again!
>>>>
>>>> :)
>>>>
>>>> On Tue, Dec 13, 2016 at 7:32 PM, Thomas Kluyver 
>>>> wrote:
>>>>
>>>>> We're pleased to announce the release of Pygame 1.9.2, available now
>>>>> from PyPI and Bitbucket. You can (probably) install it with:
>>>>>
>>>>> pip install pygame
>>>>>
>>>>> The highlights of this version include Python 3 support, and pre-built
>>>>> wheel packages available on PyPI for major platforms, allowing convenient
>>>>> installation with pip. I'm not sure of all the other changes, but there's
>>>>> lots more detail in the WHATSNEW file in the source tree, or the commit
>>>>> history.
>>>>>
>>>>> If you run into problems, please check for and report issues at:
>>>>> https://bitbucket.org/pygame/pygame/issues?status=new&status=open
>>>>>
>>>>> We're already aware of an issue with the mixer_music_test crashing on
>>>>> Linux when installed from a wheel (issue 317).
>>>>>
>>>>> Thanks,
>>>>> Thomas
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Kalasuri Diliup Gabadamudalige
>>>>
>>>> https://dahamgatalu.wordpress.com/
>>>> http://soft.diliupg.com/
>>>> http://www.diliupg.com
>>>>
>>>> 
>>>> **
>>>> This e-mail is confidential. It may also be legally privileged. If you
>>>> are not the intended recipient or have received it in error, please delete
>>>> it and all copies from your system and notify the sender immediately by
>>>> return e-mail. Any unauthorized reading, reproducing, printing or further
>>>> dissemination of this e-mail or its contents is strictly prohibited and may
>>>> be unlawful. Internet communications cannot be guaranteed to be timely,
>>>> secure, error or virus-free. The sender does not accept liability for any
>>>> errors or omissions.
>>>> 
>>>> **
>>>>
>>>>
>>>
>>>
>>> --
>>> Jake
>>>
>>
>>
>


-- 
Jake


Re: [pygame] Pygame 1.9.2 released!

2016-12-16 Thread Jake b
I thought 2.0 was for when  pygame uses SDL 2.0

On Tue, Dec 13, 2016 at 12:58 PM, DiliupG  wrote:

> congratulations on this! LONG OVERDUE!
>
> next Pygame 2.0
>
> Lets's skip the 1.9.3, 1.9.4, 1.9.agony-of-waiting, and jump straight to
> the future!
>
> Congratulations to all involved once again!
>
> :)
>
> On Tue, Dec 13, 2016 at 7:32 PM, Thomas Kluyver  wrote:
>
>> We're pleased to announce the release of Pygame 1.9.2, available now from
>> PyPI and Bitbucket. You can (probably) install it with:
>>
>> pip install pygame
>>
>> The highlights of this version include Python 3 support, and pre-built
>> wheel packages available on PyPI for major platforms, allowing convenient
>> installation with pip. I'm not sure of all the other changes, but there's
>> lots more detail in the WHATSNEW file in the source tree, or the commit
>> history.
>>
>> If you run into problems, please check for and report issues at:
>> https://bitbucket.org/pygame/pygame/issues?status=new&status=open
>>
>> We're already aware of an issue with the mixer_music_test crashing on
>> Linux when installed from a wheel (issue 317).
>>
>> Thanks,
>> Thomas
>>
>
>
>
> --
> Kalasuri Diliup Gabadamudalige
>
> https://dahamgatalu.wordpress.com/
> http://soft.diliupg.com/
> http://www.diliupg.com
>
> 
> **
> This e-mail is confidential. It may also be legally privileged. If you are
> not the intended recipient or have received it in error, please delete it
> and all copies from your system and notify the sender immediately by return
> e-mail. Any unauthorized reading, reproducing, printing or further
> dissemination of this e-mail or its contents is strictly prohibited and may
> be unlawful. Internet communications cannot be guaranteed to be timely,
> secure, error or virus-free. The sender does not accept liability for any
> errors or omissions.
> 
> **
>
>


-- 
Jake


Re: [pygame] Re: Out of memory loading very large image

2016-11-06 Thread Jake b
What are you using a 40,000 x 30,000 image for?

On Thu, Sep 29, 2016 at 4:55 AM, shortcipher 
wrote:

> My system is Windows 10 Home 64-bit on i7-4790 with 16 GB RAM.
>
>
>
> --
> View this message in context: http://pygame-users.25799.x6.
> nabble.com/Out-of-memory-loading-very-large-image-tp2481p2484.html
> Sent from the pygame-users mailing list archive at Nabble.com.
>



-- 
Jake


Re: [pygame] Freezing Pygame projects in Windows

2016-05-09 Thread Jake b
Scott:

On Sat, May 7, 2016 at 2:18 AM, scottmeup  wrote:

> I'm trying to freeze a project made with pygame / SimpleGUICS2Pygame. Every
> tool I've tried apart from pygame2exe results in an executable that stops
> responding. Most of them print a pygame parachute segmentation fault.
>

​Are you using Avast?​

​I was creating exe's with cx_freeze, the code was correct. But they would
"hang" whenever I executed the exe.​ Turns out Avast was causing that
problem.
-- 
Jake


Re: [pygame] pygame Event

2016-03-04 Thread Jake b
On Friday, March 4, 2016, Stuart Laatsc  wrote:

> Well I don't really *need* the __dict__ functionality, but it would be
> *convenient* to have
>

What are you trying to use it for?



-- 
Jake


Re: [pygame] Pygame site

2016-02-28 Thread Jake b
It's probably worth posting to https://www.reddit.com/r/pygame

, they've had threads about updating the website.

On Sun, Aug 9, 2015 at 10:44 AM, Paul Vincent Craven 
wrote:

> Would anyone like to work with me on an updated pygame site? I figure the
> project would be more enjoyable than doing it solo. If we could get some
> decent content, and then maybe hire Kenney to do some artwork, I think we
> could come up with an good site.
>
> I'm working off pygame.info. It runs off wordpress. No programming is
> necessary.
>
> E-mail me if you are interested.
>
> Paul Vincent Craven
>



-- 
Jake


Re: [pygame] Should I use Sprites and Groups ?

2015-12-10 Thread Jake b
If not using hardware, `pygame.display.flip` is the same as
`pygame.display.update(None)`

Sprite groups can be used for partial screen updates instead.

Jake


Re: [pygame] Steam Controller

2015-10-23 Thread Jake b
Steam uses SDL2, pygame uses 1.

Maybe it's not the issue, SDL2 docs sounded like it might be:

Joystick events now refer to an SDL_JoystickID. This is because SDL 2.0 can
> handle joysticks coming and going, as devices are plugged in and pulled out
> during your game's lifetime, so the index into the device list that 1.2
> uses would be meaningless as the available device list changes.
>
>
You should also check out the new Game Controller API
>  too, because it's cool,
> and maybe you did a lot of tap dancing with the 1.2 API that this new code
> would solve more cleanly. You can find it in SDL_gamecontroller.h. The Game
> Controller API integrates really nicely with Steam Big Picture Mode: you
> get automatic configuration of most controllers, and a nice UI if you have
> to manually configure it. In either case, Steam passes this configuration
> on to your SDL application
>

-- 
Jake


Re: [pygame] Closing issue 211 with big-endian CPU test

2015-10-21 Thread Jake b
Or /r/pygame

-- 
Jake


Re: [pygame] Steam Controller

2015-10-21 Thread Jake b
Have you tried the controller using SDL2?

On Wed, Oct 21, 2015 at 6:21 PM, Bartosz Debski 
wrote:

> Hi All,
>
> I know this is quite fresh but if anyone wonders do Steam Controller works
> with PyGame?
> Well answer is a NO at the moment. I have tested it on Win and on Linux.
> Results are the same.
>
>
> >>> import pygame
> >>> pygame.init()
>
> (6, 0)
>
> >>> pygame.joystick.init()
>
> >>> pygame.joystick.get_count()
>
> 0
>
> Some of Linux dmesg
> [ 3144.851372] usb 7-3: new full-speed USB device number 6 using ohci-pci
> [ 3145.005095] usb 7-3: New USB device found, idVendor=28de, idProduct=1142
> [ 3145.005103] usb 7-3: New USB device strings: Mfr=1, Product=2,
> SerialNumber=0
> [ 3145.005108] usb 7-3: Product: Steam Controller
> [ 3145.005111] usb 7-3: Manufacturer: Valve Software
> [ 3145.012350] input: Valve Software Steam Controller as
> /devices/pci:00/:00:13.0/usb7/7-3/7-3:1.0/0003:28DE:1142.000F/input/input14
> [ 3145.012525] hid-generic 0003:28DE:1142.000F: input,hidraw0: USB HID
> v1.11 Keyboard [Valve Software Steam Controller] on
> usb-:00:13.0-3/input0
> [ 3145.018076] hid-generic 0003:28DE:1142.0010: hiddev0,hidraw1: USB HID
> v1.11 Device [Valve Software Steam Controller] on usb-:00:13.0-3/input1
> [ 3145.025307] hid-generic 0003:28DE:1142.0011: hiddev0,hidraw2: USB HID
> v1.11 Device [Valve Software Steam Controller] on usb-:00:13.0-3/input2
> [ 3145.032304] hid-generic 0003:28DE:1142.0012: hiddev0,hidraw3: USB HID
> v1.11 Device [Valve Software Steam Controller] on usb-:00:13.0-3/input3
> [ 3145.039105] hid-generic 0003:28DE:1142.0013: hiddev0,hidraw4: USB HID
> v1.11 Device [Valve Software Steam Controller] on usb-:00:13.0-3/input4
>
> Looks like drivers for controller are provided with Steam client as
> controller kind of works when you are logged into Steam. This mimics
> keyboard and mouse which sort some of the problems.
>
> I have full controller support in my game and as long as gamepad is
> recognised by system then pygame can make use of it. Seems like we need to
> wait for OS level support for it as i got nothing on system level for it.
>
> I have tested also on Super Meat Boy (standalone, non-steam, Linux) and
> gamepad works only if Steam is running as well, so this is broader issue
> and not just pygame.
>
> Thought I share my findings.
>
> Cheers
> Bart
>



-- 
Jake


Re: [pygame] Receiving stack overflow when inheriting Sprite class

2015-10-13 Thread Jake b
You. Can simplify

self.rect.center = scn.rect.center

Also because you use else, you can't hold
​multiple directions at the same time.


If you want to bounce off the top, then

.   yvel *=-1
​
​


Re: [pygame] Is there a file limit on sound files?

2015-09-18 Thread Jake b
On Mon, Sep 14, 2015 at 1:33 PM, Bob Irving  wrote:

> To make it more complicated, some students are running Python in Win7 in a
> VirtualBox on their Macbooks
>

​I'm not sure if it applies in this setup, but are the filenames the right
case?

Also if using folders, does `os.path.join('foo', 'bar.mp3')` fix it?



-- 
Jake


[pygame] Scheduled challenges idea at /r/pygame

2015-07-14 Thread Jake b
Mekire started a thread on the pygame sub, if you're not subscribed check:
https://www.reddit.com/r/pygame/comments/3cqg6h/meta_any_interest_in_bringing_back_community/

I think it's a cool idea. In the past it fizzled out because ideas expected
to much work. With simple problems and giving boilerplate or libs, we could
get quick creative experiments. Almost similar to ludum dare, but targeting
a target submission closer to **15-30 mins of effort**.

If there's interest, I had the idea to write an app to automate
participation for users. In one click it world download the example and
optional libs/boilerplate, uploads your entry, download everyone else's
code in one click, and submits screenshot/gif of your entry to the post.

1) how many subscribers does pygame mailing list have ? /r/pygame has 2k.

2) if we want more, we could try coordinating with a couple of sources:

/r/gamedev
/r/learnpython
/r/learnprogramming
Or some of the weekly coding challenges

Jake Bolton


Re: [pygame] looking for a critique of my code

2015-07-14 Thread Jake b
On Jun 22, 2015 10:11 PM, "tom arnall"  wrote:
>
> hi Chris,
>
> thanks for the offer. i'll post it soon.
>
> Tom

Go for it.

If you want more there's plenty of programming subreddit that allow
reviews. Start with these subs, each of which have many related subs in
their sidebars.

LearnProgramming
Learnpython
Python
Pygame
Gamedev

Do an internal search for'code review' with time<1 year to get an idea if
they are frequent in that sub.


Re: [pygame] What's next for Pygame project?

2015-07-13 Thread Jake b
> cases.
> ​​I expect much of the code that defines extension classes will be
> rewritten. Pygame extensions to SDL, such as custom blitters, may be
> salvaged.
> ​Much of the work will be writing code to support the new SDL 2.0 features.
> ​
>
> ​​

​There's also the problem of Texture vs Surfaces.​

For future code to be backwards compatible we can default to Texture.
But if the user needs pixel access he will need to create a Texture and
Surface.

The 3 options are summarized: https://wiki.libsdl.org/MigrationGuide#Video

​> I'm pretty sure it should be possible to make a version of pygame that
runs existing pygame code while exposing new features to new code -
allowing people to exploit much of their existing knowledge.

and​

On Sun, Jul 12, 2015 at 8:48 PM, Lenard Lindstrom  wrote:

> Hi Jake,
>
> For the parts of SDL2 that did not see a major redesign, such as Surfaces,
> there are enough small differences that simply replacing SDL 1.2 calls with
> equivalent SDL 2.0 functions is not enough. The event types SDL2 posts has
> undergone some reorganization. There is no longer a clear mapping
> equivalence SDL 2.0 and 1.2 in some


Do you think we should​

​ start pygame2 to support SDL2 design decisions rather than trying to
support both old and new code at once? I figured if there was a time to
make potentially breaking design changes to follow modern SDL, now would be
the time to do it.

If we decide pygame2 must be fully backward compatible, I was worried it
would limit future changes. Or that supporting both old with new is adding
too much complexity for something that might not be needed?

-- 
Jake


Re: [pygame] What's next for Pygame project?

2015-07-13 Thread Jake b
Correct me if I'm wrong, but it appears you are using SDL_Surface instead
of SDL_Textures?

https://wiki.libsdl.org/MigrationGuide#If_your_game_just_wants_to_get_fully-rendered_frames_to_the_screen

> One problem is blend modes - many of the pygame blend modes, including
the default alphablend mode, aren't in SDL2.

Different than the alpha blend mode in SDL_SetSurfaceBlendMode
,  SDL_SetTextureBlendMode
, and
SDL_SetRenderDrawBlendMode
 ?

-- 
Jake


[pygame] Which project is actually pygame2?

2015-07-12 Thread Jake b
[1] here's an overview of the new features of the SDL2 api

- https://wiki.libsdl.org/MigrationGuide
-
http://blog.stuff-o-matic.com/post/2013/09/15/ASGP-s-Android-Port-Part-II%3A-from-SDL-1.2-to-SDL-2
.

[2] I'm confused by all the forks/patches. I am not  clear which is
official. I'm not even sure which one someone should contribute to?

- ​pygame2
- Maybe another name of one of the below?
- pysdl2
- Continued from pySDL
- is not pygame_sdl2
- https://bitbucket.org/marcusva/py-sdl2/downloads
- pyreloaded​
- Maybe an old name for pygame2?
- ​Ren'Py
- aka pygame_sdl2
- https://github.com/renpy/pygame_sdl2
- Lindstrom Pygame 1.9.2 patch,
https://bitbucket.org/llindstrom/pygame-1.10-patch
- Uses SDL2, but maintains backward compatible pygame1 api


[3]
​> The structure of SDL 2 differs from SDL 1.2​

Does this mean pygame2 should not start off using the 1.9.2 patch?

How important is keeping 100% backward compatibility of SDL1 in pygame2?
is. Will that end up mixing new and old rendering methods? Or is it worth
making older code easier to port?

​I know SDL2 does drop some support for some old platforms like Mac OS 9.​

​Thanks,
-- 
Jake


Re: [pygame] What's next for Pygame project?

2015-07-12 Thread Jake b
On Sun, Jul 12, 2015 at 10:05 AM, Paul Vincent Craven  wrote:

> Odds and ends:
>
>- ​​
>A big limitation on SDL 2.0 for me was the lack of good primitive
>drawing commands. Drawing lines, rectangles, etc. were limited to 1 pixel.
>
> P
​ygame used gfx so Pygame2 will probably have SDL2_gfx
http://www.ferzkopp.net/Software/SDL2_gfx/Docs/html/index.html​

Using oldschool pixel rendering is slow on hardware.

>
​> I don't think a Pygame website needs to be build on Python. I've got the
pygame.info domain and I think a Wordpress site that has several verified
contributers would be the way to go. Share the 'love' and efforts across
several people.

I think you're right.​ In the past only a couple people had control on
rebuilding the site. If they went MIA or needed help it stalled since
nobody could coordinate easily.
-- 
Jake


Re: [pygame] What's next for Pygame project?

2015-07-12 Thread Jake b
Lenard

On Sat, Jul 11, 2015 at 7:20 PM, Lenard Lindstrom  wrote:

> Much of the delay is due to logistics. With the loss of the automated
> build site a few years back there is no simple way to check a commit
> against all supported operating systems. It also limits user testing.
>

What would we need?

I need someone to take over official Windows support from me, since I am
> stuck on Windows XP. I have the MinGW based dependency build chain working
> again for 32bit Windows, but did not get everything to build for 64bit
> Windows. So no official 64bit prebuilt libraries yet on the Bitbucket
> download page.
>

​I have surgery this week, but ​
​if nobody ​does this by then I will look into setting something up. I have
win8 64bit.

The structure of SDL 2 differs from SDL 1.2. It does not fit well Pygame's
> api. So I expect a significant redesign of modules and classes for Pygame
> 2. For instance, the display module will basically go away, replaced with a
> Window class.
>

​I think there's (a lot​?) of new non-backward compatible features? [multi
windows, default hardware support, touch events, etc]. Are there other
changes that were previously skipped because it wasn't backward compatible.

What I mean is maybe pygame2 should start with design changes, rather than
worrying on making a completely backward compatible choices?

This is an opportunity to replace C coded extension modules with Cython and
> a Python level foreign function interface. Personally, I would like to see
> Pygame fully support PyPy as well as CPython. Also, some of the Pygame code
> can be separated out as stand-alone, Python independent, libraries to
> encourage support from outside the Pygame community.


​Do you know​

​what or how much needs to be done?​


 * Website replacement and love
>> * Migrate forum to Reddit (or community forum)
>>
>
I think we should leverage the existing:

- https://www.reddit.com/r/pygame
- ​http://stackoverflow.com/questions/tagged/pygame

-- 
Jake


Re: [pygame] BUG keyboard events

2015-05-13 Thread Jake b
After these changes, all your `break` statements are no longer needed.

First things I noticed, you are only parsing one event per game loop.
You're missing a ton of events. Instead use:

for event in pygame.event.get():

For  `eat_cpu`, instead sleeping.  Use either `time.wait` or `time.delay`
depending on your requirement. Sleep doesn't use your CPU to delay. And
`eat_cpu` has a undefined time.

Your main loop becomes:

while Working:
for event in pygame.event.get():
# handle events

# math

# render

`get_key_info(k)` becomes:

def get_key_info(k):
return pygame.key.name(k)

On Tue, May 12, 2015 at 7:42 PM, Виталий  wrote:

> Hi, I got bug in pygame
> If I change window resolution in keyboard handler then I got strange KEYUP
> event:
> 
> (K_RIGHT)
>  (K_RIGHT) # HERE
>  (K_RIGHT)
>
> but if I hit key very quickly, then I got that:
> 
> (K_RIGHT)
>  (K_RIGHT)
>
> And sometimes pygame stops to receive any keyboard events, but mouse and
> all other is ok (ALT + F4 still works)
>
> To check bug try to press "a", "s", "d", "right" at the same time few
> times, after few tries pygame stops to receive any keyboard events.
>
> My system:
> $ uname -a
> Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.57-3 x86_64 GNU/Linux
>
> $ cat /etc/os-release
> PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
> NAME="Debian GNU/Linux"
> VERSION_ID="7"
> VERSION="7 (wheezy)"
> ID=debian
> ANSI_COLOR="1;31"
> HOME_URL="http://www.debian.org/";
> SUPPORT_URL="http://www.debian.org/support/";
> BUG_REPORT_URL="http://bugs.debian.org/";
>
> $ python
> Python 2.7.3 (default, Mar 13 2014, 11:03:55)
> [GCC 4.7.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>>   import sys, pygame
> >>>   sys.version
> '2.7.3 (default, Mar 13 2014, 11:03:55) \n[GCC 4.7.2]'
> >>>   pygame.ver
> '1.9.1release'




-- 
Jake


Re: [pygame] OpenGL stretch of a pygame.Surface

2014-08-04 Thread Jake b
Just a warning, glBegin(), glEnd() is deprecated, and so you know it's an
old tutorial.

Have you tried  SFML's python binding? It's a bit like Pygame, and
abstracts the OpenGL functions for you.


On Tue, Jul 29, 2014 at 7:38 AM, sylvain.boussekey <
sylvain.bousse...@vertpingouin.fr> wrote:

> I tried that with almost no perf gain.
> I managed to do it in opengl but perfs are poor... The only advantage is
> that there is almost no fps differences when increasing resolution. But
> still framerate is poor. Here is roughly what I do (without knowing what I
> do really)e :
>
> def openglblit(self, surf):
> textureSurface = surf
>
> textureData = pygame.image.tostring(textureSurface, "RGBA", 1)
>
> width = textureSurface.get_width()
> height = textureSurface.get_height()
>
> texture = glGenTextures(1)
> glBindTexture(GL_TEXTURE_2D, texture)
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
> glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
> GL_UNSIGNED_BYTE, textureData)
>
> glClear(GL_COLOR_BUFFER_BIT)
>
> glBindTexture(GL_TEXTURE_2D, texture)
> glBegin(GL_QUADS)
> glTexCoord2d(0,1)
> glVertex2d(-1,1)
> glTexCoord2d(0,0)
> glVertex2d(-1,-1)
> glTexCoord2d(1,0)
> glVertex2d(1,-1)
> glTexCoord2d(1,1)
> glVertex2d(1,1)
>
> glEnd()
> glFlush()
>
> glDeleteTextures(texture)
>
> But it seems that the conversion between pygame surface and opengl tex is
> slow.
> Argh !! I will really need to go full opengl if I want better perfs...
> sad...
>
>
> Le 2014-07-28 23:14, Noel Garwick a écrit :
>
>> vertpingouin,
>>
>> If you are doing that every frame as part of the sprites .draw or
>> .update method , its still possible the transform is what is taking up
>>
>> CPU time.  You may want to use something like this instead:
>>
>> class MySpriteThing( pygame.sprite.Sprite):
>> image = None
>> def __init___( self ):
>>
>> .
>> if MySpriteThing.image is None:
>> MySpriteThing.image = pygame.image.load( "foo.png" )
>> size = MySpriteThing.image.get_size()
>> new_width = size[0] * X_SCALE # where X_SCALE is the
>> ratio between RESOLUTION_X (the big resolution) and GRAPHICS_X (the
>> resolution the images were made at) ; ( 1920 / 640 )
>> new_height = size[1] * Y_SCALE
>> MySpriteThing..image = pygame.transform.scale(
>> self.image, ( new_width, new_height ) )
>>
>> self.image = MySpriteThing.image
>>
>> 
>>
>> # then, in your main loop, blit the sprites .image attribute to your
>>
>> display surface
>>
>> mySpriteGroup.draw( screen )
>>
>>  pygame.display.update()
>>
>> On Mon, Jul 28, 2014 at 4:41 PM, vertpingouin
>>  wrote:
>>
>>  to Sam :
>>>
>>> Im using HWSURFACE flag but I got exatly the same framerate. The
>>> ideal
>>> would be to rewrite everything in openGL but I dont know it well...
>>> yet.
>>>
>>> to Noel:
>>> On the topic of performing transform one time only, Im not sure
>>>
>>> what
>>> mean here. If I scale my surface one time, it gets, say, 1920x1080,
>>> but
>>> then blitting is done only of a 640x480 part of the surface... So
>>> maybe
>>> I misunderstood something here.
>>>
>>> Im using this to transform :
>>>
>>> pygame.transform.scale(self.native, (SCREENWIDTH, SCREENHEIGHT),
>>> self.screen)
>>>
>>> where native is the little one and screen the big one. I assume
>>> that
>>> self.native is scaled then blit onto self.screen...
>>>
>>> I think this is the blitting that is slow because if I use a lesser
>>> resolution for self.screen, I almost get back my precious frames
>>> per
>>> second.
>>>
>>> It will be really cool to send my little native surface to my
>>> graphic
>>> card, then let it scale by itself. Dont know if its even possible.
>>>
>>>
>>> Le lundi 28 juillet 2014 à 11:50 -0400, Noel Garwick a écrit :
>>>
>>>  Right now you are blitting tiles to a 640x480 surface, and then

>>> > performing a transform on the whole surface and then blitting it
>>> to
>>> > the display?
>>> >
>>> >
>>> > If this is the case, then try to only perform the scale operation
>>> when
>>> > the resolution is changed (instead of once each frame) and see
>>> how
>>> > that works.  I know you mentioned that the full screen blit
>>> operation
>>> > seems to be the main bottleneck, but this should help too.
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > On Mon, Jul 28, 2014 at 7:32 AM, Sam Bull >> [1]>
>>>
>>> > wrote:
>>> > On lun, 2014-07-28 at 06:54 +0200, VertPingouin
>>> wrote:
>>> > > So I came up with the idea of an hardware opengl
>>> texture
>>> > stretching
>>> > > instead of a dumb blit but I dont know how to
>>>
>>> achieve it.
>>> > >
>>> > > Anyone has already done thi

Re: [pygame] This program breaks on my Linux

2014-06-29 Thread Jake b
> SIGTERM (15) does not kill the program. SIGKILL (9) does.

You need to handle event QUIT.


Re: [pygame] Pygame not handling keyboard tracking correctly

2014-06-22 Thread Jake b
Try removing pump(), since you are using event.get()
http://www.pygame.org/docs/ref/event.html#pygame.event.pump

Otherwise a small, runnable script lets others try it.

-- 
Jake


Re: [pygame] Scaling the hitbox/rect of a sprite

2014-05-22 Thread Jake b
To preserve the center:


pos = self.rect.center
self.rect = self.rect.inflate(-85, -20)
self.rect.center = pos





On Thu, May 22, 2014 at 5:47 AM, Skorpio  wrote:

> Hi everybody,
>
> How can you scale the hitbox of a sprite? I tried self.rect =
> self.rect.inflate(-85, -20) and that scaled the rect correctly (to the
> center of the rect), but the game still takes the upper left corner of the
> rect as the blit position for the image/surface. That means the rect covers
> only the upper left part of the sprite, so that the left half of the sprite
> image can be hit and the right half can't be hit.
>
> Regards,
> Skorpio
>
>
>
> --
> View this message in context:
> http://pygame-users.25799.x6.nabble.com/pygame-Scaling-the-hitbox-rect-of-a-sprite-tp1227.html
> Sent from the pygame-users mailing list archive at Nabble.com.
>



-- 
Jake


Re: [pygame] IDE ?

2014-04-20 Thread Jake b
Does pycharm seem to run slow? Compared to sublime / visual studio, the UI
is sluggish. Maybe it's a bad version I used?
On Wednesday, April 16, 2014, Richard R.  wrote:

> I'm usually a hand coder, who doesn't use an IDE often, but I've been
> trying PyCharm out lately and it's wonderful.
> My project which uses PyGame, is using CEF Python as the GUI, and the
> debugger has no issues digging in.  The class inspector and code-completion
> are really nice, for the languages it supports.  And the free version gives
> more than I might expect from free software.
>
>
> On Wed, Apr 16, 2014 at 3:25 PM, Russell Jones 
> 
> > wrote:
>
>> I like spyder. Version 2.3 (in beta) supports python 3. It has
>> variable and object inspection, class/source hierarchy panel, embedded
>> ipython console (if you have zmq installed) and other nice stuff. You
>> could try installing it from the repository in a virtualenv with pip
>> install hg+https://bitbucket.org/spyder-ide/spyderlib if you're
>> feeling adventurous. There are also installation instructions at
>> https://bitbucket.org/spyder-ide/spyderlib/overview where there's a
>> Windows version. It's probably simplest to go for a release version.
>>
>> I've been using 2.3b3 for a few months on and off with no problems
>> (via MacPorts, py33-spyder-devel, specifically). It works best with
>> pep8, pylint, pyflakes, rope (being replaced with something else
>> soonish, though, I forget what) and I think a few other support(ed)
>> modules installed as well as the required dependencies. I suggest you
>> tweak the code introspection features in preferences (and generally
>> set things up as you like there).
>>
>> Russell
>>
>> On 8 April 2014 01:02, David 
>> >
>> wrote:
>> > This must have been asked before
>> >
>> > Which IDE do you like?
>> > I'd want Free and Cross-Platform (Win/Linux).
>> > A debugger would be very handy.
>> > Would be beneficial if it is widely used and that it will be around a
>> good
>> > long time.
>> >
>> >
>> > I can't tell if they mean Eclipse/Pydev has a steep learning curve
>> because
>> > of the installation/setup or the everyday use?
>> >
>> > If not that, then Spider and PyScripter looked like possible
>> candidates...
>> >
>> >
>> > I know there are hold outs for Emacs and Vim...(Im a Vim usermyself)
>> > but I'm asking whihc IDEs do you use and like (and if you dont use one,
>> > perhaps you know of one that many people generally use and like)
>> >
>> > thanks.
>> >
>> > --
>> > David
>> > Running Linux since 1994
>>
>
>

-- 
Jake


Re: [pygame] preview of new pygame website... HiFi part

2014-04-08 Thread Jake b
Phone versions:
Android 4.4.2
Chrome 34.0.*
firefox 29 (beta and stable)

For highlighting game updates, maybe use the widget steam has (I think it's
called: carousel, ex: http://store.steampowered.com/  ) It cycles through
large images + links.

I had a thought about the data density:

If using a steam widget to feature the 5 most recent (or manually featured
games). Then continue more in the column, like it currently does.

If using the a slideshow / steam widget above: you could remove the news
section. If there's recent news, insert items into the steam-slideshow
widgit. (Clicking it will navigate to the full-news page)

The same thing could work for videos. (If new ones aren't submitted real
frequently, yet it'd still be nice to have on the front.)

Maybe news and videos will be frequent enough always using a column is best.


On Tue, Apr 8, 2014 at 10:51 AM, René Dudfield  wrote:

> Thanks for the notes Jake.
>
> Perhaps if I play a subtle highlighting animation on page load, and
> highlight the arrow keys as the Left/Right buttons are that might help
> people notice them.
>
> btw, your phone is an android?
>
> cheers,
>
>
>
> On Tue, Apr 8, 2014 at 5:26 PM, Jake b  wrote:
>
>> Minor notes .
>>
>> I didn't realize the top menu at first. Might be too subtle.
>>
>> I tested it on my phone, chrome and Firefox.
>>
>> Chrome
>> + doesn't work with swipe gesture.
>> + arrow buttons: About 10% of the time the site scrolls 2 columns.
>>
>> While swipe works on ffx, but is giving false positives. If I scroll up /
>> down. Ex displacement of 10px x, 300px y, it pages.
>>
>
>


-- 
Jake


Re: [pygame] preview of new pygame website... HiFi part

2014-04-08 Thread Jake b
Minor notes .

I didn't realize the top menu at first. Might be too subtle.

I tested it on my phone, chrome and Firefox.

Chrome
+ doesn't work with swipe gesture.
+ arrow buttons: About 10% of the time the site scrolls 2 columns.

While swipe works on ffx, but is giving false positives. If I scroll up /
down. Ex displacement of 10px x, 300px y, it pages.


Re: [pygame] preview of new pygame website... HiFi part

2014-04-07 Thread Jake b
The page doesn't change layouts, so decreasing page width makes content go
missing. AKA responsive design.


On Mon, Apr 7, 2014 at 9:08 PM, Sean Felipe Wolfe wrote:

> Playfulness +100 ! There are lots of gaming frameworks out there with
> plenty of technical information. I love how the current site really is
> a nod to a kid's creative mindset. Or at least ... how I think kid
> mindset would be ... from my NES days.
>
> On Mon, Apr 7, 2014 at 4:22 PM, Carlos Zuniga 
> wrote:
> > On Mon, Apr 7, 2014 at 5:53 AM, Sam Bull  wrote:
> >> On lun, 2014-04-07 at 18:07 +1200, Greg Ewing wrote:
> >>> Al Sweigart wrote:
> >>> > Oh, also, we should keep the Pygame logo. It's familiar branding,
> and it
> >>> > doesn't look bad at all.
> >>
> >> Actually, I think that's another bug. If you zoom in (Ctrl +
> >> scrollwheel), at some point the logo appears. So, that's something that
> >> needs to be fixed, so it displays at all times. Perhaps using a vector
> >> graphic for the logo, so it scales nicely?
> >
> > It doesn't appear for me even trying all kinds of zooming.
> > I am using Chromium Version 33.0.1750.152 Debian jessie/sid
> >
> > If I change this `` for this ` > id="the-logo" src="/images/logo.png" />` in the dev console then it
> > works :)
> >
> > I like the content of the columns, but not a fan of the horizontal
> > scrolling. If you plan to keep this design though, I'd like it if the
> > columns were a bit wider.
> > My screen fits 4.5 columns. I think 3 columns + a bit more white space
> > between them would look better.
> >
> > I also think it should tell you what Pygame is, maybe add a short
> > description under the logo, something along the lines of: "PyGame
> > allows you to make games with Python."
> >
> > Also, to add playfulness, maybe use the Comic Neue font for headers?
> > http://comicneue.com/
> >
> > --
> > Carlos
>
>
>
> --
> A musician must make music, an artist must paint, a poet must write,
> if he is to be ultimately at peace with himself.
> - Abraham Maslow
>



-- 
Jake


Re: [pygame] Python3 version packaged?

2014-03-21 Thread Jake b
I tried to find what version SDL2 uses, but I didn't see any mention off
portmidi.


Re: [pygame] Quick OS survey - 2013

2013-12-14 Thread Jake b
70% Windows 7
10% iOS 7
20% Linux (Nexus 5 android / Rpy  and other Linux )


Re: [pygame] String replace error in docs

2013-11-27 Thread Jake b
The front page needs an update, it points to http://www.pygame.org/docs/
On Nov 24, 2013 7:08 PM, "Lenard Lindstrom"  wrote:

> Those docs are for Pygame 1.9.1, and are very outdated. Use
> http://pygame.bitbucket.org/docs/pygame/index.html for up-to-date docs.
>
> Lenard Lindstrom
>
> On 13-11-23 08:40 PM, Jake b wrote:
>
>> See the broken output at
>>
>> http://www.pygame.org/docs/ref/sprite.html#pygame.sprite.LayeredUpdates
>>
>> --
>> Jake
>>
>
>


[pygame] String replace error in docs

2013-11-23 Thread Jake b
See the broken output at

http://www.pygame.org/docs/ref/sprite.html#pygame.sprite.LayeredUpdates

-- 
Jake


Re: [pygame] pygame idea: pgHoF (pygame Hall of Fame)

2013-10-31 Thread Jake b
If we suggest projects to be posted on github/etc, that would prevent
dying links.

Down the road maybe viewer's votes would simplify who to choose for
the month. I'm thinking simplicity is better here. ( facebook and
greenlight only have an upvote, no downvotes ). We could could pick by
recent-popular activity.

--
Jake

On Thu, Oct 31, 2013 at 7:27 AM, Jason Marshall  wrote:
> There are a lot of old projects on pygame.org with dead links. This isn't
> newbie friendly. To counter this, I boldly propose the following:
>
> Deletion of old projects if the user is inactive and the links are dead.
> Enshrinement of the really good old projects into a pygame Hall of Fame.
> Proposed details:
>
> The pgHoF project must be really good. We'll need volunteers to nominate
> projects and vote for a winner.
> The pgHoF project must use pygame or a derivative of it.
> The pgHoF project must have freely-available source code.
> The pgHoF project must be >= 1 year old.
> To make it elite, only 1 pygame application can be added per quarter
> (January-March, April-June, July-September, October-December).
> If necessary, the pgHoF application will be modified to run on pygame 1.9.2.
> Installation will be simpler than installing Python, especially on Windows.
>
>
> What do you think?
> Jason



-- 
Jake


[pygame] leveraging current non-mailing list members

2013-10-25 Thread Jake b
Once the site is updated, I think it needs a system for more dynamic
addition of lower level admins.
Because there's plenty of people active in the non-mailing list sites, like:

http://www.reddit.com/r/pygame
http://www.reddit.com/r/gamedev
http://www.reddit.com/r/learnprogramming
http://stackoverflow.com/questions/tagged/pygame

I'm sure we could get volunteers to post news, since there's
frequently a coding jam or perhaps even link to Screenshot Saturdays?
( Example: 
http://www.reddit.com/r/gamedev/comments/1o9xo6/screenshot_saturday_140_streamtown/
)

Note: If you read screenshot saturday, having RES to auto-expand all
gifs is nice.
-- 
Jake


Re: [pygame] Pygame "look and feel"

2013-10-25 Thread Jake b
I think last time it was one or two guys, so if they had to quit/break
there wasn't a system to transfer.

Perhaps if the site were on `git`, then we could easily have people
make a change or two, without one guy having to devote full time to
it.
-

On Sat, Oct 12, 2013 at 4:29 PM, Frozenball  wrote:
> I hope the website gets the new look this time. I remember there was an old
> project a year or two ago about updating the website that ultimately didn't
> go anywhere.
>
>
> 2013/10/10 Aikiman 
>>
>> Slight adjustment making the word more legible
>>
>> 
>>
>>
>>
>> --
>> View this message in context:
>> http://pygame-users.25799.x6.nabble.com/Pygame-look-and-feel-tp906p956.html
>> Sent from the pygame-users mailing list archive at Nabble.com.
>
>



-- 
Jake


Re: [pygame] Pygame "look and feel"

2013-10-09 Thread Jake b
I like it, but I think keeping the 'spotlight' and 'new releases'
sections somewhere on the front will be good to have.

Perhaps using one of those "multiple items in one rect" that steam and
many sites use these days.

On Wed, Oct 9, 2013 at 4:10 AM, Aikiman  wrote:
> Took some design and colour scheme off a Joomla template online tsk tsk (they
> all do the same thing nowadays anyways) and threw a pygame version on top
> with new Snakey.
>
> 
>
>
>
> --
> View this message in context: 
> http://pygame-users.25799.x6.nabble.com/Pygame-look-and-feel-tp906p951.html
> Sent from the pygame-users mailing list archive at Nabble.com.



-- 
Jake


[pygame] news items:

2013-10-09 Thread Jake b
Couple ideas for today:

1- http://www.reddit.com/r/pygame/comments/1o3529/student_pygame_animations/
2- 
http://www.reddit.com/r/BaconGameJam/comments/1nlyov/bacongamejam_06_on_20131025_2200_utc_48_hours/

-- 
Jake


Re: [pygame] Pygame "look and feel"

2013-10-08 Thread Jake b
I like the concept.

- The choice looks like it'd scale pretty well too, which might be a
consideration. ( So that a 64px or so icon could work )
- It's more obvious that it's a snake

Maybe the bottom right one (no text) would be a good icon/small sized.
And a text one if it's bigger or a website.

On Fri, Oct 4, 2013 at 2:45 AM, Aikiman  wrote:
> For what its worth then here are a couple of designs of the logo. Im only
> throwing them up here because i've already done the work but if you are
> interested I can continue onward with colors, otherwise I can drop this no
> problems. Maybe its something for the future then.
>
> 
>
>
>
> --
> View this message in context: 
> http://pygame-users.25799.x6.nabble.com/Pygame-look-and-feel-tp906p912.html
> Sent from the pygame-users mailing list archive at Nabble.com.



-- 
Jake


Re: [pygame] spam on cookbook?

2013-06-01 Thread Jake b
Oh man I missed that completely. It looks cool. I would help out editing
docs as an editor.


On Fri, May 17, 2013 at 8:27 AM, Paul Vincent Craven
wrote:

> I started a WordPress version of the site (http://pygame.info). I thought
> it might be nice to add a set of trusted editors (like keep a dozen or so
> active members) so that we can have the news updated on a regular basis and
> avoid the spam. Plus have an updated look and feel.
>
> There wasn't a lot of interest on this, and I was finishing my pygame
> book, so it has just sat for now.
>
> The bitbucket site might be another good alternative.
>
> Paul Vincent Craven
>
>
> On Thu, May 16, 2013 at 9:36 AM, Jason M. Marshall  wrote:
>
>> I know that the WordPress CMS has a plugin called Bad Behavior for
>> blocking wiki spam, but I haven't tried it myself.
>>
>> Jason
>>
>>   --
>>  *From:* Jake b 
>> *To:* "pygame-users@seul.org" 
>> *Sent:* Tuesday, May 14, 2013 7:43 PM
>> *Subject:* Re: [pygame] spam on cookbook?
>>
>>
>> I wonder there must be some method or different CMS that would help with
>> the spam issue.
>>
>>
>> On Tue, May 14, 2013 at 4:28 PM, James Paige wrote:
>>
>> That is definitely spam. Many of the wiki pages on pygame.org are still
>> plagued with it :(
>>
>> On Tue, May 14, 2013 at 04:04:39PM -0500, Jake b wrote:
>> >I found strange links on the bottom of the cookbook. It just says
>> >
>> >http://
>> >--
>> >Jake
>>
>>
>>
>>
>> --
>> Jake
>>
>>
>>
>


-- 
Jake


Re: [pygame] which version?

2013-05-31 Thread Jake b
The site doesn't make it clear, but I think you use these installers first
: https://bitbucket.org/pygame/pygame/downloads



On Thu, May 30, 2013 at 11:52 AM, David  wrote:

> It would be helpful if there were a table showing
>
> *if you have this**this *
> *Version of **Python  *then use* **Version* of *Pygame*
>
> Python 3.3.2   
> pygame-1.9.2a0
> Python 3.2.5   
> pygame-1.9.1
> Python 2.7.5   
> pygame-1.9.1
>
>
> Or something similar.
>
> I looked on the pygame page and it was not apparent which version to
> download based on which version of Python.
>
> I have Python Python 
> 3.3.2 -
> WHICH VERSION OF PYGAME WILL WORK WITH THAT?
>
> Thanks! (and sorry if its there and I missed it)
>
> --
> David
>



-- 
Jake


Re: [pygame] spam on cookbook?

2013-05-14 Thread Jake b
I wonder there must be some method or different CMS that would help with
the spam issue.


On Tue, May 14, 2013 at 4:28 PM, James Paige wrote:

> That is definitely spam. Many of the wiki pages on pygame.org are still
> plagued with it :(
>
> On Tue, May 14, 2013 at 04:04:39PM -0500, Jake b wrote:
> >I found strange links on the bottom of the cookbook. It just says
> >
> >http://
> >--
> >Jake
>
>


-- 
Jake


[pygame] spam on cookbook?

2013-05-14 Thread Jake b
I found strange links on the bottom of the cookbook. It just says

http://www.el7z.com/search.php?t=%D8%A7%D9%84%D8%B9%D8%A7%D8%A8%20%D8%AA%D9%84%D8%A8%D9%8A%D8%B3

-- 
Jake


[pygame] download page should more clearly link the new binaries

2013-04-26 Thread Jake b
at http://www.pygame.org/download.shtml it can appear that the newest
package is from 2009 ( I've seen several posts on SO where under the
assumption that pygame doesn't have a py3.x installer )

But lower there are links to py3.x 32/64 binaries. And there are also:
https://bitbucket.org/pygame/pygame/downloads

I'm not sure myself which installer is preferred to recommend.

-- 
Jake


Re: [pygame] Comparing the image on two Surface objects.

2012-12-10 Thread Jake b
Do you want to know If they are pointing to the same surface, or duplicate
memory?


On Thu, Nov 29, 2012 at 4:10 PM, Al Sweigart wrote:

> Is there any way I can check if the images on two pygame.Surface objects
> are identical? Or will I have to write a function that gets PixelArray
> objects from these surfaces and then compares them pixel-by-pixel?
>
> -Al
>



-- 
Jake


Re: [pygame] 2D Game - Thankyou for all help

2012-10-08 Thread Jake b
Break it up into a bunch of simpler pieces. You might start with:


   1. make a single guy on screen,
   2. use arrow keys to move him
   3. add enemies
   4. click to select a guy, now clicking will move a guy
   5. make guys auto-shoot at other guys
   6. add a tileset ( this folder has a demo)
   
http://code.google.com/p/ninmonkey/source/browse/#hg%2Fexamples%2Fmaptiles_numpy
   7. save and load tilesets
   8. add a second layer, that contains buildings / objects

Making simpler quick projects / prototypes are good to learn too.

   1. make a text RPG or adventure game
   2. save / loader of game state ( Use CSV, XML or Pickle)
   3. make classic arcade games
   1. Pong
  2. Asteroids
  3. Tron
  4. mario
  5. pacman

etc...



On Sun, Oct 7, 2012 at 1:10 PM, shane  wrote:

> HI
>
> Thanks for all the advice - but decided i will stick with Pygame and
> actually learn how to code instead of trying to use a programme that does
> it
> for you - tried that with web page designing and it was kinda difficult and
> never came out right lol
>
> have this idea for a 2d RPG stratergy game, but its huge and will have to
> do
> something simpler - my problem is i enjoy detail and technical stuff eg not
> combining two resources and creating a tank and im looking to create a
> modern day role playing game to survive in a modern world
>
> in the path of Fall Out 1 & 2 and a few others
>
> So thinking of a similar project to practice and simplifying my idea
>
> so as i have asked before - i have read the manuals of - "making games with
> python and pygame" as well as other tutorials but where can i find info
> specific to beginning and how to write a 2D RPG stratergy game importing
> share maps graphics objects etc
>
> where my character can create objects to create things, building, locating
> and fortifying a home base, planting, scavaging, reseaching, learning,
> training, eating, sleeping and drinking water to survive in a real time
> enviroment which of course can be speeded up. being able to carry only a
> certain amount of supplies, and also being able to give your survivors
> under
> you orders to complete tasks
>
> and even here i still think my project is to big
>
> at the moment im busy with pygame tutorials and help files
>
>
>
> --
> View this message in context:
> http://pygame-users.25799.n6.nabble.com/2D-Game-Thankyou-for-all-help-tp230.html
> Sent from the pygame-users mailing list archive at Nabble.com.
>



-- 
Jake


Re: [pygame] Redesigning the pygame.org website

2012-09-19 Thread Jake b
It would be nice if projects/games could be uploaded to the site like
google allows automatically with mercurial (Hg) commits.

-- 
Jake


[pygame] pyweek voting is starting

2012-04-30 Thread Jake b
Contest starts next week. Don't forget. :)

-- 
Jake


Re: [pygame] Best practices for creating multiple resolution 2D pixel-art games?

2012-04-22 Thread Jake b
.svg image's have a width/height in the data. So it might be set to 100x100
units in the vector image, and I tell it to render to 320x320 pixels in
game. Or 10x10 pixels. Or squish it.

Using cairo+rsvg You can render as a pygame surface, from the .svg data. (
Trying to fully learn this myself, have it mostly working, but problem with
color channels being swapped :
http://stackoverflow.com/questions/10163870/wrong-color-channels-pygame-cairo-rsvg-drawing/10168809#10168809)

Although, You can render from .svg directly to png, later to be loaded in
game.

Spriter *just* released a new beta:
http://www.kickstarter.com/projects/539087245/spriter/posts

On Fri, Apr 6, 2012 at 6:46 AM, Sam Bull  wrote:

> On Thu, 2012-04-05 at 18:24 +0200, Santiago Romero wrote:
> >  How do you think I should be handling all this?
>
> One idea not mentioned, that I'm thinking about implementing, is to use
> vector graphics. I'm presuming that when you import an svg file into a
> game, it is turned into a standard bitmap.
>But, I see no reason you can't scale it to the correct size for
> whatever resolution is selected on the fly, before the code imports it
> as a bitmap. This means you would always have a perfect full-resolution
> image for any selected screen resolution.
>
> You would probably need to decide on an aspect ratio and stick with it
> though, how you decide to adjust to different screen ratios is up to
> you.
>
>


-- 
Jake


Re: [pygame] [ROOKIE] Best way to manage jump movement

2012-04-21 Thread Jake b
Sounds like you want the first, but just incase, here's both ways. Since
both are used in different cases.

[1] For one jump per press:
On the event: KEYDOWN , apply your velocity.

[2] For continual acceleration while holding a key down:
Use pygame.key.get_pressed (
http://www.pygame.org/docs/ref/key.html#pygame.key.get_pressed )

Every X milliseconds you accelerate, while key is down.


On Fri, Apr 20, 2012 at 3:58 PM, NesKy  wrote:

> Hello everyone,
>
> I've been for some days trying to develop a "canabalt"-like game (
> http://www.canabalt.com/), saving distances... I've got the way to manage
> scroll, buildings appearances, distance between them, etc.
>
> Where I'm getting stucked is making the jump movement, and I left this for
> the last thing to do. What I'm trying to do is a basic jump movement where
> the more time you're pushing the button the more time you're jumping, with
> a limit of course. The player is always on the same "x" coordinate, so he
> only has to change the "y" in the way we want.
>
> So, the way I learned to manage all of this is with a "player" class and
> some methods to define actions (jump, prone, animation,...). Well, at this
> point I'm getting frustrated trying to do this with this tools. The only
> thing I achieve is jumping with the "player" MEANWHILE the key is pressed.
> And here is the thing: I cannot find the way to make the "player" jump with
> A TOUCH of a key.
>
> Thanks for your time (and sorry for my English! xD)
>



-- 
Jake


Re: [pygame] (newish?) SVG examples?

2012-04-13 Thread Jake b
What pixel format do I use? I have a SVG file loaded, and rendering now.
But, it is mixing up the RGBA channels. ( Meaning the lion is pink, instead
of yellow.
source file:
http://croczilla.com/bits_and_pieces/svg/samples/lion/lion.svg

I use: init:
self.screen = pygame.display.set_mode(( self.width, self.height ))
# or: elf.screen = pygame.display.set_mode(( self.width, self.height ),
0, 32)

And, to render the SVG:

class Ship(object):
""".
"""
def __init__(self, file=None):
"""create surface"""
#  Sprite.__init__(self)
self.screen =
pygame.display.get_surface()
self.image = None
self.filename = 'ship2.svg'
self.width, self.height = WIDTH, HEIGHT

def draw_svg(self):
"""ref:
http://stackoverflow.com/questions/120584/svg-rendering-in-a-pygame-application
"""
print "Ship().draw_svg()"
svg = rsvg.Handle(file= os.path.join('data', self.filename))
print "size = ", svg.get_dimension_data()
dim = svg.get_dimension_data()
self.width , self.height = dim[0], dim[1]

data = array.array('c', chr(0) * self.width * self.height * 4 )
cairo_surf= cairo.ImageSurface.create_for_data( data,
cairo.FORMAT_ARGB32, self.width, self.height, self.width * 4 )
ctx = cairo.Context(cairo_surf)
#
svg.render_cairo(ctx)
self.image = pygame.image.frombuffer(data.tostring(),
(self.width,self.height), "ARGB")

def draw(self):
"""draw to screen"""
if self.image is None: self.draw_svg()
self.screen.blit(self.image, Rect(200,200,0,0))


-- 
Jake


[pygame] (newish?) SVG examples?

2012-02-27 Thread Jake b
I'm Looking for a vector rendering example, to render .SVG images. I'm
mostly finding info from '09.

Is this still the recommended method?
I'm looking for what code / library to use, ( to prep for Pyweek.  )

So far, I've found:
http://stackoverflow.com/questions/120584/svg-rendering-in-a-pygame-application

And maybe:
http://code.google.com/p/pygame-svg/wiki/Sample
http://pygame.org/project-PyGame+Squirtle+Port-962-.html
http://pygame.org/project-Battle+for+Planet+Vector-742-.html


-- 
Jake


[pygame] front page: whats new

2011-12-28 Thread Jake b
I just noticed that 'whats new' says latest is 2009.
http://www.pygame.org/whatsnew.shtml

Maybe it can read from the code repo changelog?

-- 
Jake


Re: [pygame] Github Pygame Example Repository

2011-12-18 Thread Jake b
Nice.

For the main game loop, I like to do:
while not done:
# ...events , draw...
if pressed[K_ESC]: done = True

# to allow smooth exit / save game state / cleanup if needed.

check out : pygame.Color() http://www.pygame.org/docs/ref/color.html

You can post your code on the site, with a link to your repo.
http://www.pygame.org/tags/tutorial
-- 
Jake


Re: [pygame] Using pygame to create interface...

2011-12-03 Thread Jake b
See also: project's tagged #gui at http://www.pygame.org/tags/gui

-- 
Jake


Re: [pygame] pygame performance limits

2011-11-25 Thread Jake b
The short answer is you don't really have limits. Unless you're doing
something slow / inefficient, that would be slow anway. Brute forcing /
re-creating surface every frame  / mixing different formats on your
surfaces / etc.

Biggest one I'd think is collision detection. You can make your algorithm
more efficient / use quadtrees / or probably use a physics module.
Depending on the game, that can be overkill.

==
But remember, 'premature optimization, is the root of all evil'.
And when you optimize, use profiling. Because 99% of the slowdown can be in
1% of the code. And you will rarely know where it is, without profiling.
This can be true even in simpler code.
==

If you do reach a slowdown, there's a huge amount of modules that you have
access to. That causes the slower code to run c-code, and has been
optimized by many people ie: PyOpenGL, pybox2d (physics), numpy (for arrays
/ 3d math / opengl), pygame, etc...

So between optimizing your algorithms ( That you'd have to do in other
languages anyway: Not re-allocating textures every frame, or other errors
), using c-code from other libraries, You don't run into much different
speed issues than you do in pure c, for most games you'd work on.
-- 
Jake


Re: [pygame] more basic python lists question

2011-11-18 Thread Jake b
That's called 'list comprehension':
http://docs.python.org/tutorial/datastructures.html#list-comprehensions

On Thu, Nov 17, 2011 at 8:14 PM, Lee Buckingham wrote:

>
>
>
>> filenames = [f for f in filenames if f.endswith(".png")]
>>
>
>
> Slick!  I learn so much listening to you guys and your questions.
>



-- 
Jake


[pygame] Games for blind players

2011-10-23 Thread Jake b
Speech recognition and TTS library http://code.google.com/p/pyspeech/

On Saturday, October 22, 2011, Luis Miguel Morillas 
wrote:
> A friend asked me to write a game for blind kids. He proposed me a
> kind of hangman game. Do you have any experience using speech
> recognition and text to speech into games?
>
> -- lm
>

-- 
Jake


[pygame] set new recommendation to which version of pygame?

2011-09-30 Thread Jake b
For the updated website, what versions do you think we should recommend?
Here's what I think:


1) Python version: 2.7 and 2.6 are good.
(Almost any random module will work with them, many smaller ones are not
updated for 3.x )

2) pygame version:
 **need link to the new .exe, which is somewhere in the mailing list**

3) 32bit python also is more common.
[ You can use 32python on windows 64 bit fine ]


Note:

   - you can install multiple versions* of python *on your computer.
   - You can install multiple versions of python *modules *on your computer.
   [See* virtualenv *]

>From the docs, about version number 2.7:

Python 2.7 is intended to be the last major release in the 2.x series. The
Python maintainers are planning to focus their future efforts on the Python
3.x series.

This means that 2.7 will remain in place for a long time, running production
systems that have not been ported to Python 3.x
:



-- 
Jake


Re: [pygame] pygame download page still reccomends python 2.5

2011-09-29 Thread Jake b
I don't think its true anymore, AFAIK you should go with python2.7 for
pygame.
There is a python 2.7 download on the mailing list.

Outside of pygame, 2.7.x is what you want to go with, since wiht 3.x series
doesn't have as many libraries precompiled, or working.


On Thu, Sep 29, 2011 at 4:48 PM, James Paige wrote:

> I was talking with a new programmer who is just getting started with
> python and pygame. After a lot of confusion, I realized that he had
> downloaded pygame-1.9.1.win32-py2.5.msi by mistake. The download page
> still has bold text proclaiming "(python2.5.4 is the best python on
> windows at the moment)"
>
> If anybody knows any reason why that is still true, please correct me,
> but I think instead of bold text to reccomend one version over others,
> there should just be a message saying that a person should take care to
> download the version that matches their python version.
>
> No matter who I am, the "best" version of pygame is the one that will
> work on my computer ;)
>
> ---
> James Paige
>



-- 
Jake


[pygame] issues installing SDL? Or windows patch?

2011-09-28 Thread Jake b
My previously working pygame , and numpy install is broke. I did install
libSDL ( for c++ ) a few days ago.

I'm 95% sure pygame worked after that.
I did a windows update last reboot.

Could either be breaking it? pygame fails in pydev *and* scite.


I'm not sure what the exception is telling me.
C:\Users\jake\AppData\Roaming\Python\Python27\site-packages\numpy\core* does
*contain python files. Dir appears intact.


if I create a new file:
import pygame
print "oh no!"

output
>pythonw -u "ohno.py"
Traceback (most recent call last):
 File "buffer3.py", line 1, in 
   import pygame
 File "C:\Python27\lib\site-packages\pygame\__init__.py", line 257, in

   try: import pygame.sndarray
 File "C:\Python27\lib\site-packages\pygame\sndarray.py", line 66, in

   import pygame._numpysndarray as numpysnd
 File "C:\Python27\lib\site-packages\pygame\_numpysndarray.py", line 38, in

   import numpy
 File
"C:\Users\jake\AppData\Roaming\Python\Python27\site-packages\numpy\__init__.py",
line 136, in 
   import add_newdocs
 File
"C:\Users\jake\AppData\Roaming\Python\Python27\site-packages\numpy\add_newdocs.py",
line 9, in 
   from numpy.lib import add_newdoc
 File
"C:\Users\jake\AppData\Roaming\Python\Python27\site-packages\numpy\lib\__init__.py",
line 13, in 
   from polynomial import *
 File
"C:\Users\jake\AppData\Roaming\Python\Python27\site-packages\numpy\lib\polynomial.py",
line 11, in 
   import numpy.core.numeric as NX
AttributeError: 'module' object has no attribute 'core'

thanks,

note: I think I had activestate and regular python, installed. But it always
worked fine before. I haven't changed any python installs for months.
-- 
Jake


Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-27 Thread Jake b
I wrote a quick demo, using numpy for vectors.
velocity = numpy.array([10., 30.])

http://code.google.com/p/ninmonkey/source/browse/boilerplate/pygame/4.%20with%20numpy%20for%20array/boilerplate%20-%20pygame_with_numpy-2011_jake.py

Euclid is python only, which means you don't need to install anything,
however, its slower. But its fast enough.

see also: http://www.scipy.org/Numpy_Example_List_With_Doc

On Sat, Sep 24, 2011 at 3:04 PM, Mac Ryan  wrote:
>
> No, since I don't have to do very complex or loads of operations I went
> with euclid... but I'd be interested in knowing if you have suggestions
> involving numpy, nevertheless.
>
> /mac



--
Jake


Re: [pygame] car game AI

2011-09-24 Thread Jake b
Note: Learn how to use vectors. You will need this for steering, and
movement. (You technically don't, but it's much simpler)

The *very best* tutorial to A* pathfinding :
http://theory.stanford.edu/~amitp/GameProgramming/ ( Great diagrams )

These are relevant for your racing, and terrain.

Making sure you saw these specifically
http://www.red3d.com/cwr/steer/PathFollow.html
http://www.red3d.com/cwr/steer/Unaligned.html
http://www.red3d.com/cwr/steer/CrowdPath.html
http://www.red3d.com/cwr/papers/1999/gdc99steer.html
http://www.red3d.com/cwr/steer/Obstacle.html
http://www.red3d.com/cwr/steer/Containment.html

Now you could implement physics with pymunk, but that could be overkill at
this point. If you write your own physics, make sure you keep a
constant-time-step for stability. If a crash happens, apply a force. And
continue steer behavior as normal.


Re: [pygame] Native PyGame method for automatically scaling inputs to a surface resolution?

2011-09-24 Thread Jake b
Are you using numpy?
-- 
Jake


Re: [pygame] Getting pygame import to work in pydev/eclipse, shows as error.

2011-08-22 Thread Jake b
error:
http://imageshack.us/photo/my-images/171/pydevcapimporterror.png/

On Fri, Jul 29, 2011 at 11:29 AM, Brian Fisher wrote:

> Are you sure pydev is running your script with the python 2.7 interpreter
> you have installed?
>
> I think so.
\The script has "import sys; print sys.version" , and the output is:
 "2.7.1 (r271:86832, Feb  7 2011, 11:30:38) [MSC v.1500 32 bit
(Intel)]"

what python interpreters are registered under
> "preferences->pydev->interpreter python"? if you have multiple registered,
> which is the default? (highest on list)
>

Here: http://imageshack.us/photo/my-images/29/pydevcapprefsinterprete.png/


> When you run the script are you doing "run as->python run"? if you use the
> "run configurations" dialog, which python interpreter is selected in that
> dialog?
>
> run -> run as -> python run.

I deleted and recreated the iterpreter (to refresh, incase pygame didn't
exist before install) before making a new project, but broken. So I must
have something wrong somewhere.

-- 
Jake


Re: [pygame] "game" idea

2011-08-21 Thread Jake b
I like this one: SoundDrop:
http://www.youtube.com/watch?v=oDqM31-N2ec&feature=related
Uses lines and bouncing balls.

-- 
Jake


[pygame] pygame wiki/questions on stackoverflow

2011-08-21 Thread Jake b
If you've never visited SO, take a look. It's a combination of a
wiki+Mailinglist.

Right now there's a question on the fastest way to blit per-pixel, If you
know the best method?
http://stackoverflow.com/search?tab=newest&q=%5bpython%5d%20pygame
-- 
Jake


Re: [pygame] Articles about game design?

2011-08-18 Thread Jake b
Eli's articles are pretty good.
Two magazine, and pdf links:
http://devmag.org.za/ has several nice articles, good illustrations as
article or magazine download.

gamedeveloper http://www.gdmag.com/homepage.htm
If you can pickup a free subscription it's worth it.
-- 
Jake


Re: [pygame] growing out of idle ide

2011-08-17 Thread Jake b
I think geany uses scintilla ( which is scite's text editor widgit ).
Several other programs, like notepad++ do too.

I also use scite. I default to it, for quick / smaller projects, else pydev.
Scite is very configurable if you are comfortable with doc's and text config
editing.

-- 
Jake


Re: [pygame] growing out of idle ide

2011-08-17 Thread Jake b
Pydev. [ which is a python eclipse plugin ] http://pydev.org/ I find its
quite nice, and runs quickly.

On Mon, Aug 15, 2011 at 3:50 AM, David Burton  wrote:

> Is anyone here using Eclipse+PyDev, or Eclipse+DLTK?
> Opinions, please?
>
-- 
Jake


[pygame] spotlight apps selection

2011-08-13 Thread Jake b
Are these currently the a list, from a while ago?
I ask because, ie: Albow for example has a last updated date of 2007.

There are newer, and less known apps that could be hilighted. It'd be cool
if it was somehow automatic, whether it's based on positive comments, or
downloads, or whatever.

-- 
Jake


Re: [pygame] Pygame-UI: UI Component Framework for python and pygame

2011-08-03 Thread Jake b
Do you know the command to download your code using mercurial? I've done it
before, but, it isn't finding the svn repo today.

And, have you learned about properties? They replace the need of
getter/setter functions that other languages use.


[pygame] Getting pygame import to work in pydev/eclipse, shows as error.

2011-07-28 Thread Jake b
In pydev/eclipse I can run a file using pygame. So it runs, but, (even for
new projects)

I get the errors: ( in the UI. it still runs, but autocompletion for pygame
doesn't load. )

import pygame
>
unresolved import pygame

from pygame.locals import *
from pygame import Color, Rect, Surface

unresolved import Color
unresolved import Rect
unresolved import Surface

Pygame is installed to: C:\Python27\Lib\site-packages\pygame

What am I missing?
-- 
Jake


Re: [pygame] trajectory

2011-07-24 Thread Jake b
This calculates to shoot in the path of the target.
Like how you throw a football, to lead the catcher. Instead of where they
are at that second.

For tower defense, some Bullets fly fast enough you don't have to lead.

Slower bullets fire, then every frame you:
Move the bullet location toward target. ( without leading )
Thats simple homing, but you can skip the steering part a homing missile
has. The trajectory will end up curving, depending on speeds used.

For a straight line you will have to lead. But leading will miss if target
chamges direction or speed.

On Saturday, July 23, 2011, Joe Ranalli  wrote:
> Yes.
>
> So to be more explicit:
>
> 1 Calculate the distance between the source and the target.
> 2 Calculate the time for the bullet to move that distance (i.e. by
dividing this distance by the bullet velocity)
> 3 Calculate newposition (multiply the target velocity by the time
calculated in the previous step, add to original target position)
> 1a Recalculate the distance between the source and newposition
> 2a Recalculate the time for the bullet to move from the source to
newposition (i.e. divide the new distance by the bullet velocity)
> 3a Recalculate newposition using this new time (multiply the target
velocity by the new time calculated in the previous step, add to original
target position)
>
>
>
> On Sat, Jul 23, 2011 at 12:55 PM, Nathan BIAGINI 
wrote:
>>
>> Ok so thanks all for all your replies i will work with all that. I don't
know already if i want to use homing missile style which seems to be easier
to code or to use an algorithm to fire straight to the right spot.
>> To be honest, i'm not native english speaker and it's not always easy to
figure out what you really mean but i'm doing my best.
>>
>> I just want to ask you Joe about your algorithm :
>>
>>> If you want to have the bullet go straight to the right spot, you need
to:
>>> 1) calculate how long the bullet will take to get to the enemy
>>> 2) calculate where the enemy will be at that time (newposition)
>>> 3) calculate how long it will take the bullet to get to newposition
>>> 4) recalculate newposition based on the new time
>>
>> Ok so i think the first step is pretty clear to me, the step 2 too but i
don't understand the step 3. My english isn't the best i repeat so... i have
to calculate how long the bullet will take to go to 'newposition'. So i will
get a new time value and then i need to recalculate newposition based on
this new time? And fire at 'newposition'? And also, to be sure,
'newposition' is the virtual position of the target after the time taken by
the bullet to hit it, right?
>>
>> Sorry if it seems to be straigh forward to you :-)
>>
>> Of course i will try others way like Lee suggested me.
>>
>> Thanks.
>>
>> 2011/7/20 Joe Ranalli 
>>>
>>> It depends what you're trying to do.
>>>
>>> If you draw the straight line between the tower and the enemy and use
that vector to translate a bullet each tick, the bullets might miss the
enemy.  Think about it this way, the bullet moves 2 steps toward the enemy,
then the enemy moves 1 step, then the bullet moves 2, etc.  Because the
enemy moves the bullet will have to change its direction through the
flight.  So you could calculate the direction vector between the bullet and
the enemy every tick and have the bullet move that direction.  That would
make the bullets kind of arc to the target.
>>>
>>> If you want to have the bullet go straight to the right spot, you need
to:
>>> 1) calculate how long the bullet will take to get to the enemy
>>> 2) calculate where the enemy will be at that time (newposition)
>>> 3) calculate how long it will take the bullet to get to newposition
>>> 4) recalculate newposition based on the new time
>>>
>>> Technically you could iterate that repeatedly until newposition
converges.  Practically, iterating once probably gets you close enough
unless the movement is extremely complicated.
>>>
>>> On Wed, Jul 20, 2011 at 9:14 AM, Nathan BIAGINI 
wrote:

 Hi everyone,

 i would like to know what are the common way to handle "trajectory" in
a 2d game. In fact, i think of writing a tower defense game and i wonder how
to handle the trajectory of the missile launch by the towers. I though of
getting the pos of the tower and the target and create a vector between this
two entitites to make a sprite translation of this vector but there is maybe
some tricky stuff to do it.

 Thanks in advance and happy game making all :-)
>>>
>>
>
>

-- 
Jake


Re: [pygame] trajectory

2011-07-22 Thread Jake b
A more involved example, but a great site is red3d's steering movements.
To do heat seeking missiles, you use the seek behavior.
http://www.red3d.com/cwr/steer/

On Fri, Jul 22, 2011 at 11:45 AM, Joe Ranalli  wrote:

> Homing missile is by far the easiest thing to code.  Every clock tick, find
> the vector between the bullet and the target, move the bullet in that
> direction according to its velocity.  As long as the bullet speed is fast
> relative to the target, it will eventually hit it.




-- 
Jake


Re: [pygame] Blog posts on a pygame+pyopengl project

2011-07-20 Thread Jake b
Cool! I missed this email. I like the images, and diagrams.

Are you planning on ability to edit or create a new world?



Have you thought of doing a Terarria map viewer? (It's similar in a lot of
ways, but from the side view its 2d only.)

I found a few python interfaces to the map file:

   -
   
http://www.terrariaonline.com/threads/programmerss-resource-python-interface-for-world-files.33032/
   - Details on map file format:
   
http://www.terrariaonline.com/threads/map-format-documentation.16553/#post-232921
   - python map generator:
   https://bitbucket.org/cryzed/terraria-map-generator/src
   - output image of viewer world:
   
http://www.terrariaonline.com/threads/python-world-viewer-windows-mac-linux.33725/
   - pixel-ly panning viewer:
   http://www.terrariaonline.com/threads/terraria-map-viewer.4226/

-- 
Jake


Re: [pygame] trajectory

2011-07-20 Thread Jake b
You can define bullet speed in pixels per second.

You can use euclid (it works), but I instead suggest numpy. Which has a
vector( numpy.array ), and is useful for other game related things.


Here's a stand-alone example, uses numpy for vector movement.

https://code.google.com/p/ninmonkey/source/browse/boilerplate/pygame/4.%20with%20numpy%20for%20array/boilerplate%20-%20pygame_with_numpy-2011_jake.py

On Wed, Jul 20, 2011 at 9:33 AM, Nathan BIAGINI wrote:

> There is a pygame object to create a 2d vector?



-- 
Jake


Re: Re: [pygame] Pygame-UI: UI Component Framework for python and pygame

2011-07-03 Thread Jake b
For rendering, what do you plan on doing? ( blit, opengl, svg_blit,
pygame.draw )

My main request for reusability is loading a .css file.
If for XML, I tried this. [ Using attributes for sll style info seemed
wrong. ]



inventory root
window frame

inventory.css
font-size: 20px;


inventory root
window frame
inventory.css
font-size: 12px;



Or, you could define that in xml:



font-size: 1em; color:gray; font-family:
sans-serif;



inventory root
window frame
font-size: 20px;



inventory root
window frame
font-size: 12px;







-- 
Jake


Re: [pygame] Pygame-UI: UI Component Framework for python and pygame

2011-07-01 Thread Jake b
How do you plan on drawing?

You mentioned styling. I suggest using properties and values in the same
format as CSS2.1 ( http://www.w3.org/TR/CSS21/ ), where possible.

This would allow more users to immediately style the UI, without having to
know much of the iternals.
You can get quite complex looking results with a few simple properties: (
http://www.w3.org/TR/css3-background/#border-images )


Example: One single rectangle ends up like this:

[image: Diagram: The border image shows a wavy green border with more
exaggerated waves towards the corners, which are capped by a disconnected
green circle. Four cuts at 124px offsets from each side divide the image
into 124px-wide square corners, 124px-wide but thin side slices, and a small
center square.]

Details: uses an image sliced into 9 pieces.

[image: Diagram: The image-less (fallback) rendering has a green double
border. The rendering with border-image shows the wavy green border, with
the waves getting longer as they reach the corners. The corner tiles render
as 124px-wide squares and the side tiles repeat a whole number of times to
fill the space in between. Because of the gradual corner effects, the tiles
extend deep into the padding area. The whole border image effect is outset
31px, so that the troughs of the waves align just outside the padding edge.]

   Here's a class I started, some if it is psuedo code, but you should get
the idea.

# 2011/06/30 ninmonkey
# StyleCSS for ui.
import pygame
from pygame.locals import *
from pygame import Color

# valid size-types for font, border, width, etc.
valid_sizes = ['px', '%', 'pt', 'em']

# which CSS2 andor 3 properties actually do anything ATM.
implemented_css_properties = ['border-width',
'border-width-top', 'border-width-right', 'border-width-bottom',
'border-width-left',
'font-size',
'color', 'background-color']
# non-standard style info, that is implemented.
implemented_extra_properties = ['foo', 'bar', 'icon', 'alert-box']

class StyleCSS(object):
"""
methods:
members:
default_size:   one of a valid_size, used on all values. ( border
width, font size, etc..)
"""

def __init__(self, parent):
self.default_size = 'px'
self.parent = parent
# copy parent style data

def clear(self):
"""reset / empty self, and reload values from parent style"""
# reset, then reinit

def set_property(self, prop, value):
"""based on property name, read value differently, and save data."""
if not prop in self.implemented_css2_properties or
not prop in self.implemented_extra_properties: return

# based on property name
if prop == 'color':
# = pygame.Color(value)
elif prop == 'border-width':
#
elif prop == 'border-left-width':
# ...

def load_as_str(self, strcss):
"""load a string containing real a string of real style.css text.

note:
expects style info, without selectors, and without brackets.
example:
strcss = "font-size: 20px; color-bg: grey; color: white;"

Also:
allows you to save presets, that can append eachother, saving to
files, and mix-match like selectors can.  ( ie: content-main.css,
inventory-window-base.css, inventory-bags.css, text-big.css, text-small.css,
text-sans.css, text-serif.css)"""
self.reset()

# split to rules
# collapse whitespace
rules = strcss.split(';')
# get (prop, str)
for r in rules:
prop, str = r.split(':')
self.set_property(prop, str)

def append_str(self, strcss):
"""like load_as_str() , but does NOT destroy current style info.
convienence when needing multiple size unit types.
"""
pass

# example use

class BaseWidgit():
def __init__(self, ...):
self.style = StyleCSS(parent.style)
# defaults to *derives style* from parent,
# then self only has to *override specific* values
self.style.font_size = 20
base_css = """font-size: 14px; font-family: Verdana, sans-serif;"""
self.style.append_str(base_css)

class PlayerInventoryWindow(BaseWindow):
def __init__(self, ...):
self.style = StyleCSS(parent)
self.style.load_as_str( filename='window-base.css' )

# example property use:
# maybe not as needed, but would make some modifications easier.
# like if player wants to change border-color: when player hover's.
# or k_minus will increment: font-size += 2
"""
= css property: border-width =
format is: Top Right; and Top Right Bottom Left;

border-width: 2 1;
border-width: 2, 1, 2, 1;
"""
# these are equivalent
style.border_width = (2, 1)
style.border_width = (2, 1, 2, 1)

# they set all these.
# same as expected for CSS2.1 spec
style.border_top_width = 2
style.border_right_width = 1
style.border_bo

Re: [pygame] Making animation.

2011-05-28 Thread Jake b
Take a look at http://www.pygame.org/project-PyIgnition-1527-.html

( you don't need openGL. )

-- 
Jake


[pygame] hiding duplicate project updates?

2011-05-14 Thread Jake b
On the front "more" page, http://www.pygame.org/tags/all

There's often duplicates. Right now there's 14+ copies of "GetPath" on page
1.

If a project is updated, keep it on top, but only list the project once per
page,
( or one total across all pages? )

-- 
Jake


Re: [pygame] Re: Help needed on creating snake n ladder game

2011-05-10 Thread Jake b
Attached is a pygame-boilerplate, which has a basic class to handle draw,
events, and looping. It has keyboard input, and draws a blank screen.

To make sure your classes are new-style, define them like:

*class Foo():*
or

*class Foo(object):*
instead of

class Foo:

Otherwise you will run into strange problems, later on.

Here's some snakes-and-ladders code.

   - Player() class saves key, tile, and name
   - Game.players is a list, so you can add more players without modifying
   the code
   - I found the names of key 1 and 2, at :
   http://www.pygame.org/docs/ref/key.html


import pygame
from pygame.locals import * # Color() and Rect() are defined here
import random

class Player(object):
def __init__( name, key_move ):
self.name = name
self.key_move = key_move
self.tile = 0

def move(self):
# moves dice + self
print "%s: moved" % (self.name)
roll = random.choice( [1,2,3,4,5,6] )

print "roll: %s" % (roll)
self.tile += roll

class GameMain():
"""members:
cur_player: index for players
cur_players: list of Player()s
"""
def __init__(self):
p1 = Player('fred', K_1 )
p2 = Player('bob', K_2 )


# save as a list, easier to use variable number of players, later
on.
self.players = [self.p1, self.p2]
self.cur_player = 0

def next_turn(self):
# change value of .cur_player to next valid index
self.cur_player += 1
if self.cur_player >= len(a):
self.cur_player = 0

def main_loop(self):
"""Game() main loop"""
while not self.done:
self.handle_events()
self.update()
self.draw()

# delay here: toggle FPS cap
if self.bLimitFPS: self.clock.tick( self.fps_limit )
else: self.clock.tick()def handle_events(self):

def handle_events(self):
# draw bg

# handle all events , like in boilerplate

# but also add:
# if key == current player's key_move , then move him.

player = self.players[self.cur_player]
key = player.key_move

if event.key == cur_key:
cur_player.move()
    self.next_turn()

On Mon, May 9, 2011 at 1:51 AM, Mr. Singh  wrote:

>
>
> On May 9, 10:52 am, Jake b  wrote:
> >"Where are you started / stuck?"
> I have just started and have not any graphics still. I am just
> creating .py file that include turns of two players.
> It's my first game or a program in python.
> Here is a simple code if you can read it:
>
>
> class Step:
>
>posP1=0
>posP2=0
>
>
>def __init__(self,dice):
>
>self.dice=dice
>Step.posP1+=dice
>Step.posP2+=dice
>
>def displayMove(self):
>print "total move: %d"%Step.move
>
>def displayStep(self):
>print ",dice: ",self.dice
>
> import random
>
> print '\n\n\n\n'
>
>
> def player1():
>while Step.posP1!=100:
>loop1()
>
>
> def player2():
>while Step.posP2!=100:
>loop2()
>
>
>
> def loop2():
>input=2
>reqd=int(raw_input('Player2:- press 2 to throw dice: '))
>if reqd==input:
>dice=random.choice([1,2,3,4,5,6])
>num=Step(dice)
>num.displayStep()
>print "Player2 position: %d"%Step.posP2
>player1()
>else:
>print "player2 pressed wrong key"
>
> def loop1():
>input=1
>reqd=int(raw_input('Player1:- press 1 to throw dice: '))
>if reqd==input:
>dice=random.choice([1,2,3,4,5,6])
>num=Step(dice)
>num.displayStep()
>print "Player1 position: %d"%Step.posP1
>player2()
>else:
>print 'no its wrong'
>
>
>
>
> def main():
>player1()
>
> if __name__ == '__main__': main()
>
> #End of program
>
> # I hope you understand my problem
> # It's both players using same data
> #how should i improve it?
> # Thanks for your reply as well as help
>



-- 
Jake


pygame-boilerplate.py
Description: Binary data


Re: [pygame] Help needed on creating snake n ladder game

2011-05-08 Thread Jake b
Where are you started / stuck?
Breaking a problem into smaller pieces can make it easier to solve.

example:
1. draw empty board
2. draw player on square X
3. player input, dice.
4. turn taking
5. 'ladder' tiles save the tile id of the square to slide down to


On Mon, May 9, 2011 at 12:46 AM, Mr. Singh wrote:

> Can anybody help me creating snake and ladder game algorithm?
>



-- 
Jake


Re: [pygame] RESIZABLE FLAG

2011-05-02 Thread Jake b
if Event.type == VIDEORESIZE:
  size, w, h = event.size, event.w, event.h

See: http://www.pygame.org/docs/ref/event.html

On Sunday, April 24, 2011, ANKUR AGGARWAL  wrote:
> Hey
> I want to scale my image according to the size of the screen. If I am
> using the resizable flag in the display how can i get the size  of the
> resized display??  In other words want to ask  "How do you can the
> size of the window when you change it's size with the RESIZABLE flag"
> Thanks In Advance :):)
> Ankur Aggarwal
>

-- 
Jake


[pygame] Pygame: Fixed timestep demo?

2011-05-02 Thread Jake b
What's the suggested way to use a fixed time step in pygame? I want to
verify I'm using the right method. I want it for the case when you're
not using a physics lib.

( There's resources at gaffer, and stackoverflow,  )
but none specifically pygame that I found.

Do you know of an example?

-- 
Jake


Re: [pygame] pygame.org can has social?

2011-05-02 Thread Jake b
Cool, voting , and time settings. Is there a "front page" to view
recent comments, or popular?  there's a filter on project page.

On Friday, April 29, 2011, René Dudfield  wrote:
> twitter: @pygame_org
> disqus comments: http://pygame.org/project-Crazy+China+Pong-1820-3229.html
>

-- 
Jake


Re: [pygame] Making the sprite sheet background transparent

2011-04-19 Thread Jake b
You want to save a new image with transparency?
Try: .set_colorkey
http://www.pygame.org/docs/ref/surface.html#Surface.set_colorkey
then saving the image.

On Thu, Apr 14, 2011 at 2:36 PM, ANKUR AGGARWAL wrote:

> Yup,infact already did that. But I want to do it in python style :O:O
>
>
> On Fri, Apr 15, 2011 at 1:03 AM, Eamonn McHugh-Roohr  > wrote:
>
>> It's easy enough to open it up in Photoshop or gimp and actually make the
>> image's background transparent, then you just call .convert_alpha() on it
>> after you load the image.
>>
>>
>> On Thu, Apr 14, 2011 at 3:26 PM, ANKUR AGGARWAL 
>> wrote:
>>
>>> Hey
>>> I want to make the  sprite sheet background as  transparent. How I can do
>>> that???
>>> Code and the images is attached with the mail. Thanks in advance.
>>>
>>> Ankur Aggarwal
>>>
>>
>>
>


-- 
Jake


Re: [pygame] Update on Sphinx version of Pygame docs

2011-04-13 Thread Jake b
As a newbie to reST I don't feel qualified to decide. Although I found a few
resources I thought I'd share:

for the html docs:
you might be interested in a javascript sites include, that add syntax
hilighting to code found in the page. This leaves the original code clean of
styling. It should work on user comments

For newbies to SVN.
I found TortoiseSVN client simple to use. Had the reST downloading in a
couple minutes.
http://tortoisesvn.net/downloads.html

for reST newbies:
http://matplotlib.sourceforge.net/sampledoc/
http://packages.python.org/an_example_pypi_project/sphinx.html#full-code-example
http://stackoverflow.com/questions/4547849/good-examples-of-python-docstrings-for-sphinx(
found above links from Stackoverflow )

On Tue, Apr 5, 2011 at 1:24 PM, Lenard Lindstrom  wrote:

> Hi everyone,
>
> I finally have a proposal for the reST file format for Pygame. I used the
> following criterion:
>
> 1) Use only standard Sphinx markup so the source documents can be processed
> without the Pygame Sphinx extensions and theme.
> 2) Accommodate Sphinx autodoc, which generates documents from Python
> docstrings.
>
> The new reST is more verbose that the first version, since it moves the
> call signatures into a definition's body. But this lets Sphinx autodoc
> extract them from the docstring rather than use introspection on the
> callable itself, which is useless for extension module methods.
>
> The generated HTML still needs some tweaking, but is close to a final
> product. Don't worry that it retains the Classic look. It relies heavily on
> stylesheets. Also criterion 1 above allows the standard Sphinx build system
> to be used. So multiple versions of the documents can easily be supported.
>
> The reST files and resulting html documents can be downloaded from SVN:
>
> svn co svn://seul.org/svn/pygame/branches/reStructuredText
>
> What is left to do is generate a better index.html and incorporate the
> tutorials and other companion pages.
>
> For the Pygame documents, a longer term goal is to standardize the
> documenting of call signatures. Other parts could also be made more
> consistent. Using the Python guidelines (
> http://docs.python.org/documenting/index.html ) should help here. It is
> unclear whether this changes should be made to the current Pygame .doc files
> for wait for the move to Sphinx (Is this definite now?).
>
> Lenard Lindstrom
>
>


-- 
Jake


Re: [pygame] blit a list containing surfaces

2011-04-13 Thread Jake b
Take a look at AnimatedSprite() in piman's tutorial :
http://www.sacredchao.net/~piman/writing/sprite-tutorial.shtml

As well as help(pygame.Sprite)
http://www.pygame.org/docs/ref/sprite.html

Without seeing your code, it would be something like:
# where i is your current frame index of the list.
screen.blit( frames[i], dest )

-- 
Jake


[pygame] New pygame tutorials -- areas lacking?

2011-04-11 Thread Jake b
Are there any areas that you think pygame examples / tutorials could
use a new tutorial?
Or perhaps certain documentation sections that could use work?

My thoughts are specifically non-OpenGL , or other libraries --
there's many existing tuts, and code for that.

..
My thought:
 I'm working on a project involving midi input,
 and I have some boilerplate I am going to upload , after cleaning it up.

-- 
Jake


Re: [pygame] Sprite examples with images

2011-04-11 Thread Jake b
Check out
http://www.sacredchao.net/~piman/writing/sprite-tutorial.shtml
http://eli.thegreenplace.net/category/programming/python/pygame-tutorial/
And the pygame doc's examples (comes with images )

The pygame projects page has more.

On Monday, April 11, 2011, ANKUR AGGARWAL  wrote:
> Hey
> I am reading pygame and made out simple snake game as a practice. Now want to 
> get started with the world of sprites. I looked for the examples but most of 
> the examples are without the real images so unable to run them and know their 
> functionality. Can anybody send me the links of good examples of sprites 
> where images are also available so that i can get a better understanding. 
> Thanks in Advance :):)
> Ankur Aggarwal
>

-- 
Jake


Re: [pygame] News: SDL 1.3 is now under the zlib licence.

2011-04-10 Thread Jake b
Are there new features in 1.3 , and will any be available in pygame in the
near future? Couldn't figure out a good google query.


Re: [pygame] Recommendations required

2011-04-04 Thread Jake b
Asteroids
Pong
Tetris
Space invaders
A top down shooter

On Monday, April 4, 2011, ANKUR AGGARWAL  wrote:
> Hey
> I am reading pygame module and experimenting with it in small codes too . I 
> want your help. I want you to  recommend the games ,beginner of this module 
> should try to develop as a practice or so.
> Thanks
> Ankur Aggarwal
>

-- 
Jake


Re: [pygame] Re: I can't install pygame on activestate python [win, 32bit python 2.7]

2011-04-02 Thread Jake b
Thank you :)
-- 
Jake


[pygame] Re: I can't install pygame on activestate python [win, 32bit python 2.7]

2011-04-01 Thread Jake b
pygame.org's windows installer didn't have a version for 2.7

There is a link for an offsite version, but the link is broken. [it's
javascript, not a real url. maybe it's been compromised?]

I'm looking for Python 2.7, win32.

> http://thorbrian.com/pygame/builds.php
This page has no 2.7 build

I thought maybe pygame for 2.6 would work, since 2.7 is just bug fixes
-- but it didn't.
--
jake


[pygame] I can't install pygame on activestate python [win, 32bit python 2.7]

2011-03-31 Thread Jake b
I'm using activestate's package manager (pypm) on windows.
There is no package for pygame, because the build fails on their logs:

their failed log (for win32, py2.7 )
http://pypm-free.activestate.com/2.7/win32-x86/pool/p/py/pygame-1.9.1release_win32-x86_2.7_1.pypm.d/log

(package page: http://code.activestate.com/pypm/pygame/ )

Any ideas?

> WARNING, No "Setup" File Exists, Running "config.py"
>
> Using WINDOWS configuration...
>
>
>
> Path for SDL not found.
>
> Too bad that is a requirement! Hand-fix the "Setup"
>
>
-- 
Jake


Re: [pygame] Inconsistency in online docs

2011-03-30 Thread Jake b
(there are two big threads, so this might have been covered)

1] Is there a method other projects use, that we could copy?

2] I would definitely push for a web wiki-interface (at least to allow
'comment's section of current docs )

* allows correction submitions ( mentioned in other thread )
* would allow a more impromptu system for new updates -- vs same guy X
always gets callled on.
* allows easier to organize bite sized updates. (current is too much
for one person, ie: could be: module X  needs 3 edited docstrings)

> But first the existing docs have to be sorted out.

3] I'm willing to volunteer some work on the docs. but
I'm not clear on what needs to be done.

something like:
a] first decide on long-term structure
b] convert all docs to reST
c] wiki interface

4] How much (or not) is the website and code integrated?
I saw big threads about about redesigning the site, is that going on currently?


  1   2   3   4   >