Re: [pygame] virtual keyboard input problems under windows

2010-02-04 Thread René Dudfield
hi,

which windows are you using?

Try this before pygame init...

import os
import platform

if platform.system() == 'Windows':
os.environ['SDL_VIDEODRIVER'] = 'windib'


might work.

cu,


Re: [pygame] Squirrel Game Demo

2010-02-04 Thread Kris Schnee

Brian Fisher wrote:
On Thu, Feb 4, 2010 at 12:11 PM, Kris Schnee > wrote:


I'd appreciate
thoughts on making the movement more satisfying.

Animation can actually make a huge difference on the feel, but there are 
a few things I think would help that are just mechanical.
 
You have decceleration on stopping, which is nice, but you don't have 
acceleration on starting movement...


Also, it would feel a lot more satisfying if the squirrel felt smarter 
when it came to edges of platforms...


Finally, it might be nice to do a little action on jump landing - in 
particular, detect whether I am asking for movement when I land...


http://kschnee.xepher.net/code/squirrelgame/

I was tinkering with the code before seeing this message, so there are 
minor changes already:
-Level size is determined from the level.txt file, so you can make 
arbitrarily large ones. I guesstimate that Python should be able to 
handle *much* larger levels on an ordinary computer.
-Improved wall-grabbing and wall-jumping: You automatically grab walls 
when jumping at them, and don't have to hold any key to hang on. If you 
jump while on a wall, you jump off of it. If you step a bit rightward 
from the start, then leap towards the left wall, you can then reach the 
top platform just by wall-jumping.

-Gliding. Hold Z (which now does nothing else) to fall slower.
-X should also make you jump, if Space isn't working due to that 
keyboard problem.

-Music (gratuitously). Plays the first OGG file it finds in \music.

Based on your suggestions I added acceleration on walking/running. 
"speed = min(current_speed+accel, max_speed)". The difference is subtle 
but really seems to help fine movement. The other ideas sound useful 
too, if I can implement them -- but enough for one night. Thanks!


Currently, holding LeftShift gives you that four-footed pose (with no 
effect on your bounding box yet) plus higher speed. A possible way to 
handle edges better is to resist going over them if you're "walking", 
ie. in the non-shifted upright pose. (The art is of course just a 
placeholder.)


New version uploaded (definitely with source code) to:
http://kschnee.xepher.net/code/squirrelgame/

There's an optional music file from Celestial Aeon Project (jamendo.com) 
that you can put in the music directory if you'd like.


Yesterday I tried out the 2D flash version of "Mirror's Edge" for 
comparison. It ran poorly on my laptop, so it's hard to give it a fair 
judgement, but I found the animation nice but the movement... a little 
off, somehow.


Re: [pygame] Squirrel Game Demo

2010-02-04 Thread Brian Fisher
On Thu, Feb 4, 2010 at 12:11 PM, Kris Schnee  wrote:

> I'd appreciate thoughts on
> making the movement more satisfying.
>
> Animation can actually make a huge difference on the feel, but there are a
few things I think would help that are just mechanical.

You have decceleration on stopping, which is nice, but you don't have
acceleration on starting movement, which makes it very hard to make fine
adjustments on landing and such, you should probably pretty much mirror the
decceleration you have, meaning something with a fast response. Also, you
might want to consider having a little bit of acceleration that only fully
kicks in after a few seconds of movement - with that you have a higher
top-speed for longer distance runs, without sacrificing control for smaller
movements, which are good things.

Also, it would feel a lot more satisfying if the squirrel felt smarter when
it came to edges of platforms. In particular, if it was a little harder to
fall off the edge of a platform, and a little easier to jump when running
off the edge of a platform. In prince of persia (the original and sequel)
for instance, the character would go all the way to the edge when you asked
him to move, then hesitate for a moment before falling off (and if you
stopped asking for movement in the hesitation, he'd draw back on the
platform). Also, when running to the edge of a platform, if you jumped
early, he'd take an extra step to jump from the very edge instead. To feel
more squirrely, I'd suggest that the squirrel sort of "grabs" on to the
ledge edge and kind of rolls down around it a touch just a little bit before
he falls, and then if you jumped at that time, he'd spring off. part of that
would be a kind of aesthetic thing to match how squirrels actually move -
but also right now it's way too easy to jump too late and fall off a
platform for me.

Finally, it might be nice to do a little action on jump landing - in
particular, detect whether I am asking for movement when I land. If I am,
push right into that movement with no loss in forward movement - however if
I am not asking for movement when I land, instead have the landing kill the
motion faster, maybe even pulling me back to the landing spot a little. This
will make the squirrel feel move alive and squirrely, and will also make it
easier to land on a platform and more satisfying to hop around.


Re: [pygame] Squirrel Game Demo

2010-02-04 Thread Kris Schnee

Thadeus Burgess wrote:

not messy if there is no source to look at :)
-Thadeus


That would help, wouldn't it? Try:
http://kschnee.xepher.net/code/squirrelgame/squirrel3.py.txt


Re: [pygame] Squirrel Game Demo

2010-02-04 Thread Thadeus Burgess
Ah, see it ok. I redownloaded and its there "squirrel_demo_source.py",
also the first download missed alot of files in the zip, maybe it was
corrupted.

-Thadeus





On Thu, Feb 4, 2010 at 9:40 PM, Thadeus Burgess  wrote:
> Nope, I see the pygame .pyd files, the windows exe, graphics, and the
> map files. No source code.
>
> -Thadeus
>
>
>
>
>
> On Thu, Feb 4, 2010 at 6:56 PM, Luke Paireepinart
>  wrote:
>> Source is there in the zip as far as I can tell, can you not see it?
>>
>> On Thu, Feb 4, 2010 at 5:11 PM, Thadeus Burgess 
>> wrote:
>>>
>>> not messy if there is no source to look at :)
>>> -Thadeus
>>>
>>>
>>>
>>>
>>>
>>> On Thu, Feb 4, 2010 at 2:11 PM, Kris Schnee  wrote:
>>> > http://kschnee.xepher.net/code/squirrelgame/
>>> > http://kschnee.xepher.net/pics/squirrel_game/
>>> > Here's a demo (5 MB EXE w/source) of the little squirrel-game engine
>>> > mentioned earlier. The sample level is 100x25 tiles (50x50 pixels each).
>>> > Though the code's messy it's actually a partial improvement on my
>>> > earlier scrolling-tile engine, due to a steady "camera" that always
>>> > draws the PC at a specific pixel location.
>>> >
>>> > I'd appreciate thoughts on making the movement more satisfying.
>>> > Possibilities include:
>>> > -Gliding: hold Jump when falling to reduce terminal velocity
>>> > -Wall-grabbing without holding left/right
>>> > -Checking more points below the player, to land on the edges of
>>> > platforms
>>> > -Jumping off walls
>>> >
>>> >
>>
>>
>


Re: [pygame] Squirrel Game Demo

2010-02-04 Thread Thadeus Burgess
Nope, I see the pygame .pyd files, the windows exe, graphics, and the
map files. No source code.

-Thadeus





On Thu, Feb 4, 2010 at 6:56 PM, Luke Paireepinart
 wrote:
> Source is there in the zip as far as I can tell, can you not see it?
>
> On Thu, Feb 4, 2010 at 5:11 PM, Thadeus Burgess 
> wrote:
>>
>> not messy if there is no source to look at :)
>> -Thadeus
>>
>>
>>
>>
>>
>> On Thu, Feb 4, 2010 at 2:11 PM, Kris Schnee  wrote:
>> > http://kschnee.xepher.net/code/squirrelgame/
>> > http://kschnee.xepher.net/pics/squirrel_game/
>> > Here's a demo (5 MB EXE w/source) of the little squirrel-game engine
>> > mentioned earlier. The sample level is 100x25 tiles (50x50 pixels each).
>> > Though the code's messy it's actually a partial improvement on my
>> > earlier scrolling-tile engine, due to a steady "camera" that always
>> > draws the PC at a specific pixel location.
>> >
>> > I'd appreciate thoughts on making the movement more satisfying.
>> > Possibilities include:
>> > -Gliding: hold Jump when falling to reduce terminal velocity
>> > -Wall-grabbing without holding left/right
>> > -Checking more points below the player, to land on the edges of
>> > platforms
>> > -Jumping off walls
>> >
>> >
>
>


Re: [pygame] Squirrel Game Demo

2010-02-04 Thread Luke Paireepinart
Source is there in the zip as far as I can tell, can you not see it?

On Thu, Feb 4, 2010 at 5:11 PM, Thadeus Burgess wrote:

> not messy if there is no source to look at :)
> -Thadeus
>
>
>
>
>
> On Thu, Feb 4, 2010 at 2:11 PM, Kris Schnee  wrote:
> > http://kschnee.xepher.net/code/squirrelgame/
> > http://kschnee.xepher.net/pics/squirrel_game/
> > Here's a demo (5 MB EXE w/source) of the little squirrel-game engine
> > mentioned earlier. The sample level is 100x25 tiles (50x50 pixels each).
> > Though the code's messy it's actually a partial improvement on my
> > earlier scrolling-tile engine, due to a steady "camera" that always
> > draws the PC at a specific pixel location.
> >
> > I'd appreciate thoughts on making the movement more satisfying.
> > Possibilities include:
> > -Gliding: hold Jump when falling to reduce terminal velocity
> > -Wall-grabbing without holding left/right
> > -Checking more points below the player, to land on the edges of platforms
> > -Jumping off walls
> >
> >
>


Re: [pygame] frame independant movement

2010-02-04 Thread B W
This is kind of a caveman method that might waste a few precious FPS, but I
used it successfully (I think--I mean, nobody complained my game runs like
crap. :))

Run a frame-flipping benchmark for a second or two as part of your program's
startup, in which you blit the whole screen each frame and record the
average FPS (or minimum FPS if you're a glass-half-full guy). Then pick some
arbitrary percentage of computational overhead you want to reserve for
worst-case game computations, say 10% or 15%, and shave that off the top:
max_fps = bench_fps * 0.15. Then clock.tick(max_fps) to throttle your frame
rate.

Hypothetically you can get near-max FPS on any system. You could then code
your game speed factor in the manner described by the others in this thread.

Not all computers are created equally, though. One may excel or not in any
area depending on the parts and how well they are intergrated. There may be
some systems on which this kind of fudging doesn't work so you could also
provide a means for the user to manually cap FPS if consistent frame rate is
important.

Gumm


Re: [pygame] Squirrel Game Demo

2010-02-04 Thread Thadeus Burgess
not messy if there is no source to look at :)
-Thadeus





On Thu, Feb 4, 2010 at 2:11 PM, Kris Schnee  wrote:
> http://kschnee.xepher.net/code/squirrelgame/
> http://kschnee.xepher.net/pics/squirrel_game/
> Here's a demo (5 MB EXE w/source) of the little squirrel-game engine
> mentioned earlier. The sample level is 100x25 tiles (50x50 pixels each).
> Though the code's messy it's actually a partial improvement on my
> earlier scrolling-tile engine, due to a steady "camera" that always
> draws the PC at a specific pixel location.
>
> I'd appreciate thoughts on making the movement more satisfying.
> Possibilities include:
> -Gliding: hold Jump when falling to reduce terminal velocity
> -Wall-grabbing without holding left/right
> -Checking more points below the player, to land on the edges of platforms
> -Jumping off walls
>
>


Re: [pygame] write sound to file for fast loading?

2010-02-04 Thread B W
On Wed, Feb 3, 2010 at 2:28 PM, Shadd  wrote:

> I think it would be easier to simply use a loading screen before a part of
> the game (f.e. entering an area) and there load any sounds that might come
> in use into that part. It surely would be nicer to see than lag during the
> gameplay.
> Of course this could not be the best solution, but if there are not better
> options, this would be the better to use.
>
> I used pre-loading with a "please wait" screen before. It sucked. Like 20
seconds on a fast computer to load a bunch of songs. A very very very long
time on a slow computer.

Changed to pygame.mixer.music FTW.

Thanks. :)

Gumm


Re: [pygame] virtual keyboard input problems under windows

2010-02-04 Thread Steve Castellotti

On 02/04/2010 01:22 PM, Marcus von Appen wrote:

  I've written a simple pygame application which is meant to receive
keystrokes from a third-party closed-source "virtual keyboard" program
running under Windows.
 

Which is it and is there some demo/test version available? Are there any
specs available about how it perfomrs the virtual input?
   


Thanks for the quick response!

Application is "EmoKey" more information here:

http://www.emotiv.com/apps/epoc/299/


I don't know anything about its internals, but from searching their 
forums, one of their staff has stated that the application "inserts the 
characters into the keyboard input stream."



Did you try to get the SYSWMEVENT and checked, whether it occured on
performing some input with the virtual keyboard? Maybe the virtual
keyboard uses a different Win32 event type with extra payload describing
the key:

 events = pygame.event.get ()
 for event in events:
 if event.type == pygame.SYSWMEVENT:
print event


   


I ended up writing a debug mode which would print the contents of 
any and every pygame.event detected. Nothing was printed out at all (as 
opposed to say, swiping the mouse pointer across the pygame application 
window).




  Is pygame (SDL) somehow talking directly to the keyboard device
driver, so no pygame.event objects are getting created?
 

It talks directly to the Win32 application/window message queue and gets
its events from there, so anything arriving in the message queue will
find its way into the SDL (and thus) pygame event handling queue, usually.
   


Odd, it sounds the software providers are saying should be working 
then.



  ...would it make sense to try compiling the latest SVN of SDL 1.3
under Windows and building Pygame Reloaded against that?
 

Are we talking about pygame or pygame reloaded? Both have a different
kind of API (though the event handling does not differ much).

Besides that, neither pygame nor pygame reloaded support SDL 1.3.
   


My mistake, I thought I read somewhere that things like SDL 1.3 and 
Python 3 were targets for pygame 2 (aka pygame reloaded).



Cheers

Steve




Re: [pygame] virtual keyboard input problems under windows

2010-02-04 Thread Marcus von Appen
On, Thu Feb 04, 2010, Steve Castellotti wrote:

> Hi all-
> 
>  I've written a simple pygame application which is meant to receive 
> keystrokes from a third-party closed-source "virtual keyboard" program 
> running under Windows.

Which is it and is there some demo/test version available? Are there any
specs available about how it perfomrs the virtual input?
 
>  I can successfully receive keystrokes by using the physical 
> keyboard and even through Microsoft's own "On Screen Keyboard" which is 
> distributed with the OS for accessibility purposes.
> 
>  However I am unfortunately having no luck receiving keystrokes from 
> this particular application (and that is the only means to interface 
> with its output programmatically). I have at least confirmed the 
> third-party application works with with other Windows applications such 
> as Notepad.
> 
> 
>  Can anyone recommend avenues to pursue in debugging this problem?

Did you try to get the SYSWMEVENT and checked, whether it occured on
performing some input with the virtual keyboard? Maybe the virtual
keyboard uses a different Win32 event type with extra payload describing
the key:

events = pygame.event.get ()
for event in events:
if event.type == pygame.SYSWMEVENT:
   print event
   

> 
>  Is pygame (SDL) somehow talking directly to the keyboard device 
> driver, so no pygame.event objects are getting created?

It talks directly to the Win32 application/window message queue and gets
its events from there, so anything arriving in the message queue will
find its way into the SDL (and thus) pygame event handling queue, usually.
 
> 
>  I've noticed elsewhere some details about SDL 1.3 having a 
> rewritten, or at least different input model:
> 
> http://www.mail-archive.com/adonthell-de...@nongnu.org/msg00576.html
> 
> 
>  ...would it make sense to try compiling the latest SVN of SDL 1.3 
> under Windows and building Pygame Reloaded against that?

Are we talking about pygame or pygame reloaded? Both have a different
kind of API (though the event handling does not differ much).

Besides that, neither pygame nor pygame reloaded support SDL 1.3.

Regards
Marcus


pgpus7NKX2t1c.pgp
Description: PGP signature


[pygame] virtual keyboard input problems under windows

2010-02-04 Thread Steve Castellotti

Hi all-

I've written a simple pygame application which is meant to receive 
keystrokes from a third-party closed-source "virtual keyboard" program 
running under Windows.


I can successfully receive keystrokes by using the physical 
keyboard and even through Microsoft's own "On Screen Keyboard" which is 
distributed with the OS for accessibility purposes.


However I am unfortunately having no luck receiving keystrokes from 
this particular application (and that is the only means to interface 
with its output programmatically). I have at least confirmed the 
third-party application works with with other Windows applications such 
as Notepad.



Can anyone recommend avenues to pursue in debugging this problem?


Is pygame (SDL) somehow talking directly to the keyboard device 
driver, so no pygame.event objects are getting created?



I've noticed elsewhere some details about SDL 1.3 having a 
rewritten, or at least different input model:


http://www.mail-archive.com/adonthell-de...@nongnu.org/msg00576.html


...would it make sense to try compiling the latest SVN of SDL 1.3 
under Windows and building Pygame Reloaded against that?



Thanks in advance

Steve Castellotti




[pygame] Squirrel Game Demo

2010-02-04 Thread Kris Schnee

http://kschnee.xepher.net/code/squirrelgame/
http://kschnee.xepher.net/pics/squirrel_game/
Here's a demo (5 MB EXE w/source) of the little squirrel-game engine
mentioned earlier. The sample level is 100x25 tiles (50x50 pixels each).
Though the code's messy it's actually a partial improvement on my
earlier scrolling-tile engine, due to a steady "camera" that always
draws the PC at a specific pixel location.

I'd appreciate thoughts on making the movement more satisfying.
Possibilities include:
-Gliding: hold Jump when falling to reduce terminal velocity
-Wall-grabbing without holding left/right
-Checking more points below the player, to land on the edges of platforms
-Jumping off walls