pygame 2 released on 20th birthday

Published October 29, 2020
Advertisement

pygame 2.0, the most popular game library for python has been released on its 20th birthday.

What's the best feature of pygame 2? Maybe it's "backwards compatibility". For many, many apps pygame 2 is backwards compatible. Have an pygame app from the year 2000? It will probably work. We still have some known issues and open backwards compatibility issues(see below), but a lot of things work just as they did before. Yes, we still have python 2 support.

How does one summarize the 3306 changes since we started the pygame 2 series in July of 2018 based on patches going back to 2012 and even earlier?

  • Support for Metal, Direct 3d, Vulkan, OpenGL 3.0+ in various profiles (core, compatibility, debug, robust, etc), OpenGL ES, and other modern hardware accelerated video APIs across many platforms.
  • SSE2/Neon assembly image drawing. Much faster drawing routines, image loading, and alpha blending.
  • Type Hints, for code completion (and to help you make the squiggly lines disappear) in editors and IDEs.
  • Code cleanup, using lots of code robustness tools like static analyzers, and automated CI/CD. We've been able to help dozens of people new to community projects contribute. We have lots of work to go on code quality, but we're currently the highest rated Python and highest rate C large project on LGTM.
  • Many, many bug fixes including in our pygame.draw routines, pygame.math(for vectors), and pygame.mask for pixel perfect collision detection.
  • better support for PyPy (the fast JIT based implementation of python). See our milestone Are we pypy yet? No. for our progress on making PyPy the best python for games.
  • libsdl version 2 support. Technically pygame 2.0 still works with SDL 1, but we recommend SDL2 which is vastly improved over SDL1 for most use cases. Probably we will remove SDL 1 support starting pygame 2.1.
  • Touch support (multitouch, gestures, etc)
  • Audio input support (make games with your microphone!).
  • Message alert boxes (Press OK, or Cancel).
  • Better keyboard support. Proper unicode input and IME support.
  • Much improved game controller support.
  • Better image and audio format support. Including: webp, 32bit wav files, and much more reliable mp3 support.
  • Multiple display support, and multiple window support (multi window support is still experimental, more will come in pygame 2.1).
  • Android support through python for android (fork of pygame subset for android). Better documentation, and better support will come in future releases.
  • to make distributing your apps easier, a built in "pyinstaller hook"and compatibility with cxfreeze.
  • binary "wheels" on many platforms and versions of python from the old python 2.7 - to the latest python 3.9 (and with pypy!).
  • lots of quality of life improvements like Surface.fill('black') instead of Surface.fill(pygame.Color(0, 0, 0)). Also keywords are supported for many more function arguments. You can draw rounded corners on rects.
  • plenty of new examples, like python3 -m pygame.examples.font_viewer, and python3 -m pygame.examples.music_drop_fade. Additionally the example source code has been cleaned up a lot to follow a more current python style.
  • Hundreds of documentation improvements, include a new Korean tutorial.
  • a special SCALED mode which takes low pixel games and automatically translates them to a larger window. Imagine your 320x200 resolution game of glorious pixel art... on modern screens that would be a very tiny windows. Now with SCALED it shows up big on a Full HD screen, or even a 4K/8K screen and the translation of mouse coordinates and up-scaling of pixels is done for you (hardware accelerated of course).

That was a summary of some of the goodies in pygame 2. We will be releasing more articles and tutorials on new features as time goes on. You can also look at the previous release notes for more info (see end of this post).

See the full pygame 2 release notes.

Cancel Save
0 likes 2 comments

Comments

a light breeze

SDL 2 is now over seven years old. Glad to see pygame finally starting to catch up, but I hadn't realized it was this far behind. (The last time I used pygame predates SDL 2.)

November 01, 2020 07:11 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement