General Python/pygame Question


liquidgandalf

Still Fresh
Joined
Feb 9, 2009
Messages
12
With the Pandora in mind,

I'm messed around a Little with Python / Pygame on windows and from that platform there is py2exe program which builds a windows EXE file.

While I've used linux for some time, its purely been from a server point of View (Lamp etc..) I've never tried to write any programs for it.

Is there anywhere I can read up on the finalising of Python / Pygame apps in relation to the pandora?

-----

Another (slightly related question) I used PyBluez on the windows side to get PC and Mobile Phones talking dont suppose It'll work out of the box on the pandora?


p.s.
what i 'almost' got working on the PC before I got Bored was basically a Poker game,
the PC deals the cards shows the main table looks after the chip stacks etc.. and the players use mobile phones to View their cards and make bets.. (Mobile phone bit done in Java)
while it was all very experimental from my point of view, the PC wasnt a suitable host. - not really going to get 4-6 Players around a PC screen. - The Pandora and the capability to plug into a TV has kinda made me rething the Idea.
 
Last edited by a moderator:
call me old school, but couldn't you achieve the same effect with a pack of cards? :)
 
Last edited by a moderator:
'CiderPunk' said:
call me old school, but couldn't you achieve the same effect with a pack of cards? :)
Well..... Yes..... but wheres the fun in that? (besides having the pandora in your pocket means you could play anywhere :)

on another note, Assuming I can get it all working, think of the possibilitys for multiplayer gaming,
with the Pandora as Host, and any old Mobile Phone as Client/controllers.
 
Last edited by a moderator:
"Is there anywhere I can read up on the finalising of Python / Pygame apps in relation to the pandora?" -- the pandora is not released yet, so of course not :)

jeff
 
Last edited by a moderator:
On a more serious note, tho :)P)...
Python games don't really need finalizing. Most programmers don't compile python, because of it's portability. Sure, you could, but why? :)
Just run your pythons cripts as they are ont he pandora, no more finalizing needed.
 
Last edited by a moderator:
Make a good package structure. You shouldn't have more than one python source file (the excutable) in the program root, so it's obvious how to run the program. When you have a satisfying structure, write decent documentation, zip it up and publish.
 
Last edited by a moderator:
OBvious which exec to run? In Pandora case, the PXML will take care of that. Frther, could stick all dependancies in a subdir, with a shellscript that does the launching, so its extremely obvious for commandlinders where to go. I wouldn't sweat minor details like that.

jeff
 
Last edited by a moderator:
'skeezix' said:
OBvious which exec to run? In Pandora case, the PXML will take care of that. Frther, could stick all dependancies in a subdir, with a shellscript that does the launching, so its extremely obvious for commandlinders where to go. I wouldn't sweat minor details like that.

jeff
Oh, that's right. I somehow forgot all about pxml. Silly me. :rolleyes:
 
Last edited by a moderator:
For 'compiling' Python scripts on linux there is Freeze, which is good for including dependencies, so users don't need to have all of them available already on their system. I don't expect there will be any benefit to using Freeze on a Pandora build though...everyone should have basically the same software library set.
 
Last edited by a moderator:
Of the more active projects that deal with freezing, PyInstaller is the most interesting. I do hope it grows some support for mac, to replace the aging py2app.

[edit]
Forgot to add: The structure with one python file to start up the program/game and the rest in modules(directories) is good practice in general and is used by most python developers. It matters when other developers take your code and use/port it, users still get their .pnd.
 
So bottom line is I dont need worry about it until I get it all working :)
Good to know...

Now... back to waiting for them to be built...........
 
Last edited by a moderator:
CyruzDraxs said:
For 'compiling' Python scripts on linux there is Freeze, which is good for including dependencies, so users don't need to have all of them available already on their system. I don't expect there will be any benefit to using Freeze on a Pandora build though...everyone should have basically the same software library set.

You might get a performance gain, might you not?
And, iirc, the only libs on the pandora that you can rely on being there so far are the SDL libraries and libc, nothing else has been confirmed as far as I know.

LiquidG said:
So bottom line is I dont need worry about it until I get it all working :)
Good to know...

Now... back to waiting for them to be built...........



If it works on your Linux PC, or if you only use pygame and it works on your Windows PC, then it WILL work on the pandora, 99% chance, if you just add the libraries you need.
 
Last edited by a moderator:
'dflemstr' said:
You might get a performance gain, might you not?
Unfortunately, there's no performance to be gained. All freezers do is bundle the interpreter and everything the app needs inside a .exe or some other executable.
 
Last edited by a moderator:
sindbad said:
'dflemstr' said:
You might get a performance gain, might you not?
Unfortunately, there's no performance to be gained. All freezers do is bundle the interpreter and everything the app needs inside a .exe or some other executable.

Oh, I see. That kind of sucks. But I guess that you have to make the Reflection-libraries of Python (aka "self-modifying code") work...

But what about JIT? (sorry if this goes a bit off-topic, but I have always had the impression that Python is slow and am interested in a way to avoid that slowness; not that I would be using it (because the libs I need are elsewhere) but anyways)
 
Last edited by a moderator:
'dflemstr' said:
'sindbad' said:
'dflemstr' said:
You might get a performance gain, might you not?
Unfortunately, there's no performance to be gained. All freezers do is bundle the interpreter and everything the app needs inside a .exe or some other executable. Oh, I see. That kind of sucks. But I guess that you have to make the Reflection-libraries of Python (aka "self-modifying code") work...There's no reflection libraries in python. The python interpreter is capable of any introspection imaginable upon python code. For example, functions have the func_code attribute, which holds the (byte)code for the function. Which you can change.
Frozen python modules behave just like their script counterpards, except for some path and current directory differences.
'dflemstr' said:
But what about JIT? (sorry if this goes a bit off-topic, but I have always had the impression that Python is slow and am interested in a way to avoid that slowness; not that I would be using it (because the libs I need are elsewhere) but anyways)
Most of the time you won't feel that slowness. If you do, there is a JIT for CPython called psyco, but it's x86 only and almost impossible to port to ARM. The PyPy project has a JIT in development that would be easy to port to ARM, but pypy itself is not quite ready for the limelight.
The best thing you have is probably Cython. It generates portable C modules from pseudo-python.
 
Last edited by a moderator:
sindbad said:
There's no reflection libraries in python. The python interpreter is capable of any introspection imaginable upon python code. For example, functions have the func_code attribute, which holds the (byte)code for the function. Which you can change.
Well, yes, that's what I ment, basically :p
If you were to compile python to machine code, you'd either have to make some kind of meta-header in the binary that contained the bytecode along with function headers (à la MS .NET) which would get very complicated.
 
Last edited by a moderator:
'dflemstr' said:
'sindbad' said:
There's no reflection libraries in python. The python interpreter is capable of any introspection imaginable upon python code. For example, functions have the func_code attribute, which holds the (byte)code for the function. Which you can change.
Well, yes, that's what I ment, basically :p
If you were to compile python to machine code, you'd either have to make some kind of meta-header in the binary that contained the bytecode along with function headers (à la MS .NET) which would get very complicated.Nah, freezers just package the python bytecode. It would be really hard to statically compile python code (or any other dynamic enough language for that matter) for other reasons as well. Take a look at Skedskin.
 
Last edited by a moderator:
sindbad said:
'dflemstr' said:
'sindbad' said:
There's no reflection libraries in python. The python interpreter is capable of any introspection imaginable upon python code. For example, functions have the func_code attribute, which holds the (byte)code for the function. Which you can change.
Well, yes, that's what I ment, basically :p
If you were to compile python to machine code, you'd either have to make some kind of meta-header in the binary that contained the bytecode along with function headers (à la MS .NET) which would get very complicated.Nah, freezers just package the python bytecode. It would be really hard to statically compile python code (or any other dynamic enough language for that matter) for other reasons as well. Take a look at Skedskin.
Yes, yes, I know :p
That's why I posted the post in the first place.

And to not make this post entirely useless:
I prefer not working in Python (for many reasons that I don't want to go through, but rest assured, ye fanboyz of Python (;)), I still LIKE the language), but I kind of like the pygame library.
What currently I'm looking for is a similar library, but for Java (of all things) because I have a specific project in mind, and was just wondering if there was some game library similar to pygame (with material- and object abstraction, not neccessarily scene-nodes which are a PITA anyways) that would make it possible to simplify this project I've planned quite a bit. Any suggestions?
 
Last edited by a moderator:
Back
Top