Re: [pygame] Adding Wii Remote support to pygame

2006-12-16 Thread robomancer


It's not being handled as a new input-device: the 'drivers' re-mapp
its functionality onto default keyboard/mouse keypresses/motions/etc.
Basically it's emulating existing input devices.



That's what the existing driver for Linux does as well (at least at the
user-visible level).  I'm hacking it so that it works with Pygame as a
completely new kind of input device.  So I don't think this will be a
problem for porting to Windows...

On top of that, it doesn't work with the microsoft Bluetooth stack, so

people have to install BlueSoleil bluetooth stacks to use it.
(I'm referring to GlovePIE, if there is a better windows driver
available, let me know!)



However, this could most definitely be a problem.  I don't really know how
to work around this, because I've not been paying attention to the Windows
side of things.  My guess is that most of the people interested in hacking
the Wiimote are Linux folks, so maybe it's just not been looked at enough
in Windows yet, and if we wait another month or so there will be better
drivers.  Or maybe there is a fundamental problem with the Microsoft
Bluetooth stack?  I'm no Bluetooth expert (in fact the Wiimote is the first
Bluetooth device I've owned), so I'm afraid I don't have any useful advice.

In the absolute worst case, I guess we have to tell people to install
third-party bluetooth drivers if they want to use Wiimotes in Pygame...

Perhaps I'll try to write a C-module that can do this and wrap it in

Python?  I'm not really sure where to go from here.



That sounds promising, though possibly time-consuming.

robomancer


Re: [pygame] Adding Wii Remote support to pygame

2006-12-16 Thread Jakub Piotr Cłapa

Luke Paireepinart wrote:
I was considering using the pySerial module, because I hear you can use 
this to communicate with bluetooth devices as well.
I couldn't get the Wii remote to register a COM port, though, (through 
the windows Bluetooth stack manager thing).  It seems to me that the way 
pySerial would interface with the device is that windows has some 
intermediate layer that pretends to be a serial port but actually 
forwards all communications from this 'virtual' port to the bluetooth 
device.

Does anyone know if this is correct?
Do you have to have the bluetooth device pretending to be a serial 
device in order to use pyserial to communicate with it?


I'm afraid ot's serial-over-Bluetooth and not the other way around. So 
you can get a serial port device connected via Bluetooth (like most 
mobile phone modems do) but you can't interface an arbitrary Bluetooth 
device via a serial port.


Perhaps I'll try to write a C-module that can do this and wrap it in 
Python?  I'm not really sure where to go from here.


Is there anything similar to libusb (a crossplatform library for talking 
to arbitrary USB devices from userspace, i.e. with out writing your own 
device drivers) for Bluetooth? Using such a thing would be a way to 
implement this.


--
Regards,
Jakub Piotr Cłapa


Re: [pygame] ARGB vs. RGBA

2006-12-16 Thread Tim Ansell
Hello,

You can use my SDL_Surface.py hack to get a ctypes pointer to the pixel
data. http://www.thousandparsec.net/repos/libmng-py/mng/pygame/

I needed this to make libmng-py as fast as possible.

Hope this helps!

Tim Ansell

On Sat, 2006-12-16 at 14:49 +0100, Jakub Piotr Cłapa wrote:
 Pete Shinners wrote:
  On Fri, 2006-12-15 at 12:07 +0100, Jakub Piotr Cłapa wrote:
  I was trying to make some data exported from cairo as a ARGB (literally 
  in this byte order on my big-endian machine, A beign in the lowest 
  address) buffer into a PyGame surface but run in to some problems.
 
  The code which creates the bitmasks required by the SDL conversion 
  routine does some really strange things.
  For RGBA it takes the notation as a literal byte order in memory, low 
  address first and simply swaps the 4 bytes on BE vs. LE.
  
  I'm not sure the problem. Passing the mask arguments when creating
  surfaces should allow any byte orderedering.
  
  size = 100, 100
  rgba_mask = 0xff00, 0xff, 0xff00, 0xff
  rgba_surf = pygame.Surface(size, 0, 32, rgba_masks)
  
  argb_mask = 0xff, 0xff00, 0xff, 0xff00
  argb_surf = pygame.Surface(size, 0, 32, argb_masks)
 
 I was thinking about pygame.image.frombuffer which requires a string 
 (and not an arbitrary bitmask tuple). I don't think pygame.Surface 
 allows for creating surfaces out of arbitrary python buffers.
 



Re: [pygame] Adding Wii Remote support to pygame

2006-12-16 Thread Luke Paireepinart

Jakub Piotr Cłapa wrote:

Luke Paireepinart wrote:
I was considering using the pySerial module, because I hear you can 
use this to communicate with bluetooth devices as well.
I couldn't get the Wii remote to register a COM port, though, 
(through the windows Bluetooth stack manager thing).  It seems to me 
that the way pySerial would interface with the device is that windows 
has some intermediate layer that pretends to be a serial port but 
actually forwards all communications from this 'virtual' port to the 
bluetooth device.

Does anyone know if this is correct?
Do you have to have the bluetooth device pretending to be a serial 
device in order to use pyserial to communicate with it?


I'm afraid ot's serial-over-Bluetooth and not the other way around. So 
you can get a serial port device connected via Bluetooth (like most 
mobile phone modems do) but you can't interface an arbitrary Bluetooth 
device via a serial port.
Oh, okay.  That explains it.  The example of serial-over-bluetooth that 
I was looking at was for interfacing with some kind of Nokia phone.

No wonder.
Okay, I guess there will have to be another way of going about this.
At least that explains why the Microsoft Bluetooth stack wouldn't let me 
register it as a serial device!

Thanks for this info.


Perhaps I'll try to write a C-module that can do this and wrap it in 
Python?  I'm not really sure where to go from here.


Is there anything similar to libusb (a crossplatform library for 
talking to arbitrary USB devices from userspace, i.e. with out writing 
your own device drivers) for Bluetooth? Using such a thing would be a 
way to implement this.
I'm really confused by this, but I've sort of got the impression that 
Bluetooth and USB behaved the same as far as HID drivers went...
I.E. the OS hides the fact that it's Bluetooth, and the same driver 
would work for either a Bluetooth or a USB version of the same input device.

However, I'm not sure if this is true.

Anyway, I don't know if you can use HID drivers to talk to the Wii 
remote, I don't think you can extract all the info that way,

I think you have to use L2CAP in order to get the info.
The PyBluez module implements rfcomm in Windows, but it doesn't have 
support for the L2CAP mode that the Wii remote needs.
It seems to me like they're trying to support everything on Windows that 
they've supported on Linux, but I'm not sure.
I did manage to communicate with the Wii remote using pyBluez, and got a 
list of services and everything.

Just can't actually get the data from it after that.

I'll look for a library for communicating with arbitrary Bluetooth 
devices on Windows.


Bluetooth support seems to be an area where Windows is severely inferior 
to Linux.
At least as far as people implementing support for custom devices is 
concerned.




[pygame] Font.render barfs on spaces

2006-12-16 Thread Marius Gedminas
Hi,

Pygame 1.7.1 on my Ubuntu Linux system is unable to render a space in the
default font, when anti-aliasing is disabled:

 import pygame
 pygame.version.ver
'1.7.1release'
 pygame.font.init()

 f = pygame.font.Font(None, 10)
 f.render( , 0, (255, 255, 255))
Traceback (most recent call last):
  File stdin, line 1, in ?
pygame.error: SDL_ttf render failed

Other characters work fine:

 f.render(a, 0, (255, 255, 255))
Surface(4x7x8 SW)

Space also works if I enable anti-aliasing:

 f.render( , 1, (255, 255, 255))
Surface(2x7x32 SW)

Is this a bug?

Marius Gedminas
-- 
The IQ of the group is the lowest IQ of a member of
the group divided by the number of people in the group.


signature.asc
Description: Digital signature


[pygame] Wii Remote on Windows

2006-12-16 Thread Luke Paireepinart

I just read this article on Microsoft.com and laughed out loud.
http://msdn2.microsoft.com/en-us/library/aa938557.aspx
Oh, great.  I can't even develop Profile Drivers on my Windows XP system 
FOR Windows XP.

I have to install Vista, write the drivers, and run them on XP.
That makes a lot of sense.

Luckily, I have a copy of Vista sitting around here somewhere (Hopefully 
I brought it home, or I'm in for a long night of downloading).


I wonder, if I use a 64-bit copy of Vista, can I develop 32-bit drivers 
for XP?

The answer is probably obviously NO, but I thought I'd ask anyway.
Since I have a 64-bit processor, I'd like to use 64-bit Vista, but I 
guess I'll just use 32-bit to be safe.


I'll keep you all updated on my progress in this regard, and I'll let 
you know if I give up :)

Thanks for your attention,
-Luke


Re: [pygame] ARGB vs. RGBA

2006-12-16 Thread Jakub Piotr Cłapa

Tim Ansell wrote:

Hello,

You can use my SDL_Surface.py hack to get a ctypes pointer to the pixel
data. http://www.thousandparsec.net/repos/libmng-py/mng/pygame/

I needed this to make libmng-py as fast as possible.


Thanks but I'm unsure if this helps. I've got a Python buffer which is 
already allocated by cairo and I want pygame to use it as an image I can 
blit to screen later. This method is in the cookbook and should be fast 
(no memory copying for cairo-pygame conversion).


It just that I don't understand why ARGB isn't just ARGB in memory (1 
byte A, 1 byte R, 1 byte G and 1 byte B). Look at lines 627 and 629 in 
src/image.c:

#v+
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
0xFF24, 0xFF, 0xFF8, 0xFF16);
#else
0xFF, 0xFF24, 0xFF16, 0xFF8);
#endif
#v-
The BIG_ENDIAN part should be 0xFF16, 0xFF8, 0xFF, 0xFF24; the 
same as LIL just in reverse order.



--
regards,
Jakub Piotr Cłapa


Re: [pygame] Tile Size

2006-12-16 Thread Farai Aschwanden

Inside...

Am 17.12.2006 um 01:32 schrieb Kris Schnee:

I think that a 2D, flat scrolling tile system in Pygame would be a  
decent compromise between graphical quality and ease of  
programming, for my project. I can live with the game's islands  
being a constant height, for simplicity. One question I could use  
input on is about tile size.

= What blocks you to put higher tiles on the existing tiles?



Right now the game world has 100x100 zones representing chunks of  
terrain I imagine as 1 Km^2, ie. each data point represents a 10m^2  
area. I'd like to show human-sized figures, meaning you can see  
maybe ten times the player's width at a time -- maybe 10 meters  
across. For an 800x600 screen, that would mean tiles maybe 80  
pixels wide for each data point. Pre-drawing a whole zone then  
would mean blitting from a picture 8000x8000 pixels in size! Is  
that impractical?
= 8k x 8k is probably not that big but why creating the whole area  
as image? Why not adding tiles when the player is moving to a certain  
direction. Lets say the player is moving left, so you should add  
tiles on the right side while removing tiles on the left side. This  
would allow you to create big worlds and not limited on huge images.




I'd like to use square tiles of some reasonable size, erring on the  
side of using a few big tiles. Maybe I should treat a zone as being  
just 100x100m? The level of detail on the terrain itself doesn't  
need to be high, because objects like trees can be added separately  
at any exact coordinates. (That is, I could describe an island's  
shape with a small number of data points saying water here, sand  
here, grass here and then a list of exact positions for objects.)
= Same way you could add areas at higher positiones. They are  
rectange oriented you can check that the player cant pass them (maybe  
way up to them?)




Since the game has an island theme I would also like to draw water  
translucently, which would mean blitting a water texture (or at  
least translucent blue/cyan) over parts of the terrain, rather than  
just using blue tiles as I once did (
= Sure would like nice! Instead of this you could use animated water/ 
land combo areas


http://kschnee.xepher.net/pics/niss-05.jpg ). That also means  
having some way to draw water in front of or behind sprites or  
even some of both depending on their vertical position, right? Even  
if the landscape is a constant height for drawing purposes, I'd  
still like to have a character able to go underwater, being drawn  
behind the water, but also able to be above it or at the surface.

= How about you can add the type of water like: 1 = low, 2 = deep
low: cut a part of the charaker off (would also work for monsters  
following the characters or any NPC standing in the water)
deep: The character is painted in deep blue or anim turns into  
swimming animation.


Drawing water could be done on the fly each frame, or given its own  
drawing plane -- doubling the RAM needed for the pre-drawing -- or  
even given a much smaller drawing plane and then somehow scaled up  
each frame. What method makes sense?
= Huh? Doubling RAM? I, personally, recommend you completly try to  
build the visual world in the tile size you planned. Many things to  
mention about this but all over: easier to program than handling  
different tyle size types and mechnisms.


Just my 2 cents
Farai




Kris




[pygame] GLSL in Pygame on a Mac

2006-12-16 Thread Brandon N

Hello,
  I recently came across the GLSL example at: http://www.pygame.org/ 
wiki/GLSLExample


  This would appear to meet my needs for using GLSL from within  
pygame, but I cannot seem to get it working. First, as I am not  
really familiar with the Python wrapper of OpenGL, is that example  
Mac friendly? If so, is there a reason why it would fail on my  
machine when I have OpenGL installed?


My exception (which just shows that neither loading method is working):
OSError: dlopen(libGL.so, 6): image not found

at file root
  in shader_test.py at line 14
function LoadLibrary
  in __init__.py at line 395
function __init__
  in __init__.py at line 312

I am not really certain where to go with this, so thanks for any  
assistance!


Cheers,
 Brandon


Re: [pygame] GLSL in Pygame on a Mac

2006-12-16 Thread Alex Holkner

Brandon N wrote:


Hello,
  I recently came across the GLSL example at: http://www.pygame.org/ 
wiki/GLSLExample


  This would appear to meet my needs for using GLSL from within  
pygame, but I cannot seem to get it working. First, as I am not  
really familiar with the Python wrapper of OpenGL, is that example  
Mac friendly? If so, is there a reason why it would fail on my  
machine when I have OpenGL installed?


My exception (which just shows that neither loading method is working):
OSError: dlopen(libGL.so, 6): image not found

at file root
  in shader_test.py at line 14
function LoadLibrary
  in __init__.py at line 395
function __init__
  in __init__.py at line 312

I am not really certain where to go with this, so thanks for any  
assistance!


The example is Linux-centric, trying to load libGL.so.  On Mac, the 
functions are in the OpenGL.framework.  Replace the line  `gl = 
cdll.LoadLibrary('libGL.so')` with


import ctypes.util
path = ctypes.util.find_library('OpenGL')# finds the absolute 
path to the framework

gl = cdll.LoadLibrary(path)

Cheers
Alex.


Re: [pygame] map format

2006-12-16 Thread Ethan Glasser-Camp
spotter . wrote:
 Hey everybody,
 
 I am in the process of trying to make a file format for maps.
 
 The meta file will have the info like name, author, date, version, and
 the width and height.
 
 The other file will have the actual map data in it. This method will be
 slower,
 since it involves opening, parsing, and closing two files.

I think that unless you're going to be opening/reading map files all
the time -- numerous times per frame? -- the performance differential
is likely to be negligible. Get it working, then get it fast.

If loading maps does turn out to be slow, perhaps you can cache them
once loaded. I do something like this with image files, storing the
images as .png with information like colorkey in a seperate file.
Since I'm caching images anyhow, performance doesn't suffer much.

 The second method will be easier to read in, but will affect performance.
 How do all of you implement maps? Do you use regular expressions or
 simple search a string ?

I typically try to write my maps as pure Python that call game
engine functions. For instance, I've been toying with something like this:

setMap('''
0
1
0''')
setTerrain(0, passable=True, tile=grass)
setTerrain(1, passable=False, tile=forest)

Of course, the last two times I tried to write a tile-based RPG I got
nowhere fast and gave up, so maybe you shouldn't take my advice. :)

The map format I describe above is inspired by looking at some Wesnoth
maps, which look like a huge block of letters, with some other meta
information stored in a seperate file.

Ethan



signature.asc
Description: OpenPGP digital signature


[pygame] Fwd: Please hear me out.

2006-12-16 Thread Scheol Service

-- Forwarded message --
From: Scheol Service [EMAIL PROTECTED]
Date: Dec 7, 2006 4:58 PM
Subject: Please hear me out.
To: pygame-users@seul.org


I know that there is a mailing list and etc.. for Pygame support but
there are other people knowing answers to questions to some noobies
like me have and others know the answers and the support team doesn't
always have time to answer right away so im thinking if you can start
a forums based bulletin board on the pygame.org site /forums for
people to help people with there pygame questions. Also maybe use
PHPBB forum software or SMF software:

phpbb.com and simplemachines.org and if you like to spend money try
invisionpower.com for IPB forums.

Please this will benifit alot of people. AND!! It could be the new
deal for the 1.8 release of pygame.

Just hear me out one time. Thank you. And if it doesn't go successful
then you can dont agree to what I have to say. Thank you for reading
this.

Email me back ASAP
Regards,
Lamonte Harris.(scheols)


Re: [pygame] map format

2006-12-16 Thread Phil Hassey
I just use .tga files -- and surface.get_at() and surface.set_at().
You get limited to 256 tiles and 4 layers, but I've yet to have that be a 
problem.  Quite adequate for any small game -- and it's simple.  If you need 
to upgrade later, you can always change to a text based format that supports 
more stuff.

Phil

Ethan Glasser-Camp [EMAIL PROTECTED] wrote: spotter . wrote:
 Hey everybody,
 
 I am in the process of trying to make a file format for maps.
 
 The meta file will have the info like name, author, date, version, and
 the width and height.
 
 The other file will have the actual map data in it. This method will be
 slower,
 since it involves opening, parsing, and closing two files.

I think that unless you're going to be opening/reading map files all
the time -- numerous times per frame? -- the performance differential
is likely to be negligible. Get it working, then get it fast.

If loading maps does turn out to be slow, perhaps you can cache them
once loaded. I do something like this with image files, storing the
images as .png with information like colorkey in a seperate file.
Since I'm caching images anyhow, performance doesn't suffer much.

 The second method will be easier to read in, but will affect performance.
 How do all of you implement maps? Do you use regular expressions or
 simple search a string ?

I typically try to write my maps as pure Python that call game
engine functions. For instance, I've been toying with something like this:

setMap('''
0
1
0''')
setTerrain(0, passable=True, tile=grass)
setTerrain(1, passable=False, tile=forest)

Of course, the last two times I tried to write a tile-based RPG I got
nowhere fast and gave up, so maybe you shouldn't take my advice. :)

The map format I describe above is inspired by looking at some Wesnoth
maps, which look like a huge block of letters, with some other meta
information stored in a seperate file.

Ethan



 __
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[pygame] Re: Galcon linux version

2006-12-16 Thread Horst JENS
Please help me to Digg Galcon. It is my first time with Digg and i'm a
bit disappointed (just 2 Diggs so far).
http://digg.com/gaming_news/commercial_game_written_in_pygame_released
cheers,
-Horst