The Workshop

Pyxel 3.0 adds a retro 3D engine to the Python game toolkit

The Pyxel logo: a pixel-art cube outlined in pink, blue and peach next to the word Pyxel in white blocky pixel letters, on a dark navy background.
Pyxel 3.0 adds Pyxel Cube, a low-poly 3D module, to Takashi Kitao's retro game engine. — © Takashi Kitao, via kitao.dev (editorial-use). Source · Image rights

Takashi Kitao released Pyxel 3.0 on 5 November, adding Pyxel Cube, a software-rendered 3D module, to his free Python engine for retro-style games. Version 3.0.1 followed on 10 November with fixes, according to the package’s PyPI release history. Pyxel is MIT-licensed, runs on Windows, macOS, Linux and in the browser, and until now was built for 2D games with a 16-colour palette and four sound channels.

In his Japanese announcement on Qiita, Kitao says he had held back from 3D because it would add production work and could cost Pyxel its appeal of being easy to make things with. His answer is to stop at what he calls “retro 3D”: the low-poly style of the PlayStation 2 generation, which launched 26 years ago, rather than competing with Unity or Unreal Engine. The basic palette is still 16 colours, which users can extend, and there is no translucency, so dithering stands in for it. Kitao also reports that the project has passed 18,000 stars on GitHub. Game Makers notes that he previously worked on the Metal Gear Solid and Zone of the Enders series.

How Pyxel Cube builds a scene

The Pyxel Cube user guide describes a node tree imported from pyxel.cube. Developers subclass Node, override on_update and on_draw, and call the root’s update() and draw(x, y, w, h) from the usual Pyxel loop. The 3D view can be drawn into a screen rectangle or an image, and ordinary 2D calls such as pyxel.text can be layered on top. The camera defaults to a 60-degree perspective and can switch to orthographic.

Lighting works through the palette. A Shading table gives every colour eight brightness levels, with level 5 as the original colour, and a level can map to two colours to produce a checkerboard dither. The drawing API mirrors Pyxel’s 2D functions with lines, triangles, boxes, spheres, planes and camera-facing sprites. A physics layer adds sphere, capsule, box and static mesh colliders, raycasts and overlap queries, and assumes 100 units to the metre for its default 9.8 m/s² gravity.

What the model loader accepts

Models and animations come from binary glTF files exported from Blockbench, the free low-poly modelling tool. The API reference warns that Mesh.from_glb “is not a general glTF loader”. It reads triangles, part hierarchies, keyframed translation, rotation and scale, and base-colour textures. It ignores skinning, morph targets, vertex colours, normal maps, metallic and roughness data, extra UV sets and external files. Textures use nearest-neighbour sampling and UVs are clamped, so repeating patterns must be baked into the image.

What breaks when upgrading from 2.x

The changelog lists two removals in 3.0.0: the old MML music syntax and loading of resource files from before Pyxel 2.0. Projects that still use either need converting before they update. PyPI lists Python 3.11 as the minimum, and the web runtime moved to Pyodide 314.0.7. Version 3.0.1 strips unused vertices from indexed GLB imports to speed up rendering, rejects malformed GLB primitives and fixes texture seams on spheres. The bundled examples run from c01 (a spinning cube) to c06 (rigid-body physics) and can also be played in the browser from Pyxel’s showcase page.

Pyxel 3.0 follows another Kitao project from October: Playload, an MIT-licensed JavaScript engine for games small enough to share as a URL.