Files
awesome-python/website/data/category_intros/game-development.md
T
Vinta ChenandClaude 432a25e384 docs: add Game Development category intro
The page had no guidance on which Python game library to pick. Recommends pygame-ce over upstream pygame, which fails to install on Python 3.14 (no cp314 wheel, open issues #4627/#4810).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-27 02:43:41 +08:00

4.4 KiB

A 2D game needs a loop: write your own with pygame-ce, the Python game development library, or let Arcade run it. Panda3D does 3D, and Ren'Py visual novels.

How to choose:

  • 2D game where you write the game loop: pygame-ce
  • 2D game with a ready-made loop and physics engines: Arcade
  • 3D game: Panda3D
  • Visual novel or life simulation game: Ren'Py
  • Windowing, OpenGL graphics, and sound with no other dependencies: pyglet

pygame-ce is the community edition of pygame, a fork by its former core developers that aims for more frequent releases. Your code still says import pygame, so if pygame is already installed, uninstall it first, then run pip install pygame-ce in a virtual environment. Its quick start gives you full control of the game loop: handle events, draw the frame, flip() the display, and cap the frame rate with clock.tick(). Convert each image once after you load it, with convert(), or convert_alpha() if it has transparency, so it blits fast. It's under the LGPL, and its README says closed-source and commercial games are fine.

Arcade is an easy-to-learn library for 2D games, built on pyglet and OpenGL, and meant for beginning programmers too. Start with the Platformer Tutorial: you subclass arcade.Window, draw in on_draw(), and arcade.run() runs the loop until the window closes. For movement and collisions, it comes with physics engines for top-down and platformer games. Its code is MIT, and its built-in assets need no attribution, so you can ship them in a commercial game.

Panda3D is a 3D engine written in C++ with Python bindings, and its manual says it's a tool for skilled programmers, not beginners. Install it with pip install panda3d, subclass ShowBase, and call run(), which holds the main loop. Its build_apps tool builds self-contained executables for Windows, Linux, and macOS without needing each system. It's BSD, free for commercial games.

Ren'Py is a visual novel engine with its own script language, for stories that run on computers and mobile devices. It isn't a pip package: download Ren'Py and run its launcher, create a project there, and write your story in script.rpy. Python works inside the scripts, and third-party pure-Python packages go in game/python-packages. Ship with Build Distributions in the launcher, which also builds a package for itch.io and Steam. Most of Ren'Py is MIT, but some parts are LGPL, so distribute your game in a way that satisfies the LGPL.

pyglet is a windowing and multimedia library with no external dependencies, written in pure Python: windows, input, OpenGL graphics, images, video, and sound. Start with Writing a pyglet application, which attaches handlers with @window.event and calls pyglet.app.run(). Draw through a Batch, since the docs say you always want batched rendering for performance. It's under the BSD license.

Move things by the time since the last frame, so your game runs at the same speed at any frame rate. pygame-ce's quick start gets it in seconds by dividing clock.tick() by 1000, pyglet passes it as dt to scheduled functions, and Arcade passes it as delta_time to on_update().