Python/pygame Vs G++


scyzor

Still Fresh
Joined
Oct 12, 2009
Messages
47
Age
49
Location
Mid-Hudson Valley
Python/Pygame vs G++ (SDL, OpenGL SE) - which one to pick to do some coding for Pandora? Which one for simple APPs and which one for fast 2D/3D graphics with audio?
 
If by G++, you mean c++, then...

Whichever you like. Python is great for simple stuff, but it can't pull off complicated AI and whatnot as quickly as C++ can.
Pygame is literally a Python wrapper around SDL.

For fast 2D / 3D graphics, you probably want a C++ / OpenGL ES (Not SE) setup.
Audio is a bit different. SDL has some audio stuff built-in, but it's pretty basic, and OpenAL is a lot more useful for games.

Of course, neither of those libraries can decode audio, but I think they can load WAVs. So you're limited to WAVs nless you get an external library for loading Vorbis or FLAC or whatever.
 
lulzfish said:
If by G++, you mean c++, then...

Well as G++ is the C++ from gcc, that mean nearly the same (from my pof)

For For a game with fast 2d/3d there is allready a few engine up and running and few other coming along nicely, so why not use one of them instead of re-inventing the wheel once again ?
For a small game, pygames should do the trick
 
Last edited by a moderator:
JackTheKnife said:
Python/Pygame vs G++ (SDL, OpenGL SE) - which one to pick to do some coding for Pandora? Which one for simple APPs and which one for fast 2D/3D graphics with audio?

for simple 2D games of the 8bit and 16bit era you can easily get good performance using Python/Pygame for AI control.

C or C++ will be needed for decent 3D performances or more complex 2D games with physics.
 
Last edited by a moderator:
Are there any good tutorials and books for ARM programming (Python and GCC)? I'm not totally noob with coding (PHP, ANSI C for device drivers/controllers, old Amiga stuff like ASM for MC68000 and AMOS) but I need to find something to start before I will get Pandora :)
 
JackTheKnife said:
Are there any good tutorials and books for ARM programming (Python and GCC)? I'm not totally noob with coding (PHP, ANSI C for device drivers/controllers, old Amiga stuff like ASM for MC68000 and AMOS) but I need to find something to start before I will get Pandora :)

Python is interpreted, so you can install Python / Pygame on a regular x86 computer and the scripts will work the same on the Pandora.
C and C++ are compiled, so they will work with a re-compile for the Pandora, either through a cross-compiler or gcc on the Pandora itself.

The biggest problem is that desktops use OpenGL, and Pandora uses OpenGL ES. There is an ES library floating around somewhere, but it might be simpler to just write ES-compatible code and then port it to ES once you have the Pandora. Basically, use vertex arrays instead of glBegin/glEnd, and either use simple fixed-function stuff for ES 1.1 or do EVERYTHING with shaders for ES 2.0. Look up the ES spec for more information.
 
Last edited by a moderator:
I found some C++ style guides that talked about portability, the one from mozilla looked helpful:

https://developer.mozilla.org/en/C___Portability_Guide
 
I guess (I haven't compiled on ARM) that as long as the ARM compiler can compile the C++ code, everything goes. That means:
  • no x86 assembly
  • library depencies met
  • standard C++ (ie. no extensions to the language that the target compiler doesn't have)

If your code only depends in frameworks readily available for Pandora it will probably run (SDL, OpenGL ES, etc). Also need to keep in mind the resources pandora has (processing power, memory, etc).

Compilers (and programming languages like C) where originally made to be able to use the same code in different architectures. Perhaps since there are so many x86 PCs it's easy to miss that fact in todays world.

EDIT: Hehe, :ph34r: 'ed
Yep, it seems the potential problems are due to compilers. But doesn't using gcc also on Pandora limit some the effect of these portability issues?
 
C++ is designed to be portable between pretty much everything. If you write your code in pure C++, then you can compile it for pretty much any system that has a C++ compiler.
However, then you don't have sound, graphics, unbuffered input (unless you're clever), or any of that good stuff. That's where cross platform libraries come in.
 
"C++" and "portability" used in the same breath?

Ahh, people who've never done mobile or embedded work before :)

jeff

Panda is a standard linux machine, but in general for C++ on embedded machines .. you watch your rtti and exceptions carefully ;)
 
skeezix said:
"C++" and "portability" used in the same breath?

Ahh, people who've never done mobile or embedded work before :)

jeff

Panda is a standard linux machine, but in general for C++ on embedded machines .. you watch your rtti and exceptions carefully ;)


Would be pretty cool if you could do a tutorial :p

An example on how to compile for the pandora would be great.
 
Last edited by a moderator:
skeezix said:
Ahh, people who've never done mobile or embedded work before :)
Did you use a standards compliant compiler for your embedded work, or was it "basically C++ with some differences"? :p
 
Last edited by a moderator:
Stephane Hockenhull said:
JackTheKnife said:
Python/Pygame vs G++ (SDL, OpenGL SE) - which one to pick to do some coding for Pandora? Which one for simple APPs and which one for fast 2D/3D graphics with audio?

for simple 2D games of the 8bit and 16bit era you can easily get good performance using Python/Pygame for AI control.
[...]

On a desktop machine Pygame can be surely used for SNES/MD(Genesis)-style 2D games (with higher resolution of course). However, Python is unfortunately a tad slow. If the Pandora isn't like 10+ times faster than the Wiz, Python won't be of much use, I'm afraid.

Java (with a decent VM) or even JavaScript (with Google's V8 engine) are certainly more interesting.
 
Last edited by a moderator:
sebt3 said:
lulzfish said:
If by G++, you mean c++, then...

Well as G++ is the C++ from gcc, that mean nearly the same (from my pof)

For For a game with fast 2d/3d there is allready a few engine up and running and few other coming along nicely, so why not use one of them instead of re-inventing the wheel once again ?
For a small game, pygames should do the trick
Since C++ is a programming language and G++ is nothing it might make people think your pof more than a bit silly especially since everyone else has a POV unless we are talking about your Premature Ovarian Failure.

Sorry, G++ is not a compiler and g++ is, this aint running DOS.
 
Last edited by a moderator:
aho said:
Stephane Hockenhull said:
JackTheKnife said:
Python/Pygame vs G++ (SDL, OpenGL SE) - which one to pick to do some coding for Pandora? Which one for simple APPs and which one for fast 2D/3D graphics with audio?

for simple 2D games of the 8bit and 16bit era you can easily get good performance using Python/Pygame for AI control.
[...]

On a desktop machine Pygame can be surely used for SNES/MD(Genesis)-style 2D games (with higher resolution of course). However, Python is unfortunately a tad slow. If the Pandora isn't like 10+ times faster than the Wiz, Python won't be of much use, I'm afraid.

Java (with a decent VM) or even JavaScript (with Google's V8 engine) are certainly more interesting.
Um, what the heck are you talking about?
First of all, V8 compiles Javascript to native code, obviously won't work on ARM as it can't execute x86 instructions.
As for Java vs. Python, Java is not much faster, if at all, than Python.

Also, any library you use for programming games is not actually written in Python, it'll be written in C++ with Python bindings, so the library will be extremely fast already. Any performance issues you have with Python you can resolve by rewriting specific parts of your code in C++, AFTER you have gotten performance metrics and you know which areas need performance tuning.

What's with all this Python negativity? Especially in support of Java?
 
Last edited by a moderator:
I believe in simplicity. Requiring a program to run my program seems a little silly to me. Although I am willing to give Python a bit more credit than Java because Python's wrapper is a lot less bloated.
 
Aethix said:
I believe in simplicity. Requiring a program to run my program seems a little silly to me. Although I am willing to give Python a bit more credit than Java because Python's wrapper is a lot less bloated.
I believe in simplicity. Requiring a compiler to compile my code seems a little silly to me. Although I am willing to give C++ a bit more credit than machine code because I feel like it is a little higher level.
 
Last edited by a moderator:
Back
Top