Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 23202

Real Python: Top Python Game Engines

$
0
0

Like many people, maybe you wanted to write video games when you first learned to code. But were those games like the games you played? Maybe there was no Python when you started, no Python games available for you to study, and no game engines to speak of. With no real guidance or framework to assist you, the advanced graphics and sound that you experienced in other games may have remained out of reach.

Now, there’s Python, and a host of great Python game engines available. This powerful combination makes crafting great computer games much easier than in the past. In this tutorial, you’ll explore several of these game engines, learning what you need to start crafting your own Python video games!

By the end of this article, you’ll:

  • Understand the pros and cons of several popular Python game engines
  • See these game engines in action
  • Understand how they compare to stand-alone game engines
  • Learn about other Python game engines available

To get the most out of this tutorial, you should be well-versed in Python programming, including object-oriented programming. An understanding of basic game concepts is helpful, but not necessary.

Ready to dive in? Click the link below to download the source code for all the games that you’ll be creating:

Get Source Code:Click here to get the source code you’ll use to try out Python game engines.

Python Game Engines Overview

Game engines for Python most often take the form of Python libraries, which can be installed in a variety of ways. Most are available on PyPI and can be installed with pip. However, a few are available only on GitHub, GitLab, or other code sharing locations, and they may require other installation steps. This article will cover installation methods for all the engines discussed.

Python is a general purpose programming language, and it’s used for a variety of tasks other than writing computer games. In contrast, there are many different stand-alone game engines that are tailored specifically to writing games. Some of these include:

These stand-alone game engines differ from Python game engines in several key aspects:

  • Language support: Languages like C++, C#, and JavaScript are popular for games written in stand-alone game engines, as the engines themselves are often written in these languages. Very few stand-alone engines support Python.
  • Proprietary scripting support: In addition, many stand-alone game engines maintain and support their own scripting languages, which may not resemble Python. For example, Unity uses C# natively, while Unreal works best with C++.
  • Platform support: Many modern stand-alone game engines can produce games for a variety of platforms, including mobile and dedicated game systems, with very little effort. In contrast, porting a Python game across various platforms, especially mobile platforms, can be a major undertaking.
  • Licensing options: Games written using a stand-alone game engine may have different licensing options and restrictions, based on the engine used.

So why use Python to write games at all? In a word, Python. Using a stand-alone game engine often requires you to learn a new programming or scripting language. Python game engines leverage your existing knowledge of Python, reducing the learning curve and getting you moving forward quickly.

There are many game engines available for the Python environment. The engines that you’ll learn about here all share the following criteria:

  • They’re relatively popular engines, or they cover aspects of gaming that aren’t usually covered.
  • They’re currently maintained.
  • They have good documentation available.

For each engine, you’ll learn about:

  • Installation methods
  • Basic concepts, as well as assumptions that the engine makes
  • Major features and capabilities
  • Two game implementations, to allow for comparison

Where appropriate, you should install these game engines in a virtual environment. Full source code for the games in this tutorial is available for download at the link below and will be referenced throughout the article:

Get Source Code:Click here to get the source code you’ll use to try out Python game engines.

With the source code downloaded, you’re ready to begin.

Pygame

When people think of Python game engines, the first thought many have is Pygame. In fact, there’s already a great primer on Pygame available at Real Python.

Written as a replacement for the stalled PySDL library, Pygame wraps and extends the SDL library, which stands for Simple DirectMedia Layer. SDL provides cross-platform access to your system’s underlying multimedia hardware components, such as sound, video, mouse, keyboard, and joystick. The cross-platform nature of both SDL and Pygame means that you can write games and rich multimedia Python programs for every platform that supports them!

Pygame Installation

Read the full article at https://realpython.com/top-python-game-engines/ »


[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]


Viewing all articles
Browse latest Browse all 23202

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>