Re: [pygame] patch: build against frameworks or regular libraries on OS X

2011-09-01 Thread René Dudfield
Hello,

below are some updated instructions for how to install with homebrew on
OSX.  I've only tested on OSX 10.7 Lion so far.

cheersm

How to install via the python in your path (likely the apple python):

brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi
sudo pip install hg+http://bitbucket.org/pygame/pygame

How to install to the brew supplied python.

brew install python
brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi
/usr/local/share/python/pip install hg+http://bitbucket.org/pygame/pygame


The issue was updated too.
https://bitbucket.org/pygame/pygame/issue/82/homebrew
-on-leopard-fails-to-install


Re: [pygame] car game mechanics

2011-09-01 Thread Christopher Night
On Tue, Aug 30, 2011 at 10:33 AM, Joe Ranalli jrana...@gmail.com wrote:

 The article that Nathan linked does provide a method for more complex
 treatment of a car.  Instead of treating the car as simply rotating about
 its center, they're accounting for the fact that a real car steers using its
 front wheels while the back wheels are fixed.  Even implementing that
 approach in python using Nathans current programming method would cause
 unrealistic behavior due to similar rounding and transformation size errors
 .


I read that article and I think I found a problem with the algorithm it
presents. If you try to implement that algorithm and it gives you bad
results, check out the comment that I left there.

-Christopher


[pygame] Re: Import error on Windows

2011-09-01 Thread Russell E. Owen
In article 
CAEiAHj+kp2gbeZV=C=xvlot3_sc6r64oac3adz+dyfqbkpm...@mail.gmail.com,
 René Dudfield ren...@gmail.com wrote:

 Hi,
 
 On Tue, Aug 30, 2011 at 10:45 PM, Russell E. Owen 
 ro...@uw.edu wrote:
 
  A colleague is building a Windows application using py2exe. He recently
  upgraded from Python 2.5 and pygame 1.9.1 to Python 2.7 and pygame
  1.9.2pre.win32.py2.7 (I'm guessing 1.9.2a0 but I can't confirm that).
 
  This application only plays sounds, so it only imports pygame.mixer
  However, after upgrading Python and pygame the application fails with an
  import error, saying it can't find pygame._view.
 
  For now he's hacked around the problem by explicitly importing
  pygame._view in the code. However, surely this should not be necessary?
  I hope this is a fixable bug in 1.9.2 prerelease
 
 
 The import error seems to be because py2exe is not detecting the _view
 module.  There is probably some hack we can do to fix this (like importing
 it manually somewhere so py2exe can find it).
 
 I've committed this change, so maybe it will work now without the manual
 import in the app.

Thank you very much. I'll let my colleague know.

 @Lenard: do you think this would be ok to do?
 
 
 
  -- Russell
 
  P.S. I never got any response to my offer of a binary installer of 1.9.1
  for Mac Python 2.7. It's still available here:
  http://www.astro.washington.edu/users/rowen/python/pygame-1.9.1release-p
  ython.org-32bit-py2.7-macosx10.3.dmg
  and it would be great if you folks were willing to serve it.
 
 
 Thanks for that!
 
 Are you able to get some testing for that binary by someone on a separate
 machine to yours?  Does it pass all of the tests?  We need to make sure
 binaries get some testing before we put them up there.

The unit tests (python run_tests.py) pass on two machines of mine (MacOS 
X 10.6.8 and 10.4.11--the machine I use to build it), except for one 
failure:

ERROR: all_tests_for (test.midi_test.AllTestCases)
--
Traceback (most recent call last):
  File test/test.midi_test.py, line 1, in all_tests_for
subprocess completely failed with return code of 0
cmd:  
['/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/
Contents/MacOS/Python', 
'/Users/rowen/Archives/PythonPackages/pygame-1.9.1release/test/test_utils
/test_runner.py', 'test.midi_test', '--exclude', 
'interactive,subprocess_ignore,python2_ignore', '--timings', '1']
test_env: {'_': 
'/Library/Frameworks/Python.framework/Versions/Current/bin/python', 
'LESS': '-r', 'TERM_PROGRAM_VERSION': '273.1', 'ORIGINAL_PATH': 
'/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin', 'CVS_RSH': 
'ssh', 'LOGNAME': 'rowen', 'USER': 'rowen', 'HOME': '/Users/rowen', 
'PATH': 
'/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/local/bin
:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin', 'PS1': 
'\\u$ ', 'LSST_HOME': '/Users/rowen/lsst_home', 'TERM_PROGRAM': 
'Apple_Terminal', 'LANG': 'en_US.UTF-8', 'HISTCONTROL': 'ignoreboth', 
'TERM': 'xterm-color', 'Apple_PubSub_Socket_Render': 
'/tmp/launch-LmXbYf/Render', 'SHLVL': '1', 'MACOSX_DEPLOYMENT_TARGET': 
'10.4', 'DISPLAY': '/tmp/launch-PZ3s9N/org.x:0', 'EDITOR': 'bbedit -w', 
'JAVA_HOME': '/Library/Java/Home/', 'SSH_AUTH_SOCK': 
'/tmp/launch-4CUEgj/Listeners', 'SCONSFLAGS': '-j 2', 'SHELL': 
'/bin/bash', 'SDSS_SVN': 'svn+ssh://sdss3...@sdss3.org/repo', 'TMPDIR': 
'/var/folders/Du/DuJBXd5MH1WSXM9MbpPOek+++TI/-Tmp-/', 'ANT_HOME': 
'/usr/local/ant/', 'LSST_SVN': 'svn+ssh://svn.lsstcorp.org', 'OLDPWD': 
'/Users/rowen/Archives/PythonPackages/pygame-1.9.1release/test', 
'__CF_USER_TEXT_ENCODING': '0x1F5:0:0', 'PWD': 
'/Users/rowen/Archives/PythonPackages/pygame-1.9.1release', 'PAGER': 
'less', 'COMMAND_MODE': 'legacy'}
working_dir:  /Users/rowen/Archives/PythonPackages/pygame-1.9.1release
return (top 5 lines):

By comparison, your standard binary installer for python.org Python 2.6 
has 7 unit test failures on my 10.4.11 machine. So this is potentially 
an improvement.

The sound stuff is well tested -- lots of people are using it in an app 
I distribute, on a variety of Macs. Unfortunately my application does 
not exercise any of the rest of pygame.

 If you have a bitbucket username, I can add you so that you can upload files
 onto there.  We are moving to hosting the files on there, and having the
 main website sync from there.

I just created a bitbucket login: rowen

-- Russell



[pygame] recommended reading for organizing code / project

2011-09-01 Thread Sean Wolfe
Hey everybody,

I'm looking for something to read about organizing one's code. I'm
working on a final fantasy-type game, and as the project gets more
complex I'm starting to think about best practices for development,
code patterns, code organization and project organization, etc. I'm
pretty much self taught on python and programming so I missed out on a
bunch of that I'm sure would be covered by say a CS degree.

I know there are some great books out there, for example Code Patterns
and Antipatterns. I personally own 'Game Coding Complete' by Mike
McShaffry and I'm going to take another pass through that.

Any recommendations? Anything that's particularly useful for game
development? Thanks!!

PS. on an unrelated note, anybody out there tinkering with the Haskell
programming language? I randomly encountered it while looking at the
Geany IDE and it lookspretty interesting.

-- 
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] recommended reading for organizing code / project

2011-09-01 Thread NBarnes
Sean Wolfe ether@gmail.com wrote:

 I'm looking for something to read about organizing one's code. I'm
 working on a final fantasy-type game, and as the project gets more
 complex I'm starting to think about best practices for development,
 code patterns, code organization and project organization, etc. I'm
 pretty much self taught on python and programming so I missed out on a
 bunch of that I'm sure would be covered by say a CS degree.

 I know there are some great books out there, for example Code Patterns
 and Antipatterns. I personally own 'Game Coding Complete' by Mike
 McShaffry and I'm going to take another pass through that.

 Any recommendations? Anything that's particularly useful for game
 development? Thanks!!

The issue of code organization is one of the core challenges facing
the modern programmer.  Object Oriented Programming is a paradigm more
or less explicitly dedicated to managing the level of complexity that
a programmer has to understand to accomplish a discrete task.  It does
this by providing useful abstractions that allow large sections of the
entire codebase to be understood at a level sufficient to work outside
of them at a minimal cost to the programmer's brain.  Modern
applications (game and otherwise) are far too complex to hold in one's
head all at once, no matter how able a programmer and designer one is.
 So I would answer that the first step in fixing your problem is
working on your grasp of object-oriented design principles.


Re: [pygame] recommended reading for organizing code / project

2011-09-01 Thread Christopher Arndt
On 01.09.11 23:24, Sean Wolfe wrote:
 I'm looking for something to read about organizing one's code. 
 
 Any recommendations?

This thread from 2009 on the python mailing list has some great
practical advice (if I may say so, having written a reply there myself).
Be sure to follow the link to Jean-Paul's blog post as well.

http://groups.google.com/group/comp.lang.python/browse_thread/thread/2122c45d0d913a31

Chris


Re: [pygame] recommended reading for organizing code / project

2011-09-01 Thread Ian Mallett
On Thu, Sep 1, 2011 at 4:31 PM, NBarnes nbar...@gmail.com wrote:

 The issue of code organization is one of the core challenges facing
 the modern programmer.  Object Oriented Programming is a paradigm more
 or less explicitly dedicated to managing the level of complexity that
 a programmer has to understand to accomplish a discrete task.  It does
 this by providing useful abstractions that allow large sections of the
 entire codebase to be understood at a level sufficient to work outside
 of them at a minimal cost to the programmer's brain.  Modern
 applications (game and otherwise) are far too complex to hold in one's
 head all at once, no matter how able a programmer and designer one is.

Yes, I remember being taught this.  I also found it to be only party true.

My code is efficient, so no matter how big I need to make it, it literally
tends to take me about 1/4 the code of others.  Also, I can hold *a lot* of
code in my head at once.  I don't think that's unusual for a fairly
proficient programmer.  Finally, even if I can't remember what and how
something works, a moment's thought tells me exactly how I did it--because
for a given design, there's the clean, good way to do it.

 So I would answer that the first step in fixing your problem is
 working on your grasp of object-oriented design principles.


Personally, I think that good coding is an acquired skill.  I can throw
terms at you, like encapsulation or least privilege, but you really
don't know why those are good until you want code reuse/modularity, and a
clean, robust API, respectively.  For me, anyway, I learned how to use these
even before I knew that they were official design patterns--if you know your
language, good code naturally follows from thinking about efficiency.

The good news is that these terms are easily available on the web.  The bad
news is that you need to use all of them at some point before you get them.
 Frankly, most universities ignore this fact.  This is why dumb design
patterns get used in practice.  My recommendation: do nothing different,
except, before starting something, think: Hmmm, what could I do that would
make this more efficient?  Is there any clever way I can use classes to make
this simpler?  Inheritance?  Insert _ language feature?  Once you step
back from the problem like this, what to do becomes obvious, whether or not
you know just what it's called.  It takes until upper division CS to even
touch on this--and even then they never say that as directly.

Ian


Re: [pygame] recommended reading for organizing code / project

2011-09-01 Thread Sean Wolfe
I appreciate the advice guys. OOP is definitely something I'm trying
to leverage. I was thinking along the lines of OOP type patterns, best
practices, etc... or even just general game programming. Especially if
anybody has any favorite books! I heart good books.

Thanks for the responses so far!

On Thu, Sep 1, 2011 at 9:13 PM, Ian Mallett geometr...@gmail.com wrote:
 On Thu, Sep 1, 2011 at 4:31 PM, NBarnes nbar...@gmail.com wrote:

 The issue of code organization is one of the core challenges facing
 the modern programmer.  Object Oriented Programming is a paradigm more
 or less explicitly dedicated to managing the level of complexity that
 a programmer has to understand to accomplish a discrete task.  It does
 this by providing useful abstractions that allow large sections of the
 entire codebase to be understood at a level sufficient to work outside
 of them at a minimal cost to the programmer's brain.  Modern
 applications (game and otherwise) are far too complex to hold in one's
 head all at once, no matter how able a programmer and designer one is.

 Yes, I remember being taught this.  I also found it to be only party true.
 My code is efficient, so no matter how big I need to make it, it literally
 tends to take me about 1/4 the code of others.  Also, I can hold a lot of
 code in my head at once.  I don't think that's unusual for a fairly
 proficient programmer.  Finally, even if I can't remember what and how
 something works, a moment's thought tells me exactly how I did it--because
 for a given design, there's the clean, good way to do it.

  So I would answer that the first step in fixing your problem is
 working on your grasp of object-oriented design principles.

 Personally, I think that good coding is an acquired skill.  I can throw
 terms at you, like encapsulation or least privilege, but you really
 don't know why those are good until you want code reuse/modularity, and a
 clean, robust API, respectively.  For me, anyway, I learned how to use these
 even before I knew that they were official design patterns--if you know your
 language, good code naturally follows from thinking about efficiency.
 The good news is that these terms are easily available on the web.  The bad
 news is that you need to use all of them at some point before you get them.
  Frankly, most universities ignore this fact.  This is why dumb design
 patterns get used in practice.  My recommendation: do nothing different,
 except, before starting something, think: Hmmm, what could I do that would
 make this more efficient?  Is there any clever way I can use classes to make
 this simpler?  Inheritance?  Insert _ language feature?  Once you step
 back from the problem like this, what to do becomes obvious, whether or not
 you know just what it's called.  It takes until upper division CS to even
 touch on this--and even then they never say that as directly.
 Ian



-- 
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] recommended reading for organizing code / project

2011-09-01 Thread Ian Mallett
On Thu, Sep 1, 2011 at 7:12 PM, Sean Wolfe ether@gmail.com wrote:

 I heart good books.

cough *experience* /cough :-)


Re: [pygame] recommended reading for organizing code / project

2011-09-01 Thread Sean Wolfe
A good book is basically a compilation of somebody else's experience,
right? Nothing wrong with that imo. Especially if you're on the
throne... you've got the time.

owait ... tmi

On Thu, Sep 1, 2011 at 10:14 PM, Ian Mallett geometr...@gmail.com wrote:
 On Thu, Sep 1, 2011 at 7:12 PM, Sean Wolfe ether@gmail.com wrote:

 I heart good books.

 cough *experience* /cough :-)



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