0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Official] Pyxel 3.0 Released! Introducing the World’s First (?) Retro 3D Game Engine

0
Posted at

This article is an English version of a post I previously published in Japanese on Qiita.

Pyxel 3.0 is here!

I've released version 3.0 of Pyxel, a retro game engine for Python. Eight years after its initial release in 2018, and about three years after 2.0, it's finally time for another major update.

Along the way, Pyxel has grown to more than 18,000 stars on GitHub. This is all thanks to your support. Thank you!

The highlight of Pyxel 3.0 is Pyxel Cube, a built-in retro 3D game engine. In this article, I'll introduce its features and show you how to use it.

Three Pyxel 3.0 demos: gazelle animation, a 3D game, and physics

If this is your first time hearing about Pyxel, please also take a look at my earlier introduction.

What is Pyxel Cube?

Pyxel Cube is a submodule introduced in Pyxel 3.0 that makes it easy to create retro 3D games. You can use it by importing pyxel.cube in Python.

Its main features include:

  • Drawing 3D shapes such as boxes and spheres
  • Loading 3D models and playing animations
  • Configuring cameras and shading
  • Collision detection and physics simulation
  • Combining 3D with Pyxel's 2D drawing functions

The key point is that you can add 3D features alongside your existing 2D Pyxel code.

If 3D programming has felt out of reach, I hope Pyxel Cube gives you a way to get comfortable with it, a little at a time.

Why 3D, and why now?

Until now, Pyxel has focused on the consoles I think of as “retro”: primarily 2D systems up to around the Super Nintendo era.

I'd considered adding 3D support several times, but held off because it would make development more involved and risk losing Pyxel's appeal as a tool for casual game creation.

But it's already been 26 years since the PlayStation 2 launched. The low-poly 3D of that era is now sometimes called “retro 3D.”

A slide from PyCon JP 2026 showing console generations and the shift toward retro 3D

From my PyCon JP 2026 keynote (slide in Japanese)

So, for Pyxel 3.0, I decided to take another shot at bringing retro 3D to Pyxel.

Full-featured 3D engines such as Unity and Unreal Engine already exist. For Pyxel, I chose to focus on “3D from that era,” keeping it as approachable as 2D.

See it in action

Here's a game made with Pyxel Cube. Click the image to play it directly in your browser.

A 3D game made with Pyxel Cube

It's 3D, but the default palette is still just 16 colors (which you can extend). There's no translucency, either, so you need old-school tricks such as checkerboard dithering. It's a wonderfully restrictive kind of 3D! 😄

Getting started with Pyxel Cube

Let's look at the basic ideas behind Pyxel Cube and how to use it.

In Pyxel Cube, you build the contents of a 3D scene out of nodes. Connect nodes as parents and children, and a child moves along with its parent. This structure is called a node tree.

A slide from PyCon JP 2026 illustrating parent-child relationships in a node tree

The basic workflow is:

  1. Import pyxel.cube.
  2. Define each node's behavior and drawing.
  3. Add the nodes to a node tree.
  4. Update and draw the node tree.

To define a node, inherit from the Node class and implement its update and drawing methods. For example, here's a node that draws a rotating box:

import pyxel
from pyxel.cube import Mat4, Node, Vec3


class Box(Node):
    def on_update(self):
        # Rotate the box
        self.transform = Mat4.from_euler(Vec3(0, pyxel.frame_count, 0))

    def on_draw(self):
        # Draw the box
        self.box(Mat4.IDENTITY, Vec3(16, 16, 16), 11)

For a more detailed walkthrough, see the official Pyxel Cube guide and the usage tutorial video.

Pyxel Cube's main features

Let's take a closer look at its main features. Click each image to try the demo in your browser.

Drawing 3D shapes

You can draw boxes, spheres, and other shapes with simple drawing commands, much as you would in 2D Pyxel.

Here's how drawing a line compares in 2D and 3D:

pyxel.line(0, 0, 30, 20, 8)  # 2D
self.line(Vec3(0, 0, 0), Vec3(30, 20, 0), 8)  # 3D (inside a node)

You can also define your own shapes by specifying their vertices. The included demo deforms vertices to draw bending lasers and shapeshifting slimes.

A bending laser drawn as a custom 3D shape

3D models and animations

You can load files containing a model's shape and the movements of its parts, then draw the model and play its animations.

In this demo, pressing different keys switches between the gazelle's animations.

Switching between animations of a 3D gazelle model

Physics engine

Pyxel Cube includes its own physics engine. It can handle character movement along walls and simulate the motion of multiple objects.

In this demo, you fire a ball at a stack of objects, and physics simulation makes the stack tumble down.

A physics demo in which a ball knocks down a stack of objects

You can browse demos of Pyxel Cube's features and run them in your browser on the showcase page.

Browsing these demos is a good way to get a feel for what Pyxel Cube can do.

Creating 3D assets

Pyxel Cube uses the GLB format for 3D models and animations.

Many 3D tools can create GLB files, but for Pyxel, I recommend Blockbench.

The Pyxel Cube guide and the asset creation tutorial video explain how to create assets with Blockbench.

Once you've created a GLB file, you can load it and add it to a node tree with Python code like this:

from pyxel.cube import Mesh, Node

scene = Node()
model = Node.from_mesh(Mesh.from_glb("assets/character.glb"))
scene.add_child(model)

In closing

That was a look at Pyxel Cube, the new addition to Pyxel 3.0. It's a step into 3D, opening up something quite different from Pyxel so far. I hope you'll enjoy exploring it with me.

As always, Pyxel is developed for free, with GitHub stars providing a little encouragement along the way.

If you like Pyxel Cube, please consider starring Pyxel on GitHub!

I've also released Playload, a game engine with a 3KB limit that lets you share an entire game through a URL. If that sounds interesting, take a look at my introduction to Playload.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?