Python in Game Development
Denis Kovalev
Software Developer at DataArt
About me
Why Python?
Existing “Python” games
GUI
2D
3D
Pygame
+ SDL (Simple Directmedia Layer) library
+ Stable and well-documented
+ Examples and tutorials
- Not pythonic
+ Easy & powerful
Pygame Drawing Concept
Create window
Pygame “Hello, World!”
Pygame key press
Pygame surfaces
Pygame objects collision
Pygame Sprites - create
Pygame Sprites - move
Pygame Sprites
Python Physics Engines
PyODE (Python bindings for The Open Dynamics Engine)
pyBox2D
Panda3D
Pymunk Physics Engine
Pymunk basics
Pygame + Pymunk
Pyglet
Cocos2d
+ No dependencies
+ Pythonic
+ Images, audio, video in any format
- Not for games
+ Pyglet-based
+ For games, apps, GUI interaction
- Poor API docs
- Google does not help
+ OpenGL interface
+ Layers and scenes
Pygame vs Pyglet
Pygame vs Pyglet
Showtime!
Prerequisites
Python 2.6, 2.7, 3.3+
pip install --upgrade http://pyglet.googlecode.com/archive/tip.zip
pip install cocos2d
Download images from http://bit.ly/pycon_game
Map editors
Tiled - http://www.mapeditor.org
+ PyTMX
FIFE - http://www.fifengine.net
FIFE + Python = https://github.com/fifengine/python-tutorials
“Unknown Horizons”
“Zero-Projekt”
Examples and games
pyvolley (cocos2d, pymunk) -
https://github.com/aikikode/pyvolley
Minecraft in Python (pyglet, OpenGL) -
https://github.com/boskee/Minecraft
“Nautili” (PyGame, Tiled)
https://github.com/aikikode/nautili
pyhammerfight (cocos2d, pymunk) -
https://github.com/aikikode/pyhammerfight
Presentation examples - https://bitbucket.org/aikikode/pygame_examples
Thanks to
Thanks for your attention!
Questions?