Sign in to follow this  

Full-Scale RPG in Python using Pygame

This topic is 1967 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

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. Edited by breinygames

Share this post


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

Share this post


Link to post
Share on other sites
[quote name='Daaark' timestamp='1343447828' post='4963854']
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.
[/quote]

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? Edited by breinygames

Share this post


Link to post
Share on other sites
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) [b]IF[/b] 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.

Share this post


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

Share this post


Link to post
Share on other sites

This topic is 1967 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this