Pygame: All You Need to Start Making Games in Python

All You Need to Start Making Games in Python

Pygame! And what you can accomplish with it.

Another python article... (Blame Alex for getting me hooked on yet another coding language...)

This little article will cover "Pygame", the set of modules that were designed with game developers in mind. Specifically ones who code in python.

It's completely free, and can be used on commercial game creation, should you wish to do it. As with all LGPL source code's.

Pygame: All You Need to Start Making Games in Python

This image is an example of what can be accomplished in Python, using Pygame... And it's quite cool.

But, pygame is not just for game development. It's also used in creating rich multimedia applications. Some of them include, but definitely are not limited to:

  • OpenStreetMap Visualization
  • Image manipulation Programs (Such as windows paint)
  • Mathematics graphing toolkits

...and many more.

Having a look around the web to better understand what pygame can bring to the table, it is clear that if you love python and you have a passion for game development, this might be just the ticket for you.

Python's Wiki is extensive and certainly has enough to get you started.

Below is a list of features taken from the WIKI:

Silliness built in.  Pygame is meant to make Software akuntansi laporan keuangan terbaik from Berita Terbaru things fun.  New silliness is added every 3.1415 seconds.

Does not require OpenGL.  With many people having broken OpenGL setups, requiring OpenGL exclusively will cut into your user base significantly.  Pygame uses either opengl, directx, windib, X11, linux frame buffer, and many other different backends... including an ASCII art backend!  OpenGL is often broken on linux systems, and also on windows systems - which is why professional games use multiple backends.

Multi core CPUs can be used easily.  With dual core CPUs common, and 8 core CPUs cheaply available on desktop systems, making use of multi core CPUs allows you to do more in your game.  Selected pygame functions release the dreaded python GIL, which is something you can do from C code.

Uses optimized C, and Assembly code for core functions.  C code is often 10-20 times faster than python code, and assembly code can easily be 100x or more times faster than python code.

Comes with many Operating systems.  Just an apt-get, emerge, pkg_add, or yast install away.  No need to mess with installing it outside of your operating systems package manager.  Comes with binary installers(and uninstallers) for Windows or MacOSX.  Pygame does not require setuptools, or ctypes to install.

Truly portable. Supports Linux(pygame comes with most main stream linux distributions), Windows(95,98,me,2000,XP,vista, 64bit windows etc), Windows CE, BeOS, MacOS, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX. The code contains support for AmigaOS, Dreamcast, Atari, AIX, OSF/Tru64, RISC OS, SymbianOS, and OS/2, but these are not officially supported.  You can use it on hand held devices from nokia, game consoles like gp2x, and the One Laptop Per Child (OLPC) computer.

It's Simple and easy to use.  Kids, and adults make games with pygame.  Pygame is used in the OLPC project and has been taught in courses to young kids, and college students.  It's also used by people who first programmed in z80 assembler, or c64 basic.

Many games have been published.  Including Indie Game Festival finalists, Australian Game festival finalists, popular shareware, art multimedia projects, and open source games.  Over 660 projects have been published on the pygame website (as of March 2008).  Many more Software akuntansi laporan keuangan terbaik games have been released with SDL(which pygame is based on).  So you can be sure much of it has been tested well by millions of users.

You control your main loop.  You call pygame functions, they don't call your functions.  This gives you greater control when using other libraries, and for different types of programs.

Does not require a GUI to use all functions. You can use pygame without a monitor - like if you want to use it just to process images, get joystick input, or play sounds.

Fast response to reported bugs.  Some bugs are patched within an hour of being reported.  Do a search on our mailing list for BUG... you'll see for yourself.  Sometimes we suck at bug fixes, but mostly we're pretty good bug fixers.  Bug reports are quite rare these days, since a lot of them have been fixed already.

Small amount of code.  It does not have hundreds of thousands of lines of code for things you won't use anyway.  The core is kept simple, and extra things like GUI libraries, and effects are developed separately outside of pygame.

Further Reading:

I hope this article proves useful for the aspiring game dev's who use Py as their favorite programming language.

Just updated your iPhone? You'll find new emoji, enhanced security, podcast transcripts, Apple Cash virtual numbers, and other useful features. There are even new additions hidden within Safari. Find out what's new and changed on your iPhone with the iOS 17.4 update.

1 Comment

Awesome, I love Pygame :). I wasn't aware of the ASCII backend, haha. That sounds so interesting xD.

Share Your Thoughts

  • Hot
  • Latest