Full-Scale RPG in Python using Pygame

Started by
3 comments, last by jbadams 11 years, 8 months ago
For the last 6 months I've been planning a full-scale 2D rpg. The ideas are great and I have people that are going to help me with sound and art. I'm doing all the programming though because that's my hobby and I love it. I recently started working on it and have come accross some performance issues. I've gone over the small ammount of code I have, and it's very efficient. I decided the problem is the API that i'm using. I'm writting the game in Python using the Pygame library for input and rendering. But Pygame is based off of SDL and is software (not hardware) accelerated. So I'm assuming for such a large and full-scale project, that I should use an API that is hardware accelerated. What are some of your suggestions or ideas? Am I using the wrong language/API? Thanks in advance.

** EDIT **
I forgot to add that I have been doing game programming for almost 3 years now. I'm not claiming to be anything special but I'm not a newbie. I also have experience in Java and C/C++. I've done some basic stuff with SDL and SFML. And I am most definitely willing to learn something new so that wouldn't be an issue. Time is not a big deal for this project, its just a hobby of mine. But I would like to do it the right way.
Advertisement
You can write a full scale anything in any language. PyGame and SDL are more than up to the task.

If you are having performance issues, run your game through a profiler and see where the problem areas are.

You can write a full scale anything in any language. PyGame and SDL are more than up to the task.

If you are having performance issues, run your game through a profiler and see where the problem areas are.


I've done that, everything runs really smoothly other than drawing each individual 'tile' to the screen. I have a giant world, but the program only draws the tiles it needs to on the screen depending on where the 'camera' is. So its never drawing tiles that are off the screen. The screen size is 800x640 with 32x32 tiles. So every frame it is drawing 500 tiles to the screen. I'm not exactly sure how to get around this... It's a tile-based RPG. How can I make it run faster then?
1) Use a profiler so you know what is actually causing you to slow down. No one can guess what is slowing you down.
2) IF your rendering actually is at fault, try some other methods, such as dirty rectangles.
3) Post your rendering code, and your game loop. But I can't help much there, I barely know any python.
You're correct that PyGame doesn't take advantage of any hardware acceleration, and this can be an issue if you're drawing a lot of objects - it'll be an absolute performance killer if any rotation is involved.

Profiling for bottlenecks and implementing more efficient drawing methods as suggested are a good idea that's worth pursuing, but in this particular case it's well known that PyGame can be a cause of performance concerns: you might investigate writing your own OpenGL drawing code, or using PySFML (which uses hardware acceleration) as possible alternatives.

You certainly don't need to abandon your choice of Python.

- Jason Astle-Adams

This topic is closed to new replies.

Advertisement