Pygame

Original author(s)| Lenard Lindstrom, René Dudfield, Pete Shinners, Nicholas Dudfield, Thomas Kluyver, and others[1]
Developer(s)| Pygame Community
Initial release| 28 October 2000; 25 years ago (2000-10-28)[2][3]
Stable release|

2.6.1 / 30 September 2024; 19 months ago (2024-09-30)[4]

Written in| Python, C, Cython, and Assembly[5][6]
Operating system| Cross-platform
Type| API
License| GNU Lesser General Public License

Pygame is a cross-platform set of Python modules designed for writing video games. It includes computer graphics and sound libraries designed to be used with the Python programming language.[7]

## Contents

* 1 History
* 2 Development of version 2
* 3 Features
* 4 Community
* 5 Sample code
* 6 Notable games using Pygame
* 7 See also
* 8 Notes
* 9 References
* 10 External links

## History

Pygame was originally written by Pete Shinners to replace PySDL after its development stalled.[2][8] It has been a community project since 2000[9] and is released under the free software GNU Lesser General Public License[5] (which "provides for Pygame to be distributed with open source and commercial software"[10]).

## Development of version 2

Pygame version 2 was planned as "Pygame Reloaded" in 2009, but development and maintenance of Pygame completely stopped until the end of 2016 with version 1.9.1. After the release of version 1.9.5 in March 2019, development of a new version 2 was active on the roadmap.[11]

Pygame 2.0 released on 28 October 2020, Pygame's 20th anniversary.[12]

## Features

Pygame uses the Simple DirectMedia Layer (SDL) library,[lower-alpha 1] with the intention of allowing real-time computer game development without the low-level mechanics of the C programming language and its derivatives. This is based on the assumption that the most expensive functions inside games can be abstracted from the game logic, making it possible to use a high-level programming language, such as Python, to structure the game.[5]

Other features that SDL does have include vector math, collision detection, 2D sprite scene graph management, MIDI support, camera, pixel-array manipulation, transformations, filtering, advanced freetype font support, and drawing.[13]

Applications using Pygame can run on Android phones and tablets with the use of Pygame Subset for Android (pgs4a).[14] Sound, vibration, keyboard, and accelerometer are supported on Android.[15]

## Community

Following disagreements between former core developers and the repository owner, a fork known as pygame-ce (Community Edition) was created.[16]

There is a regular competition, called PyWeek, to write games using Python (and usually but not necessarily, Pygame).[17][18][19] The community has created many tutorials for Pygame.[20][21][22][23][24]

## Sample code

The following code makes an image of a raccoon("raccoon.png") bounce when hitting an edge.

import pygame, sys

pygame.init()
screen = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock()
clock.tick(30)
black = 0, 0, 0
raccoon = pygame.image.load("raccoon.png")
raccoon = pygame.transform.scale(raccoon, (200, 140))
raccoonrect = raccoon.get_rect()
velocity = [1, 1]

while True:
raccoonrect = raccoonrect.move(velocity)
if raccoonrect.left < 0 or raccoonrect.right > 1280:
velocity[0] = -velocity[0]
raccoon = pygame.transform.flip(raccoon, True, False)
if raccoonrect.top < 0 or raccoonrect.bottom > 720:
velocity[1] = -velocity[1]
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
# screen update
screen.fill(black)
screen.blit(raccoon, raccoonrect)
pygame.display.flip()

## Notable games using Pygame

* Frets on Fire[25]
* Dangerous High School Girls in Trouble![26]

## See also

* Cocos2d
* Panda3D
* Pyglet

## Notes

1. ↑ Pygame 2 and later versions are based on SDL2, while earlier releases were based on SDL1.[27]

## References

1. ↑ "Contributors to Pygame". GitHub. https://github.com/pygame/pygame/graphs/contributors.
2. ↑ 2.0 2.1 Shinners, Pete. "Python Pygame Introduction - History". http://www.pygame.org/docs/tut/PygameIntro.html.
3. ↑ "Downloads - Pygame - Python game development". https://pypi.python.org/pypi/Pygame/.
4. ↑ "PyGame 2.6.1 - Python 3.13 bugfix release". https://github.com/pygame/pygame/releases/tag/2.6.1.
5. ↑ 5.0 5.1 5.2 "About Pygame". GitHub. https://www.pygame.org/wiki/about.
6. ↑ "GettingStarted". https://www.pygame.org/wiki/GettingStarted.
7. ↑ Alam, Imran (2023-07-02). "How to Implement a Dialogue System in Pygame" (in en). https://www.makeuseof.com/implement-dialogue-system-in-pygame/.
8. ↑ "pySDL sourceforge page". https://sourceforge.net/projects/pysdl/.
9. ↑ "commit by other authors". GitHub. https://github.com/pygame/pygame/commit/a4e0f865c591980e7aa2a160a92a2c9098a678ec.
10. ↑ "Pygame Front Page — pygame v2.0.1.dev1 documentation". https://www.pygame.org/docs/.
11. ↑ "pygame 1.9.5 released into the wilds". https://www.pygame.org/news/2019/3/1-9-5-released-into-the-wilds.
12. ↑ "pygame 2.0 - the happy dance birthday release". GitHub. https://github.com/pygame/pygame/releases/tag/2.0.0.
13. ↑ "Pygame docs". https://www.pygame.org/docs/.
14. ↑ "Example of using RAPT to package pygame(_sdl2) games.: renpytom/rapt-pygame-example". GitHub. 1 April 2019. https://github.com/renpytom/rapt-pygame-example.
15. ↑ "API — Pygame Subset for Android". http://pygame.renpy.org/api.html.
16. ↑ "pygame - Community Edition". https://pypi.org/project/pygame-ce/.
17. ↑ "PyWeek - Python Game Programming Challenge". http://www.pyweek.org/.
18. ↑ Gee, Sue (29 March 2013). "Why PyWeek: An Interview with Richard Jones". https://www.i-programmer.info/professional-programmer/i-programmer/5697-why-pyweek-an-interview-with-richard-jones-.html.
19. ↑ "PyWeek - Python Wiki". https://wiki.python.org/moin/PyWeek.
20. ↑ "pygame documentation: Tutorials". http://www.pygame.org/docs/.
21. ↑ Siddiqi (2020-06-27). "Python Game projects with source code" (in en-US). https://coderslegacy.com/python-game-projects-with-source-code/.
22. ↑ Shinners, Pete. "Line by line tutorial - Tutorial for beginners". http://pygame.org/docs/tut/chimp/ChimpLineByLine.html.
23. ↑ "Creating Games with Python - A tutorial explaining how to use pygame for game development and improved execution". http://www.linuxjournal.com/article/7694.
24. ↑ "Arinoid tutorials video tutorials at ShowMeDo". http://showmedo.com/videos/series?name=pythonArellanoPyGameSeries.
25. ↑ "fretsonfire/src at master · skyostil/fretsonfire" (in en). https://github.com/skyostil/fretsonfire.
26. ↑ "Dangerous High School Girls in Trouble!". http://pygame.org/project-Dangerous+High+School+Girls+in+Trouble!-791-.html.
27. ↑ "pygame 1.9.5 released into the wilds". https://www.pygame.org/news/2019/3/1-9-5-released-into-the-wilds.

## External links

* No URL found. Please specify a URL here or add one to Wikidata.
* Pygame newsgroup (web access) \- the "official"
* Pygame Subset for Android (PGS4A)
* pyOpenGL \- Python OpenGL Bindings
* Pygame-SDL2 \- a reimplementation of Pygame APIs on top of SDL2
* PySDL2 \- a wrapper around the SDL2 library similar to the discontinued PySDL project

* v
* t
* e

Game engines (list)

* Source port
* First-person shooter engine
* list
* Game engine recreation
* list
* Game creation system
* List of visual novel engines

Free and
open-source|

| 2D|

* Adventure Game Studio
* Beats of Rage
* Cocos2d
* Corona
* Moai
* OHRRPGCE
* OpenFL
* ORX
* Pygame
* Ren'Py
* Stencyl
* Stratagus

|

2.5D|

* Build
* Doom ports
* ORX

3D|

* Away3D/AwayJS
* Cafu
* GamePlay
* GLScene
* Horde3D
* Irrlicht
* JMonkey
* OGRE
* Panda3D
* Platinum Arts Sandbox
* PlayCanvas
* Torque
* Xenko

Mix|

* Allegro
* Godot
* libGDX
* Lightweight Java Game Library
* Spring

Proprietary|

| 2D|

* Clickteam Fusion
* Construct
* Felgo (V-Play Engine)
* GameMaker Studio
* GameSalad
* RPG Maker
* UbiArt Framework
* Vicious
* Zillions of Games

|

3D|

* 4A
* Amazon Lumberyard
* AnvilNext
* Chrome
* Creation
* CryEngine
* Crystal Tools
* Decima
* Diesel
* Disrupt Engine
* Dunia Engine
* Ego
* Essence
* Fox
* Frostbite
* HeroEngine
* id Tech
* 5
* 6
* 7
* Ignite
* IW
* LithTech
* Luminous Studio
* MT Framework
* PhyreEngine
* REDengine
* RAGE
* Shark 3D
* ShiVa
* Snowdrop
* Source
* Unigine
* Unreal

Mix|

* Gamebryo
* Unity

Historical
(Free and
open-source)|

| 2D|

* Thousand Parsec
* Vassal
* Xconq

|

2.5D|

* Doom engine

3D|

* Blender Game
* Bork3D
* Crystal Space
* CyanWorlds.com Engine
* Delta3D
* Dim3
* Genesis3D
* id Tech
* Quake
* Quake II
* 3
* 4
* Open Wonderland
* Papervision3D
* PLIB

Mix|

* Wintermute Engine

Historical
(Proprietary)|

| 2D|

* Game-Maker
* GameMaker
* Garry Kitchen's GameMaker
* Genie
* MADE
* M.U.G.E.N
* SCUMM
* Southpaw
* Virtual Theatre

|

3D|

* Bitsquid
* C4
* Dark
* Enigma
* Flare3D
* GoldSrc
* Filmation
* Freescape
* INSANE
* Jade
* Jedi
* LyN
* Marmalade
* Panta Rhei
* Pie in the Sky
* Q
* Reality Lab
* RenderWare
* SAGE
* Silent Storm
* Sim RPG Maker
* Sith
* Titan
* Truevision3D
* Vision
* Visual3D
* Voxel Space
* XnGine
* Zero

Proprietary
middleware|

* Euphoria
* Gameware
* GameWorks
* Havok
* iMUSE
* Kynapse
* SpeedTree
* FaceGen

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Pygame. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Software:Pygame&oldid=3964405"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template