Jump to content
  • Advertisement
Sign in to follow this  
AniMerrill

Performance issues with Pyglet? Alternatives?

This topic is 2218 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites


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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!