Re: [pygame] Capabilities of Pygame

2012-01-15 Thread Greg

Lenard Lindstrom wrote:
I remember there was a tradeoff though, with poor playback if the buffer 
was too small. Maybe that is no longer a problem.


It probably depends on how fast your hardware is. I've successfully
used buffer sizes as small as 128 (that was in a game where I needed
a sound latency of less than 0.1 seconds -- most games don't have
such stringent requirements).

--
Greg


Re: [pygame] Capabilities of Pygame

2012-01-14 Thread Sean Wolfe
ogg streaming + sound effects together, works fine for me on both
pygame windows + android phone. Worked like a charm actually. I love
python.

On Sat, Jan 14, 2012 at 1:13 AM, Zack Baker zbaker1...@gmail.com wrote:
 Thanks guys!!

 -Zack


 On Jan 13, 2012, at 10:45 PM, Ian Mallett geometr...@gmail.com wrote:

 On Fri, Jan 13, 2012 at 7:36 PM, Zack Baker zbaker1...@gmail.com wrote:

 I use it for my 'soundtracks' in the games. The only problem I run into
 with it is it takes a 'loop' argument, which is how many times the song
 should loop, I wish you could set this too infinite but I usually set it too
 500 and that seems to work. Assuming no one will play my game for mor than
 26 hours in a row...

 -Zack

 If I recall, try -1



-- 
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


Re: [pygame] Capabilities of Pygame

2012-01-14 Thread R. Alan Monroe
 FORTRAN is still used in some circles because it's
 still very fast for number crunching.

A bit off topic, but I've seen this bit of folk wisdom repeated online
for a long time and have always been skeptical. How does a C command
that gets compiled to a CPU's MUL instruction differ in any way from a
Fortran command that also gets compiled to that same CPU's same MUL
instruction? Honest question.

Alan



Re: [pygame] Capabilities of Pygame

2012-01-14 Thread René Dudfield
On Sat, Jan 14, 2012 at 12:03 AM, R. Alan Monroe amon...@columbus.rr.comwrote:

  FORTRAN is still used in some circles because it's
  still very fast for number crunching.

 A bit off topic, but I've seen this bit of folk wisdom repeated online
 for a long time and have always been skeptical. How does a C command
 that gets compiled to a CPU's MUL instruction differ in any way from a
 Fortran command that also gets compiled to that same CPU's same MUL
 instruction? Honest question.

 Alan



Theoretically, the compiler has more information about the fortran code
than the C code, so can make more optimizations.  So in C, the compiler can
not be sure about pointer aliasing, and such things... so it has to be a
little safer about the optimizations.  In practice, you can provide hints
to the C compiler to get pretty much the same performance.  For a modern C
compiler like gcc, you have things like 'pure', 'restrict', openmp hints,
function level optimization optimizations, and various other vectorisation
hints that let you do lots of optimizations that fortran can do.

See this for more info:
http://stackoverflow.com/questions/146159/is-fortran-faster-than-c
Also see here that fortran is still speedy:

http://shootout.alioth.debian.org/u64q/which-programming-languages-are-fastest.php


cheers,


Re: [pygame] Capabilities of Pygame

2012-01-14 Thread ANKUR AGGARWAL
You can check put my repository for  pygame examples
https://github.com/ankur0890/Pygame-Examples-For-Learning

On Sat, Jan 14, 2012 at 4:33 AM, R. Alan Monroe amon...@columbus.rr.comwrote:

  FORTRAN is still used in some circles because it's
  still very fast for number crunching.

 A bit off topic, but I've seen this bit of folk wisdom repeated online
 for a long time and have always been skeptical. How does a C command
 that gets compiled to a CPU's MUL instruction differ in any way from a
 Fortran command that also gets compiled to that same CPU's same MUL
 instruction? Honest question.

 Alan




Re: [pygame] Capabilities of Pygame

2012-01-14 Thread Greg

R. Alan Monroe wrote:

How does a C command
that gets compiled to a CPU's MUL instruction differ in any way from a
Fortran command that also gets compiled to that same CPU's same MUL
instruction?


Fortran has various rules that prevent aliasing, i.e. having
two different names for the same thing. This allows the compiler
to perform various optimisations that can't safely be performed
in C, where you can get aliasing of just about anything using
pointers.

Various arcane anti-aliasing rules have been introduced into
recent versions of C, but there's still a lot more room for
aliasing than there is in Fortran.

--
Greg


RE: [pygame] Capabilities of Pygame

2012-01-14 Thread Ryan Strunk
--- On Fri, 1/13/12, Lenard Lindstrom le...@telus.net wrote:

  Also,
  though SDL does support streaming, Pygame does not.
  Everything must be loaded before played.

 Um... that's not true.  pygame.mixer.music is Pygame's streaming module.

So if you were to stream audio, would that eliminate the potential delay.
The only audio-only game I've seen written in Pygame, Sound RTS, has a bit
of noticeable lag when playing sounds. Is there a way to program such that
sounds would play instantly when told to do so?
Thanks for everyone's help thus far.
Ryan



RE: [pygame] Capabilities of Pygame

2012-01-14 Thread Julian Marchant
--- On Sat, 1/14/12, Ryan Strunk ryan.str...@gmail.com wrote:
 So if you were to stream audio, would that eliminate the
 potential delay.
 The only audio-only game I've seen written in Pygame, Sound
 RTS, has a bit
 of noticeable lag when playing sounds. Is there a way to
 program such that
 sounds would play instantly when told to do so?

Streaming is for music, not sound effects.


Re: [pygame] Capabilities of Pygame

2012-01-14 Thread Greg

--- On Sat, 1/14/12, Ryan Strunk ryan.str...@gmail.com wrote:

The only audio-only game I've seen written in Pygame, Sound
RTS, has a bit
of noticeable lag when playing sounds.


I don't know about music, but the latency of (non-streamed)
sounds can be reduced by specifying a smaller buffer size
when you initialise the mixer module.

--
Greg


Re: [pygame] Capabilities of Pygame

2012-01-14 Thread Lenard Lindstrom

On 14/01/2012 2:22 AM, Christopher Night wrote:
On Fri, Jan 13, 2012 at 9:15 PM, Lenard Lindstrom le...@telus.net 
mailto:le...@telus.net wrote:


On 13/01/12 01:43 PM, Julian Marchant wrote:

--- On Fri, 1/13/12, Lenard Lindstromle...@telus.net
mailto:le...@telus.net  wrote:

Also,
though SDL does support streaming, Pygame does not.
Everything must be loaded before played.

Um... that's not true.  pygame.mixer.music is Pygame's
streaming module.

Oh right, I forgot about file like objects. Has anyone managed to
use the music module to play streaming audio?


I feel like I'm misunderstanding you, but yes I use pygame.mixer.music 
to stream audio from an OGG file all the time. I've never had a 
problem with it. Is that what you're asking?


-Christopher

I was vague. I was referring to streaming audio from a remote server, 
such as over the internet. If Ryan Strunk intends to develop a web based 
multiplayer game--he did mention World of Warcraft--then he would want 
streaming audio, especially if the game is audio only. Pygame has no 
code specific to remote streaming. I did search if an audio stream could 
be fed to the music module through a socket or pipe. I found no answer.


If I am reading too much into Ryan's intentions then I apologize for 
sidetracking the discussion.


Lenard Lindstrom



Re: [pygame] Capabilities of Pygame

2012-01-14 Thread Lenard Lindstrom

On 14/01/2012 8:36 PM, Greg wrote:

--- On Sat, 1/14/12, Ryan Strunk ryan.str...@gmail.com wrote:

The only audio-only game I've seen written in Pygame, Sound
RTS, has a bit
of noticeable lag when playing sounds.


I don't know about music, but the latency of (non-streamed)
sounds can be reduced by specifying a smaller buffer size
when you initialise the mixer module.

I remember there was a tradeoff though, with poor playback if the buffer 
was too small. Maybe that is no longer a problem.


Lenard



Re: [pygame] Capabilities of Pygame

2012-01-13 Thread Christopher Night
On Thu, Jan 12, 2012 at 9:04 PM, Ryan Strunk ryan.str...@gmail.com wrote:

  If you're working on a game that you could conceivably write by
 yourself or with a small team, python will probably be up for the job.

 That’s good to know. With as much as critics of Python harp on the speed,
 I was worried that resulting software was going to crawl along at a snail’s
 pace. Are there any situations that come to mind where Python wouldn’t work?


It's a little complicated. If you write everything in pure python only
using the pygame library, then yes I can easily think of some examples
where it wouldn't work at all, or not have good performance. However, some
(maybe all?) of these can be solved by finding another library written
specifically for that purpose to help you. And, as Sean Wolfe said, there
are people working on speeding up python, and don't forget that computers
are getting faster all the time. So it might not even be the case in a few
years. Given that, if I were making a game that relied heavily one of the
following things, I would reconsider python:

   - 3D - I've only used pyopengl and, I admit, it's kind of slow. When I
   ported a pyopengl game I wrote into C++, I got something like a 10x
   speedup. pyglet might perform better.
   - Huge numbers of sprites, like in the thousands or tens of thousands.
   - Collision detection and physics between more than ~100 objects. There
   are certainly libraries for this, but I'm not sure how they perform
   compared to their C++ counterparts.
   - Pixel-level manipulation of images, although this has gotten much
   better with the surfarray module.
   - Running on a mobile device.
   - Running in a browser.

This has some similarities with Silver's list, which is also good.

-Christopher


Re: [pygame] Capabilities of Pygame

2012-01-13 Thread Lenard Lindstrom

On 12/01/12 06:04 PM, Ryan Strunk wrote:


*From:*owner-pygame-us...@seul.org 
[mailto:owner-pygame-us...@seul.org] *On Behalf Of *Christopher Night

*Sent:* Thursday, January 12, 2012 7:54 PM
*To:* pygame-users@seul.org
*Subject:* Re: [pygame] Capabilities of Pygame

 Seriously, what kind of game do you want to make?

I have a couple in mind: an internet multi-player side scroller based 
on the rules to Sparkle, a sandbox-type world combining missions and 
social situations, various sports titles. All of the games will take 
place solely in an audio medium.


If I understand correctly, these games will be sound only. If so, Pygame 
may not be the best choice. The SDL library, on which Pygame is built, 
plays background music fine. However, sound effects are another issue. 
Anything but short sound snippets can show a noticeable delay between 
when the sound is initiated and when it is heard. SDL does not store 
sound samples in audio memory. They are fed to the sound card each time. 
This copy time leads to the delay. Also, though SDL does support 
streaming, Pygame does not. Everything must be loaded before played.



 If you're working on a game that you could conceivably write by 
yourself or with a small team, python will probably be up for the job. 
In neither case is performance going to be the main consideration of 
you personally.


That’s good to know. With as much as critics of Python harp on the 
speed, I was worried that resulting software was going to crawl along 
at a snail’s pace. Are there any situations that come to mind where 
Python wouldn’t work?


Thanks a lot for all your help.

Best,

Ryan

That said, Python/Pygame is still a good way to become familiar with 
game development. It is a good framework for developing a project, which 
can be rewritten to performance later.


Lenard Lindstrom



Re: [pygame] Capabilities of Pygame

2012-01-13 Thread Julian Marchant
--- On Fri, 1/13/12, Lenard Lindstrom le...@telus.net wrote:

 Also,
 though SDL does support streaming, Pygame does not.
 Everything must be loaded before played.

Um... that's not true.  pygame.mixer.music is Pygame's streaming module.


Re: [pygame] Capabilities of Pygame

2012-01-13 Thread Lenard Lindstrom

On 13/01/12 01:43 PM, Julian Marchant wrote:

--- On Fri, 1/13/12, Lenard Lindstromle...@telus.net  wrote:


Also,
though SDL does support streaming, Pygame does not.
Everything must be loaded before played.

Um... that's not true.  pygame.mixer.music is Pygame's streaming module.
Oh right, I forgot about file like objects. Has anyone managed to use 
the music module to play streaming audio?


Lenard Lindstrom



Re: [pygame] Capabilities of Pygame

2012-01-13 Thread Zack Baker
I use it for my 'soundtracks' in the games. The only problem I run into with it 
is it takes a 'loop' argument, which is how many times the song should loop, I 
wish you could set this too infinite but I usually set it too 500 and that 
seems to work. Assuming no one will play my game for mor than 26 hours in a 
row...

-Zack


On Jan 13, 2012, at 9:22 PM, Christopher Night cosmologi...@gmail.com wrote:

 On Fri, Jan 13, 2012 at 9:15 PM, Lenard Lindstrom le...@telus.net wrote:
 On 13/01/12 01:43 PM, Julian Marchant wrote:
 --- On Fri, 1/13/12, Lenard Lindstromle...@telus.net  wrote:
 
 Also,
 though SDL does support streaming, Pygame does not.
 Everything must be loaded before played.
 Um... that's not true.  pygame.mixer.music is Pygame's streaming module.
 Oh right, I forgot about file like objects. Has anyone managed to use the 
 music module to play streaming audio?
 
 I feel like I'm misunderstanding you, but yes I use pygame.mixer.music to 
 stream audio from an OGG file all the time. I've never had a problem with it. 
 Is that what you're asking?
 
 -Christopher
 


Re: [pygame] Capabilities of Pygame

2012-01-13 Thread Kevin Secretan
Or just set it to -1? (Docs are wonderful:
http://www.pygame.org/docs/ref/music.html#pygame.mixer.music.play )

On Fri, Jan 13, 2012 at 7:36 PM, Zack Baker zbaker1...@gmail.com wrote:

 I use it for my 'soundtracks' in the games. The only problem I run into
 with it is it takes a 'loop' argument, which is how many times the song
 should loop, I wish you could set this too infinite but I usually set it
 too 500 and that seems to work. Assuming no one will play my game for mor
 than 26 hours in a row...

 -Zack


 On Jan 13, 2012, at 9:22 PM, Christopher Night cosmologi...@gmail.com
 wrote:

 On Fri, Jan 13, 2012 at 9:15 PM, Lenard Lindstrom le...@telus.net wrote:

 On 13/01/12 01:43 PM, Julian Marchant wrote:

 --- On Fri, 1/13/12, Lenard Lindstromle...@telus.net  wrote:

  Also,
 though SDL does support streaming, Pygame does not.
 Everything must be loaded before played.

 Um... that's not true.  pygame.mixer.music is Pygame's streaming module.

 Oh right, I forgot about file like objects. Has anyone managed to use the
 music module to play streaming audio?


 I feel like I'm misunderstanding you, but yes I use pygame.mixer.music to
 stream audio from an OGG file all the time. I've never had a problem with
 it. Is that what you're asking?

 -Christopher




Re: [pygame] Capabilities of Pygame

2012-01-13 Thread Zack Baker
Thanks guys!!

-Zack


On Jan 13, 2012, at 10:45 PM, Ian Mallett geometr...@gmail.com wrote:

 On Fri, Jan 13, 2012 at 7:36 PM, Zack Baker zbaker1...@gmail.com wrote:
 I use it for my 'soundtracks' in the games. The only problem I run into with 
 it is it takes a 'loop' argument, which is how many times the song should 
 loop, I wish you could set this too infinite but I usually set it too 500 and 
 that seems to work. Assuming no one will play my game for mor than 26 hours 
 in a row...
 
 -Zack
 If I recall, try -1


Re: [pygame] Capabilities of Pygame

2012-01-12 Thread Christopher Night
If you set out to remake World of Warcraft in python, then by the time you
finish in 200 years, computers will be more than fast enough that your
program will run just fine.

Seriously, what kind of game do you want to make? If you want to work on an
MMORPG, you'll have to be working for a company, in which case you don't
pick a language based on performance, you pick it based on what that
company uses. If you're working on a game that you could conceivably write
by yourself or with a small team, python will probably be up for the job.
In neither case is performance going to be the main consideration of you
personally.

So yeah, you'd run into trouble writing WoW in python, but that's really
not the question you should be asking.

-Christopher

On Thu, Jan 12, 2012 at 8:45 PM, Ryan Strunk ryan.str...@gmail.com wrote:

 Hello everyone,

 As I embark on this journey of learning Pygame and game design, I have one
 last burning question I haven’t been able to find an answer to. I’ve heard
 that Python, as an interpreted language, isn’t as fast as languages like
 C++. It follows, then, that Pygame would suffer the same drawback in terms
 of speed. What I don’t know, though, is how much this potential limitation
 would affect game play.

 Using Pygame, is it possible to create games that would rival the scope
 and complexity of mainstream titles out there. Could you build a World the
 size of World of Warcraft and still have it be responsive to players? Could
 you build a game as fast-moving as Mortal Kombat, play it over the internet
 with a good connection, and still have it be as smooth as the Xbox?

 I want to make sure I don’t get deep into a project only to realize that
 the language was better suited to a different style of game.

 Any help anyone can provide would be greatly appreciated.

 All the best,

 Ryan



RE: [pygame] Capabilities of Pygame

2012-01-12 Thread Ryan Strunk
From: owner-pygame-us...@seul.org [mailto:owner-pygame-us...@seul.org] On
Behalf Of Christopher Night
Sent: Thursday, January 12, 2012 7:54 PM
To: pygame-users@seul.org
Subject: Re: [pygame] Capabilities of Pygame

 

 Seriously, what kind of game do you want to make?

I have a couple in mind: an internet multi-player side scroller based on the
rules to Sparkle, a sandbox-type world combining missions and social
situations, various sports titles. All of the games will take place solely
in an audio medium.

 If you're working on a game that you could conceivably write by yourself
or with a small team, python will probably be up for the job. In neither
case is performance going to be the main consideration of you personally.

That's good to know. With as much as critics of Python harp on the speed, I
was worried that resulting software was going to crawl along at a snail's
pace. Are there any situations that come to mind where Python wouldn't work?

Thanks a lot for all your help.

Best,

Ryan



Re: [pygame] Capabilities of Pygame

2012-01-12 Thread Nic
The Eve Online client and server are written in 200,000+ lines of Python
respectively. I'd say the only limit is time and knowledge and the real
issue is the question that Mr. Night posed, what type of game do you want
to make, and based on the answer to that question, is Python (PyGame) the
right choice?

I can say this though, if you're new to programming or game development,
spend some time to remake snake, or tetris, or pong in PyGame and see how
it does. Python's syntax is extremely accesible to newcomers to programming
so it's going to help immensely when it comes to learning a programming
language. Those lessons you learn will be relavent in all programming
languages. Then, after you've done those projects, re-address the question
of what game you want to make and the question of whether or not to use
Python will be clearer.

On Thu, Jan 12, 2012 at 5:53 PM, Christopher Night
cosmologi...@gmail.comwrote:

 If you set out to remake World of Warcraft in python, then by the time you
 finish in 200 years, computers will be more than fast enough that your
 program will run just fine.

 Seriously, what kind of game do you want to make? If you want to work on
 an MMORPG, you'll have to be working for a company, in which case you don't
 pick a language based on performance, you pick it based on what that
 company uses. If you're working on a game that you could conceivably write
 by yourself or with a small team, python will probably be up for the job.
 In neither case is performance going to be the main consideration of you
 personally.

 So yeah, you'd run into trouble writing WoW in python, but that's really
 not the question you should be asking.

 -Christopher


 On Thu, Jan 12, 2012 at 8:45 PM, Ryan Strunk ryan.str...@gmail.comwrote:

 Hello everyone,

 As I embark on this journey of learning Pygame and game design, I have
 one last burning question I haven’t been able to find an answer to. I’ve
 heard that Python, as an interpreted language, isn’t as fast as languages
 like C++. It follows, then, that Pygame would suffer the same drawback in
 terms of speed. What I don’t know, though, is how much this potential
 limitation would affect game play.

 Using Pygame, is it possible to create games that would rival the scope
 and complexity of mainstream titles out there. Could you build a World the
 size of World of Warcraft and still have it be responsive to players? Could
 you build a game as fast-moving as Mortal Kombat, play it over the internet
 with a good connection, and still have it be as smooth as the Xbox?

 I want to make sure I don’t get deep into a project only to realize that
 the language was better suited to a different style of game.

 Any help anyone can provide would be greatly appreciated.

 All the best,

 Ryan





-- 
o/


Re: [pygame] Capabilities of Pygame

2012-01-12 Thread Julian Marchant
You couldn't build a game that's up to scope with any 3D game, because you 
wouldn't be able to use 3D. For that, you'd need either PyOpenGL (with Pygame) 
or Pyglet. The latter is better in some ways; the main advantage 
Pygame/PyOpenGL has that I can think of is joystick support. On the other hand, 
Pyglet is compatible with PyPy, which can give you massive speed improvements, 
and it's easier to use than PyOpenGL (or so I've heard; I haven't done anything 
with either myself).

The Pythonic way is to not worry about speed until it's actually an issue. If 
speed is an issue, you can re-write parts in C, or there's the aforementioned 
PyPy.

--- On Fri, 1/13/12, Ryan Strunk ryan.str...@gmail.com wrote:

From: Ryan Strunk ryan.str...@gmail.com
Subject: [pygame] Capabilities of Pygame
To: pygame-users@seul.org
Date: Friday, January 13, 2012, 1:45 AM

Hello everyone,As I embark on this journey of learning Pygame and game design, 
I have one last burning question I haven’t been able to find an answer to. I’ve 
heard that Python, as an interpreted language, isn’t as fast as languages like 
C++. It follows, then, that Pygame would suffer the same drawback in terms of 
speed. What I don’t know, though, is how much this potential limitation would 
affect game play.Using Pygame, is it possible to create games that would rival 
the scope and complexity of mainstream titles out there. Could you build a 
World the size of World of Warcraft and still have it be responsive to players? 
Could you build a game as fast-moving as Mortal Kombat, play it over the 
internet with a good connection, and still have it be as smooth as the Xbox?I 
want to make sure I don’t get deep into a project only to realize that the 
language was better suited to a different style of game.Any help anyone can 
provide would be greatly
 appreciated.All the best,Ryan

Re: [pygame] Capabilities of Pygame

2012-01-12 Thread Sean Wolfe


 --- On *Fri, 1/13/12, Ryan Strunk ryan.str...@gmail.com* wrote:

 As I embark on this journey of learning Pygame and game design, I have one
 last burning question I haven’t been able to find an answer to. I’ve heard
 that Python, as an interpreted language, isn’t as fast as languages like
 C++. It follows, then, that Pygame would suffer the same drawback in terms
 of speed. What I don’t know, though, is how much this potential limitation
 would affect game play.

 Using Pygame, is it possible to create games that would rival the scope
 and complexity of mainstream titles out there. Could you build a World the
 size of World of Warcraft and still have it be responsive to players? Could
 you build a game as fast-moving as Mortal Kombat, play it over the internet
 with a good connection, and still have it be as smooth as the Xbox?

 I want to make sure I don’t get deep into a project only to realize that
 the language was better suited to a different style of game.

 Any help anyone can provide would be greatly appreciated.

 All the best,

 Ryan



Hey Ryan, welcome aboard and I hope you find your journey fun and
educational! I certainly have!

Right now I am working on an android game in Java and I hate it. Java
sucks. I am hoping to contribute to the pygame on android project (
pygame.renpy.org ) to help move that along.

I think pygame is a great way to get started and learn. If your experience
is anything like mine, you may find that when you have to use other
languages it's tough cause Python is just so much easier. I find myself
asking why, why, why and most answers are either 'we can't do it the easier
way' or 'we don't do it the easier way.'

Aww man it's a blast, have fun!


Re: [pygame] Capabilities of Pygame

2012-01-12 Thread Sean Wolfe
Also Ryan, as to your questions regarding speed. There is a lot of work in
the python community right now for speed improvements -- pypy, Cython,
shedskin, as people here have said.

I'm curious to see how pygame evolves over the next few years. Cause here's
the deal -- the development time savings is obvious. So if we are able to
execute more complex games with pygame, then why shouldn't it become more
mainstream? Better faster cheaper.

Also did you see the pygamezine? Pretty cool...

http://pygamezine.com/


Re: [pygame] Capabilities of Pygame

2012-01-12 Thread Silver
On 1/12/2012 5:45 PM, Ryan Strunk wrote:
 Hello everyone,
 
 -[erased]
 
 Ryan
 
 
Hey, as a veteran programmer, what I can say about python's speed is
that it is sufficient to do a very many of things.

With python/pygame the only speed issues I have run into are:
* Programming Language issues that can be fixed with common sense (such
as appending to a huge list, which reallocates the whole thing and takes
forever)
* running a huge for loop
* printing lots of text (expect more than a hundred print's a second to
bring significant slowness)
* Pixel logic. Not gonna lie, python is not so good here. Small images
can be done at speed, but anything larger is a pain. (my computer
comfortably does 80x80)
* 3D -- I personally avoid using python for 3d. I've tried numerous
times to get pyopengl working and failed.



If you wish to use arrays, I suggest using numpy.
For image processing, I suggest scipy.

Maybe something else will help too.

If you look into multiprocessing to split stuff into separate threads,
beware and look carefully at instructions to keep your system from
crashing. It's easy to miss one of the crucial details and windows does
not have a barrier in place to stop infinite process generation.


Re: [pygame] Capabilities of Pygame

2012-01-12 Thread Kevin Secretan
It should also be noted that C++ itself isn't fundamentally a fast language
from a design perspective (and if you make the mistake of having a lot of
news and deletes going off at inopportune times you'll see its true
potential sluggishness). Its primary benefit is that it lets you talk to
hardware more-or-less directly which lets you the intelligent programmer
(with the help of the compiler) align the interests of the hardware with
the interests of the problem you're trying to solve, whereas Python is
mostly about just solving the problem even if it takes a long time to
compute. Which makes it an excellent platform to learn anything abstractly
(like game design) off of while not simultaneously fighting with the
language on account of hardware being a particular way. You can focus on
learning algorithms and data structures that improve efficiency in a
language-agnostic way and with Python's flexibility you can also explore
algorithms that don't usually get mentioned in the C++ world that may fit
your particular case (and learn to love native dictionaries/hash tables and
lists).

Sufficiently smart compilers have been able to compile Haskell and
(slightly annotated) Common Lisp to code that beats C++ for a long while
now, and FORTRAN is still used in some circles because it's still very fast
for number crunching. Projects others mentioned like PyPy continue to
narrow the margins though they've got a ways to go. Unfortunately talking
to hardware directly with Python usually means doing it with C/C++ then
talking to those libs from Python. (As is the case for PyGame's core (SDL
in C), PyOpenGL, etc.) I'd like to say this is the standard approach for
most Pythonistas: write everything in Python, then rewrite the slow bits in
C/C++. Fortunately a lot of the reasons we might need to talk to the
hardware (graphics drivers, screens, fast number crunching) are general
enough that other people have done most of the work for you to take
advantage of. Even in the FPGA world where you get to design your own
hardware with code, there's the MyHDL project which provides Python with
nice sugar for HDL code and compiles your source to Verilog or VHDL which
you'd normally write instead at your own peril and frustration.