Game Frameworks and Libraries

Before we can continue, do note the title of this section. When it comes to making games, there is a difference between an engine and a framework. Engine provides you with things like collision and graphics. a framework does not. They are often created for one specific goal and can only fulfill tasks similar to the original exigence. I point this out because a lot of people seem to misuse the terms and that has been bothering me for some time.

A Delicate Warning

If you are coming to Python from a language like BGT, I urge you not to take shortcuts. Learn the actual language. Figure out why classes with actual methods are important. Understand inheritance. Don't look for things that you are familiar with. They exist, but BGT practices paradigm is awful for reasons that will be discussed later. Most of these resources are trivial to make and few provide ease of modification. If you are okay with this, go ahead. Use them. I won't--certainly can't--stop you. However, know that you are already limiting yourself to very specific constraints without writing a single line of code.

Resource Listing

Earwax

Earwax, found here, comes with a lot of features one would typically want for games. Menus, input boxes, basic collision, sound playback, configuration... the only downside is the fact that it makes extending the library rather difficult. Earwax is heavily aimed at those who are comfortable with decorators, going so far as using them to modify its own classes. This is partially why it is so hard to extend. In a nutshell, the presented classes cannot have user-created constructors, which means that any new values created by the user must account for None or the equivalent of being empty. Its discussion thread can be found here, and a bigger example of it being in use can be found here. Though the creator has not officially abandoned the project, he did mention that he was not sure how much more he was willing to add (see post 166 of the earlier thread). The engine uses Pyglet for handling game events, Synthizer for sound output, and Cytolk for providing speech.

Lucia

Lucia found here aims to bridge the gap between BGT and Python by providing identical function names like key_pressed and sound encryption. The framework uses Pygame for handling game events, Sound Lib for sound output, and Accessible Output 2 for providing speech. The library also requires you to write your own game loop and does not provide tools to keep track of framerate. In addition, the underlying sound pool does not support asset caching, which means that sound buffers get loaded into memory every time a sound is ordered to play instead of being reused. Finally, Lucia's utilities for creating menus and receiving user input block, which makes it difficult to use a state stack to propagate events. its discussion thread can be found here, and its development status is somewhere between abandoned and rarely updated. Some examples can be found here and an actual game using the framework can be found here

PyAge

PyAge, found here aims to provide as little as possible with the goal of being agnostic. It offers a state stack, a skeleton of a menu, text input, and the ability to customize almost anything one wishes. By default, PyAge uses Pygame for handling events, Synthizer for sound output, and Cytolk for providing speech. Its discussion thread can be found here, but unfortunately there are no examples within the repository or the linked topic. However, the code is commented and there is a basic explanation of the API usage. Unlike Lucia, PyAge does offer the concept of framerate as well as a screen stack. It also provides the ability to schedule tasks and bind functions to keys, both on a state-by-state basis and globally (regardless of what is currently happening inside the game). It should be noted that the framework heavily relies on the Singleton pattern.

Pygame

Pygame, found here, is a framework designed for creating games using Simple Direct Media Layer (SDL) under the hood. Though not coming with any tools specifically aimed at audio game creation, it allows for the greatest level of customization. There are no official discussion threads, but the documentation contains numerous code snippets and Google can provide larger samples of games made with Pygame. Also do note that you will have to choose sound and speech backends as Pygame does not offer the ability to send messages to a screen reader and its sound support is minimal at best.

Pyglet

Pyglet is one of Pygame's competitors. Found here, it encourages the usage of decorators with the ability to inherit from classes at one's discretion. As with Pygame, Pyglet does not offer specialized tools aimed at audio game creation. However, it does offer a sound backend, OpenAL, which supports binaural audio. pyglet also comes with its own control loop and scheduling functions, automatically keeping track of the provided framerate. There are no official discussion threads, but the documentation contains numerous code snippets and Google can provide larger samples of games made with Pyglet. Do note that you still need to choose a speech and possibly a sound backend if OpenAL is not what you desire when using the framework.

PySDL2

PySDL2, found here, is a set of Python Bindings for Simple Direct Media Layer (SDL). The library is almost identical to its C counterpart and offers little functionality beyond what SDL can do. In exchange, it provides the greatest amount of customization. It should be noted that there are no official discussion threads, and that most of the examples for the library on Google are in C and C++.

So, which one should you use?

I strongly urge using Pygame, Pyglet, or PySDL2. Though having menus is great, it becomes extremely painful to realize that the framework you're using as your game system does not support what you want to do. Even more disparaging is the fact that often than not, what you are using cannot easily be modified. Writing your own system from scratch is the best option, regardless of difficulty. You will know how it functions. You will design specific tools that you could customize to fit your vision. Finally, you will learn what happens under the hood when you create your desired architecture. If you must choose an engine, go with PyAge. It offers very minimal support and leaves most of the implementation up to the user. It offers so little that you may as well write your own module and gain a deeper understanding of game systems in the process.