The First High Performance Game Engine Written in Python

Judge Raptor
Nov 6 · 2 min read

Game developers are often at the mercy of the game engine they use, unable to deeply customize the engine because its written in C++, and that scares most away. What if there were a simpler form of C++ that was not so scary?

There has been many failed attempts to make a high performance game engine in Python. They all failed for three main reasons: 1. Python is too slow, 2. Python is hard to package for mobile platforms, 3. the engine is implemented in another language like C++, and requires a complex binding layer to expose its features to Python. Blendot solves all of these problems.

A game engine should be written in a language that is similar to its scripting language, that way users of the scripting language can with less effort make changes to the core engine. For example, if the engine is written in C++, and the scripting language is Lua, then the Lua user is going to have a very hard time making changes to the C++ engine. Why force the Lua user to learn C++ and how to make bindings? Blendot solves this problem because it is written in Pythonic++, a dialect of C++ that uses Python syntax, so its easy for Python users to learn it, and then modify the core engine as they need. The binding layer is also much simpler in Blendot, because it is tightly integrated with the TPython interpreter, which is also written in Pythonic++.

TPython now by default includes the minimal core of Blendot, and exposes the following types:

vec2, vec3, quat, color, rect, tri, plane, aabb, mat3, transform, spatial, and mesh.

Why not Cython?

Cython is a great language for making extensions for the CPython interpreter, Kivy is a good example of how they work well together. The problem with Cython is it is not a true dialect of C++, its heavily translated, and tries too hard to follow Python rules and style. This makes it harder to copy and paste existing C++ code, and convert it by hand to Cython. Cython is harder to connect with raw C++ code, and it requires linking to libpython, so its not very useful for making standalone programs. Pythonic++ takes a different approach, the translation is as light weight as possible, making it easy to connect with raw C++, it is able to compile standalone programs, and helps you on the path to fully learning C++.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade