Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6026651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:28:35+00:00 2026-05-23T04:28:35+00:00

I am writing a simple top down RPG in Pygame, and I have found

  • 0

I am writing a simple top down RPG in Pygame, and I have found that it is quite slow…. Although I am not expecting python or pygame to match the FPS of games made with compiled languages like C/C++ or even Byte Compiled ones like Java, but still the current FPS of pygame is like 15. I tried rendering 16-color Bitmaps instead of PNGs or 24 Bitmaps, which slightly boosted the speed, then in desperation, I switched everything to black and white monochrome bitmaps and that made the FPS go to 35. But not more. Now according to most game development books I have read, for a user to be completely satisfied with game graphics, the FPS of a 2d game should at least be 40, so is there ANY way of boosting the speed of pygame?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:28:36+00:00Added an answer on May 23, 2026 at 4:28 am

    Use Psyco, for python2:

    import psyco
    psyco.full()
    

    Also, enable doublebuffering. For example:

    from pygame.locals import *
    flags = FULLSCREEN | DOUBLEBUF
    screen = pygame.display.set_mode(resolution, flags, bpp)
    

    You could also turn off alpha if you don’t need it:

    screen.set_alpha(None)
    

    Instead of flipping the entire screen every time, keep track of the changed areas and only update those. For example, something roughly like this (main loop):

    events = pygame.events.get()
    for event in events:
        # deal with events
    pygame.event.pump()
    my_sprites.do_stuff_every_loop()
    rects = my_sprites.draw()
    activerects = rects + oldrects
    activerects = filter(bool, activerects)
    pygame.display.update(activerects)
    oldrects = rects[:]
    for rect in rects:
        screen.blit(bgimg, rect, rect)
    

    Most (all?) drawing functions return a rect.

    You can also set only some allowed events, for more speedy event handling:

    pygame.event.set_allowed([QUIT, KEYDOWN, KEYUP])
    

    Also, I would not bother with creating a buffer manually and would not use the HWACCEL flag, as I’ve experienced problems with it on some setups.

    Using this, I’ve achieved reasonably good FPS and smoothness for a small 2d-platformer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a simple app that's going to have a tiny form sitting in
I am writing a simple Python web application that consists of several pages of
I'm writing a simple OpenGL application that uses GLUT . I don't want to
I am currently writing a simple, timer-based mini app in C# that performs an
I am writing a simple database with web access. I have previous experience with
I am writing simple hex engine for action-rpg in XNA 3.1. I want to
Let's say I have the following simple query SELECT TOP 1 name FROM months
I'm writing a simple Python parser, where I loop over each line in a
I'm a bit confused. I'm writing a very simple file system that basically: -reads
this seems like a simple problem. I have a canvas application that I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.