Let's start programming with Pyxel, a retro game engine!

NOTE: This article is English translated version of introduction of Pyxel in Japanese.

Since I almost finished the implementation of the scheduled functions of Pyxel, I decided to write down an official introduction article.

What is Pyxel?

Pyxel is a retro game engine which can realize old fashioned pixel art style games easily.

f:id:tkitao:20181124185037p:plain

Pyxel is a very new game engine that was first released on July 30, 2018, and users are rapidly increasing now abroad.

github.com

The project is open source at GitHub and it got first place among all 100 million projects on GitHub's daily ranking on the 4th day of public release. And as the developer, I was ranked first in the developer ranking of 31 million people including company accounts such as Google, Facebook, Microsoft. (Although I did not hold the position of No. 1 for 48 hours)

f:id:tkitao:20181111224534p:plain:w400

f:id:tkitao:20181111224553p:plain:w400

On GitHub, the number of stars has continued to increase, and now it is over 4000 stars, and it is aligning shoulder with a long-established game engine such as MonoGame (5400 Stars), PlayCanvas (3900 Stars).

Even though there are many other game engines, why does Pyxel draw attention so much? I will introduce five features (and one extra).

Feature 1: Programmable in Python

The biggest feature of Pyxel is that it can be programmed with Python.

f:id:tkitao:20181124232335p:plain:w300

Python is an excellent language and has the following features:

  • Simple and easy to read code, so it is suitable for beginners to learn
  • Very popular, has many developers
  • Libraries for machine learning are also substantial, and popularity is also rising in AI applications

Actually, there are not so many game engines that made good use of its features.

As a game engine for Python, Pygame and Pyglet are very famous. However, Pygame is older and slower, Pyglet is difficult to use and has fewer documents.

By combining a simple API with a modern design, Pyxel offers a third choice that allows anyone to enjoy game development without compromising the ease and productivity of Python.

To install Pyxel, just like the general Python package, simply type in Python installed environment as follows:

pip install pyxel

(For detailed installation method, please refer to Manual)

Feature 2: Multi-platform support

Python is a multi-platform compatible language, and Pyxel made in Python also supports multi-platform.

f:id:tkitao:20181124232412p:plain:w300

Games created with Pyxel can run the same program as it is on Windows, Mac and Linux without recompilation etc. (However, Linux is still not sufficiently verified. There are circumstances where drawing and music playback does not go well partially)

By the way, I am doing development of Pyxel while also switching between Windows and Mac with the mood of that day as a confirmed operation check.

Feature 3: Not many things to remember

By focusing on retro games and making the function as simple as possible, Pyxel enables to do game development just by memorizing some simple instructions (APIs).

For example, all the drawing functions can be used only by memorizing 11 kinds of instructions.

https://github.com/kitao/pyxel/blob/master/pyxel/examples/screenshots/03_draw_api.gif?raw=true

You can also create and play sound effects and music simply by memorizing 5 kinds of instructions.

https://github.com/kitao/pyxel/blob/master/pyxel/examples/screenshots/04_sound_api.gif?raw=true

In addition, the method of initializing the game and obtaining the key input are also very simple.

The following is an example of a program that displays the Pyxel logo and ends the application when the Q key is pressed:

import pyxel


class App:
    def __init__(self):
        pyxel.init(160, 120, caption="Hello Pyxel")
        pyxel.image(0).load(0, 0, "assets/pyxel_logo_38x16.png")
        pyxel.run(self.update, self.draw)

    def update(self):
        if pyxel.btnp(pyxel.KEY_Q):
            pyxel.quit()

    def draw(self):
        pyxel.cls(0)
        pyxel.text(55, 41, "Hello, Pyxel!", pyxel.frame_count % 16)
        pyxel.blt(61, 66, 0, 0, 0, 38, 16)


App()

https://github.com/kitao/pyxel/blob/master/pyxel/examples/screenshots/01_hello_pyxel.gif?raw=true

Did you understand that programming with Pyxel is very simple and easy to understand?

Feature 4: A special tool is bundled

Game development can not be completed simply by writing a program. Pictures and music to use in games are also necessary, and usually they will be created using external tools.

On the other hand, Pyxel comes with a special tool for creating pictures and music, so you can start developing games immediately.

After installing Pyxel, you can use the following tools by typing pyxeleditor on the command terminal.

  • Image Editor to create pixel art images
  • Tilemap Editor to create maps by arranging images

https://github.com/kitao/pyxel/blob/master/pyxel/editor/screenshots/image_tilemap_editor.gif?raw=true

  • Sound Editor to create melodies and sound effects
  • Music Editor to combine sounds to make musics

https://github.com/kitao/pyxel/blob/master/pyxel/editor/screenshots/sound_music_editor.gif?raw=true

It is also possible to read data created with another tool.

Feature 5: Free to use

Pyxel is published under MIT License, and anyone can use it free of charge.

For reference, I have posted a summary of Japanese Wikipedia's MIT license.

  • Anyone can handle this software unlimitedly at no charge. However, the copyright notice and this license notice must be stated in all copies or important parts of the software
  • Authors or copyright holders are not responsible for software at all

Feature 6(?): Author is Japanese

Finally one more bonus feature. Pyxel is made by Japanese, there are also Japanese manual written by the author. Of course it is also possible to ask the author in Japanese.

At the beginning, I wrote that the number of users is rapidly increasing abroad, but on the other hand it is a situation that the name recognition in Japan is still not at all.

I am very happy that Pyxel will be used all over the world, but I also think that it would be nice to have users increase in Japan, so please do support!