Wednesday 2:30 p.m.–3 p.m.
Revitalizing Python Game Development: Packaging, Performance, and Platforms
Jacob Kovac
- Audience level:
- Intermediate
- Category:
- Gaming
Description
With the advent of mobile platforms, as well as the prevalence of the GPU, Python has fallen almost entirely out of favor with game developers. However, there are some exciting solutions to the major issues being built on top of the Kivy GUI Framework. This talk will cover the recent developments that make it possible to build high quality, cross-platform games in Python.
Abstract
Python is typically not recommended for games because the existing libraries fail to take advantage of the graphics processing hardware nearly every device contains, and the language itself is often considered “too slow”. In this talk we will cover techniques and methodologies being employed in the Kivy community to build games in Python that make proper use of graphical hardware and benefit from the same architectural trends found in other languages. There are several major areas of concern for game developers: getting their game in front of players on as many platforms at possible, ensuring performance is “good enough” for their vision, and being able to easily incorporate other third-party libraries.
Publishing to the major platforms on the market today is often considered one of the largest pain points of trying to get your Python application in front of a large audience. Once you are beyond simply passing a script file or two around it becomes a major headache, even on platforms that come with a default Python. The only true solution is to package up compiled binaries for your own code, all of your dependencies, and the version of Python your application was built on. We will cover the tools that allow you to package up an application like this for Windows, OSX, Linux, Android, and iOS.
When it comes to game performance, we want to maximize the speed at which we process our objects as a game running at 60 frames per second has only .016 seconds to execute all game logic before we must begin again. These constraints lead us to working directly with low level constructs for efficiency, such as working with an array of structs instead of a list of objects. Cython can help us write performant code while writing the minimum of low-level code. Cython also allows us to more tightly integrate our low-level C code and high-level Python wrapper over it so that we write less code overall and take advantage of all the nice features of Python’s object approach.
Most games are cobbled together using many third-party libraries, from basic functionality such as audio, video, and windowing providers, to heavily specialized libraries intended for games, like physics simulators and particles engines. We will discuss how Kivy’s multi-provider approach to the basic audio, video, and windowing requirements of all games gives Python games an actual advantage over many other development frameworks and prepares your game to handle any platform that may come its way. In addition, we will discuss the software tools that will help you make use of any of the myriad available libraries in the C, C++, Objective-C, and Java languages.
Finally, we will cover how the Entity-Component architecture of engines like Unity3D help in integrating third-party libraries, optimizing performance, and in creating reusable systems that can be recycled from game to game. The benefits of this architectural approach was essential in Unity3D becoming such a widely used and multi-purpose game engine. I will briefly introduce the KivEnt game engine, a Kivy-backed project that brings the power and flexibility of Entity-Component development to Python.