| 業務内容 Duties | 画面を見ながら、レバーを右に倒し続けてください Watch the screen and keep pushing the lever to the right |
|---|---|
| 図形が表示されたら、ボタンを1回押してください When a shape appears, press the button once | |
| 押し遅れると、最初からやり直しです If you press too late, you start over from the beginning | |
| その作業を、延々と繰り返してください Repeat that, over and over, without end | |
| 勤務時間 Hours | 30時間 30 hours |
| 報 酬 Pay | 4,900円4,900 yen |
| 業務内容 Duties | 画面を見ながら、レバーを右に倒し続けてください Watch the screen and keep pushing the lever to the right |
|---|---|
| 図形が表示されたら、ボタンを1回押してください When a shape appears, press the button once | |
| 押し遅れると、最初からやり直しです If you press too late, you start over from the beginning | |
| その作業を、延々と繰り返してください Repeat that, over and over, without end | |
| 勤務時間 Hours | 30時間 30 hours |
| 報 酬 Pay | 4,900円4,900 yen ←受け取る額ではなく、支払う額Not what you earn — what you pay |
Super Mario Bros. © 1985 Nintendo
「作業」と「遊び」は紙一重。違いは、楽しくする工夫があるかどうかWork and play are a hair apart. The difference is whether someone designed the fun
プレイヤーに「楽しい」「面白い」と感じさせる仕組みThe workings that make players find it fun and interesting
Super Mario Bros. © 1985 Nintendo
難易度は同じ。見え方が違うだけThe difficulty is the same. Only the look differs
北尾 崇きたお たかしTakashi Kitao

北尾 崇きたお たかしTakashi Kitao

レトロゲーム風のゲームを簡単に作るための、Pythonモジュール&ツールA Python module and tools for easily making retro-style games

Music © Maki Kirioka
© Shiromofu Factory
本日は、Pyxelがどのようにプログラミングを「遊び」に変えているのか、
その仕組みや考え方、そこに込めた想いについてお話ししますHow Pyxel turns programming into play — the mechanisms, the thinking, and the wish behind them
レトロゲームを題材にしたゲームエンジンを自分で作ることにしたI decided to build a retro-game engine of my own
Dragon phantom beast © Keita Okada / Villard Inc.
Mont-Saint-Michel © milk猫 (@milk94698164)
© Toshio Noguchi





© Toshio Noguchi © @helpcomputer0
| 一般的なゲームエンジン A typical game engine | Pyxel A retro game engine | |
|---|---|---|
| 色Color | フルカラー ── 約1,677万色 About 16.77 million colors | 16色・半透明なし 16 colors, no translucency![]() |
| 音Sound | 同時発音数も音色も実質無制限 Effectively unlimited voices and timbres | 同時発音数は4音/音色は4種類 4 voices, 4 waveforms |
| 画像Images | サイズも枚数も自由 Any size, any number | 256×256サイズの画像が3枚 3 banks of 256×256 |
| 描画命令Drawing commands | 用途ごとに膨大なAPI A vast API for every purpose | 基本の描画命令は10種類 10 basic drawing commands |
画面をクリアするClear the screen
点を描画するDraw a pixel
四角形を描画するDraw a filled rectangle
円を描画するDraw a filled circle
画像を描画するCopy from an image bank
文字を描画するDraw a string
直線を描画するDraw a line
四角形の枠線を描画するDraw a rectangle outline
円の枠線を描画するDraw a circle outline
タイルを並べて描画するCopy from a tilemap
描画命令で、キャラクターを描く Draw the characters with drawing commands
import pyxelpyxel.init(160, 120)pyxel.cls(1)pyxel.line(0, 112, 159, 112, 3)pyxel.rect(76, 104, 8, 8, 10)pyxel.rect(40, 20, 8, 8, 8)pyxel.show()

座標を変えながら描画を繰り返すと、アニメーションになる Repeat the drawing while shifting the coordinates, and it becomes animation
import pyxelpyxel.init(160, 120)enemies = [[pyxel.rndi(0, 152), -i * 16] for i in range(16)]while True: pyxel.cls(1) pyxel.line(0, 112, 159, 112, 3) for enemy in enemies: enemy[1] += 2 if enemy[1] > 120: enemy[0], enemy[1] = pyxel.rndi(0, 152), -8 pyxel.rect(enemy[0], enemy[1], 8, 8, 8) pyxel.rect(76, 104, 8, 8, 10) pyxel.flip()

キー入力で、キャラクターを操作できるようにする Take key input to make the character controllable
import pyxelpyxel.init(160, 120)x = 76enemies = [[pyxel.rndi(0, 152), -i * 16] for i in range(16)]while True: pyxel.cls(1) pyxel.line(0, 112, 159, 112, 3) if pyxel.btn(pyxel.KEY_LEFT): x -= 2 if pyxel.btn(pyxel.KEY_RIGHT): x += 2 for enemy in enemies: enemy[1] += 2 if enemy[1] > 120: enemy[0], enemy[1] = pyxel.rndi(0, 152), -8 pyxel.rect(enemy[0], enemy[1], 8, 8, 8) pyxel.rect(x, 104, 8, 8, 10) pyxel.flip()

同梱のPyxel Editorで、キャラクターと効果音を作る Make the character and the sound effect in the bundled Pyxel Editor
import pyxelpyxel.init(160, 120)pyxel.load("game.pyxres")pyxel.gen_bgm(7, 0, 3, 0, play=True)x = 76enemies = [[pyxel.rndi(0, 152), -i * 16] for i in range(16)]game_over = Falsewhile True: pyxel.blt(0, 0, 0, 0, 0, 160, 120) if pyxel.btn(pyxel.KEY_LEFT) and not game_over: x -= 2 if pyxel.btn(pyxel.KEY_RIGHT) and not game_over: x += 2 for enemy in enemies: if not game_over: enemy[1] += 2 if enemy[1] > 120: enemy[0], enemy[1] = pyxel.rndi(0, 152), -8 if abs(enemy[0] - x) < 8 and abs(enemy[1] - 104) < 8: pyxel.play(3, 0) game_over = True pyxel.blt(enemy[0], enemy[1], 0, 8, 120, 8, 8, 0) pyxel.blt(x, 104, 0, 0, 120, 8, 8, 0) pyxel.flip()
ないものは作り、できないことは工夫で越えた。Pyxelは「あの頃」の再現でもある You built what didn’t exist and improvised past what you couldn’t do. Pyxel is a recreation of those days
Pyxelの存在意義は制約。その外し方を隠して、自由度と両立させている The limits are why Pyxel exists. Hiding the way around them lets limits and freedom coexist
EXTRA_COLORS = [ 0xFF004D, 0xFFA300, 0xFFEC27, 0x00E436, 0x29ADFF, 0x83769C, 0xFF77A8, 0xFFCCAA, 0x291814, 0x111D35, 0x422136, 0x125359, 0x742F29, 0x49333B, 0xA28879, 0xF3EF7D,]pyxel.colors[16:] = EXTRA_COLORSpyxel.channels.append(pyxel.Channel())



日常のPythonに、出来心で import pyxel。そこから愉快な作品が生まれている An idle import pyxel in everyday Python — and delightful works keep appearing
みんなのアイデアも形になり、Pyxel User Examplesに集結 Other people’s ideas took shape and gathered in Pyxel User Examples
作って終わりにせず、共有することで、次の展開が始まる Making it is not the end — share it, and the next chapter begins
Pyxelの「共有の仕組み」 How Pyxel makes sharing work
Alt1画面を画像で保存 Screenshot
Alt3直近10秒をGIFで保存 Last 10s as a GIF
必要なファイルを1つに詰めたPyxel専用のファイル形式。コマンド1つで作成・実行できる A Pyxel-specific file format that packs everything into one file — one command to build, one to run
Pythonのコード Python filespyxel package→1つにまとめる bundles it into onepyxel play→実行する runs it残る課題Still unsolvedPythonとPyxelがインストールされた環境でないと、渡しても動かせない Unless Python and Pyxel are installed, handing it over gets them nowhere
コミュニティと周辺プロジェクトを巻き込んだ「みんなと作る」総力戦になった It became an all-out effort — making things together with the community and nearby projects



pyxel app2htmlコマンドでHTMLに変換The pyxel app2html command turns a pyxapp into a standalone HTML filepyxappをBase64エンコードし、復元コードとともにHTMLに書き込むThe pyxapp is Base64-encoded and written into the HTML with the code that restores it<script src="https://cdn.jsdelivr.net/gh/kitao/pyxel/wasm/pyxel.js" ></script><pyxel-run script="import pyxelpyxel.init(200, 150)pyxel.cls(8)pyxel.line(20, 20, 180, 130, 7)pyxel.show()"></pyxel-run>
HTMLファイルを開く Open the HTML file
Pyxel Web Launcher ── GitHubに置いたファイルを、URLで指定して起動する Pyxel Web Launcher — point a URL at a file on GitHub to launch it
https://kitao.github.io/pyxel/web/launcher/ランチャーの場所the launcher ?run=コマンドcommand taroユーザーuser / my_repoリポジトリrepo / mainブランチbranch / src/titleパスpath
共有の準備は必要なく、GitHubで公開されていれば、そのまま遊べるNo setup to share — if it is public on GitHub, it just plays
他の技術と繋がり、別の環境に組み込める。Webならではのアプリの形が見えた Wired to other tech, embedded elsewhere — a kind of app possible only on the web came into view



教室で最初につまずくのは、環境構築 ── ならIDEごとWebアプリにしよう The first wall in a classroom is setup — so make the IDE itself a web app
Pyxel Code MakerPyxel Code Makerブラウザ上で動く統合開発環境An IDE that runs in the browser

VS Codeの中身はブラウザ ── じゃあ、Pyxelをそのまま動かせるはず VS Code is a browser inside — so Pyxel should just run there
Pyxel VS Code拡張Pyxel VS Code extensionVS Code上で動く実行環境A runtime that runs inside VS Code

音楽が文字列で書けるなら ── 曲はQRコードに丸ごと入るのでは? If music is just text — then maybe a whole tune fits in a QR code?
Pyxel MML StudioPyxel MML StudioPyxel MMLの音楽制作ツールA music tool for Pyxel MML
T120 O4 L8 CDEFGAB>Cテンポ120・オクターブ4・8分音符で、ドレミファソラシドTempo 120, octave 4, eighth notes — then the scale


何を作るか考え、方向づけるのは人の役割。「情熱を育てる」仕掛けがより重要にSetting the goal and giving direction is the human role — and devices that grow the passion matter more than ever
AIはやる気を奪うものではなく、「作る楽しさ」を広げるパートナーになれるAI does not take away the will to make — it can be a partner that widens the joy of making










人の使い方は変えずに、AIのための道具を新たに開発Without changing how people use it, new tools built for AI
validate で誤りと警告を確かめるCheck errors and warnings
4. run でコマ0から動かし画面を撮るRun from frame 0 and capture
5. ログを読み、撮った画面を見るRead the log, look at the frame
6. 見つけた不具合だけを直すFix only observed defects
7. 操作方法と結果を報告するReport the controls and resultsPS2でさえ、もう26年前。Pyxelで「レトロ3Dゲーム」が作れてもいい頃 Even the PlayStation 2 is 26 years old — about time Pyxel let you make retro 3D games











ドット絵・平面(従来のPyxel)Pixel art, flat plane (Pyxel so far)


悪魔城ドラキュラ © 1986 KONAMI
がんばれゴエモン © 1991 KONAMI
ローポリゴン・立体空間Low poly, 3D space


METAL GEAR SOLID © 1998 KONAMI
ZONE OF THE ENDERS © 2001 KONAMI
Console photos: Wikimedia Commons — PlayStation 5 by Gianlupisa1 (CC BY-SA 4.0), backgrounds removed
ノードツリーで要素を配置。ノードの書き方は、2D版と同じ考え方 Arrange things with the node tree. Writing a node follows the same idea as in 2D
from pyxel.cube import Node, Vec3class Enemy(Node): def on_update(self): self.transform = self.transform.translate( Vec3(0.05, 0, 0)) def on_draw(self): self.circ(Vec3.ZERO, 0.5, 11) self.text(Vec3(0, 0.8, 0), "enemy", 7)


近日公開予定Coming soon
AI時代も、Pyxelで気軽に楽しくプログラミング!Even in the age of AI, easy and fun programming with Pyxel!
これからも一緒に、PyxelとPythonで
プログラミングを遊んでいきましょう!Let’s keep playing programming together — with Pyxel and Python!
@kitaoPyxel関連のニュースを発信していますNews around Pyxel https://github.com/kitao/pyxelスターをつけて応援よろしくお願いします!A star would mean a lot
発表資料Slides