Jump to content

  • Log In with Google      Sign In   
  • Create Account


Performance issues with Pyglet? Alternatives?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 AniMerrill   Members   -  Reputation: 203

Like
0Likes
Like

Posted 16 July 2013 - 06:49 PM

I'm going to ask a question here I asked over at StackOverflow just because I'm not really getting an answer over there. :/

 

Basically I've been avoiding Python for my game just because its supposed to have a lot of performance issues. I actually bought a book today that demonstrates how to do some basic programming with C and the SDL/OpenGL libraries (partially just because I've always wanted to learn C anyway, for fun) when I noticed somewhere Pygame is actually backed up by having most of the SDL be in C, and it just acts as a wrapper.

 

I heard Pyglet was a good tool for using OpenGL which I'd rather use, both for specific features and just general performance from being hardware accelerated, but I noticed that it was written in "pure" Python. Is Pyglet known for having performance issues? Has anyone here used it to any great effect?

 

And since I'm going to be learning it anyway, if Pyglet DOES have issues since its all Python, what are my best alternatives for getting OpenGL in Python with maybe some C to back up the performance?

 

Thanks!


AniMerrill, a.k.a. Ethan Merrill


Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 6684

Like
1Likes
Like

Posted 17 July 2013 - 12:06 AM

There are not really general performance issues with languages, you always need to consider the context. Even most hi-performance engines like UDK use slower scripting languages ingame to perform certain tasks. So you need to define your goal first and then choose a suitable language (there will be always a lot of options). If performance would be all we need, all games would be most likely writting in asm by a handful of uber-experts smile.png

 

If you want to learn this language with a small test project/game, then just do it. Many performance issues come from using wrong data structures, bad coding styles or badly suited algorithms and not directly from the language. happy.png


Edited by Ashaman73, 17 July 2013 - 12:08 AM.


#3 Hodgman   Moderators   -  Reputation: 27494

Like
0Likes
Like

Posted 17 July 2013 - 01:54 AM

AFAIK you can use OpenGL via PyGame as well, right?
 

Is Pyglet known for having performance issues? Has anyone here used it to any great effect?

I've never used it, but it was initially made as a university project by a guy with no games industry experience, so I'd expect performance to be typical of "academia" ;) tongue.png

Edited by Hodgman, 17 July 2013 - 01:55 AM.


#4 KnolanCross   Members   -  Reputation: 1158

Like
0Likes
Like

Posted 17 July 2013 - 06:47 AM

If you need to optimize the code you must first learn to profile, then you can use cython: http://docs.cython.org/src/quickstart/cythonize.html

 

But I believe you will hardly need this, most engines use script language to access their core (that are written in C or C++) and perform quite well.


My blog on programming and games.
http://16bitsflag.blogspot.com.br/

#5 smr   Members   -  Reputation: 1552

Like
0Likes
Like

Posted 17 July 2013 - 08:53 AM

Note that pygame and pyglet are not game engines. They are APIs. A full engine with bindings to python could perform very well. Check out PyOGRE (not a full game engine, but a powerful 3D graphics engine) and Panda3D (full game engine).



#6 swiftcoder   Senior Moderators   -  Reputation: 9583

Like
2Likes
Like

Posted 17 July 2013 - 08:40 PM

I've never used it, but it was initially made as a university project by a guy with no games industry experience, so I'd expect performance to be typical of "academia" ;) tongue.png

I wrote a planet renderer with it...

But then again, the planet renderer is pretty much all GPU-side. One could probably get away with write the CPU-side portion in bashscript.

Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]


#7 Goran Milovanovic   Members   -  Reputation: 1103

Like
1Likes
Like

Posted 20 July 2013 - 10:42 PM


Basically I've been avoiding Python for my game just because its supposed to have a lot of performance issues.

 

I've read somewhere that Python is, on average, around 20x slower than C, with the "worst case" scenarios reaching as high as 100x.

 

These measures, if true, seem unforgivably high, but in most cases, I think it basically reduces down to "the speed of light vs the speed of sound" argument: The speed of sound is ~880991x slower than the speed of light, but this is only obvious in specific circumstances, and it's only then that it actually matters.

 

So, if I were you, I would consider theoretical execution speed to be irrelevant, until it actually becomes a problem (which might be never).


+---------------------------------------------------------------------+

| Need a programmer?        ->   http://www.nilunder.com/protoblend   |

| Want to become one?       ->   http://www.nilunder.com/tutoring     |
| Game Dev video tutorials  ->   http://www.youtube.com/goranmilovano |
+---------------------------------------------------------------------+

#8 BurrickSlayer   Members   -  Reputation: 183

Like
0Likes
Like

Posted 21 July 2013 - 12:08 PM

If performance becomes an issue, you could give PyPy a try. Of course, you could give PyPy a try without having any performance issues, as well. smile.png

According to the PyPy compatibility page pyglet works fine with PyPy. This is only true for pyglet 1.1.4, though, as PyPy doesn't support Python 3 yet.

Here is the most recent status update for the py3k branch of PyPy (the branch that adds support for Python 3) in case you're interested:
http://morepypy.blogspot.se/2013/06/py3k-status-update-11.html




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS