Baekalfen/PyBoy

Game Boy emulator written in Python

Python

5,228

1,099 commits

updated Oct 16, 2026

See the code

README

If you have any questions, or just want to chat, join us on Discord.

Baekalfen%2FPyBoy | Trendshift

Getting Started

The instructions are simple:

$ pip install pyboy

For platform-specific instructions, see the installation guide.

Now you're ready! Either use PyBoy directly from the terminal

$ pyboy game_rom.gb

Or use it in your Python scripts:

from pyboy import PyBoy
pyboy = PyBoy('game_rom.gb')
while pyboy.tick():
    pass
pyboy.stop()

The API

If you are looking to make a bot or AI, then these resources are a good place to start:

When the emulator is running, you can easily access PyBoy's API:

pyboy.set_emulation_speed(0) # No speed limit
pyboy.button('down')
pyboy.button('a')
pyboy.tick() # Process at least one frame to let the game register the input
value_of_interest = pyboy.memory[0xC345]

pil_image = pyboy.screen.image
pil_image.save('screenshot.png')

The documentation homepage shows how to interface with PyBoy from your own project.

Performance

Performance is a priority for PyBoy, to make your AI training and scripts as fast as possible.

The easiest way to improve your performance, is to skip rendering of unnecessary frames. If you know your character takes X frames to move, or the game doesn't take input every frame, you can skip those to potentially triple your performance. All game logic etc. will still process.

Here is a simple comparison of rendering every frame, rendering every 15th frame, and not rendering any frames (higher is better). See pyboy.tick for how it works. Your performance will depend on the game.

Full rendering Frame-skip 15 No rendering
x124 realtime x344 realtime x395 realtime
for _ in range(target):
    pyboy.tick()

for _ in range(target//15):
    pyboy.tick(15)

pyboy.tick(target, False)

The Game Boy was originally running at 60 frames per second, so a speed-up of 100x realtime is 6,000 frames per second. And trivially from the table above, simulating 395 hours of gameplay can be done in 1 hour with no rendering.

It's also recommended to be running multiple instances of PyBoy in parallel. On an 8-core machine, you could potentially do 3160 hours of gameplay in 1 hour.

Contributing

For development setup, testing, and pull request guidance, see the Contributing guide. You can browse open issues or discuss larger proposals on the PyBoy Discord.

cython
emulator
gameboy
gameboy-emulator
gameboy-emulator-library
pypy
python

Baekalfen/PyBoy

Game Boy emulator written in Python

Python

5,228

1,099 commits

updated Oct 16, 2026

See the code

README

If you have any questions, or just want to chat, join us on Discord.

Baekalfen%2FPyBoy | Trendshift

Getting Started

The instructions are simple:

$ pip install pyboy

For platform-specific instructions, see the installation guide.

Now you're ready! Either use PyBoy directly from the terminal

$ pyboy game_rom.gb

Or use it in your Python scripts:

from pyboy import PyBoy
pyboy = PyBoy('game_rom.gb')
while pyboy.tick():
    pass
pyboy.stop()

The API

If you are looking to make a bot or AI, then these resources are a good place to start:

When the emulator is running, you can easily access PyBoy's API:

pyboy.set_emulation_speed(0) # No speed limit
pyboy.button('down')
pyboy.button('a')
pyboy.tick() # Process at least one frame to let the game register the input
value_of_interest = pyboy.memory[0xC345]

pil_image = pyboy.screen.image
pil_image.save('screenshot.png')

The documentation homepage shows how to interface with PyBoy from your own project.

Performance

Performance is a priority for PyBoy, to make your AI training and scripts as fast as possible.

The easiest way to improve your performance, is to skip rendering of unnecessary frames. If you know your character takes X frames to move, or the game doesn't take input every frame, you can skip those to potentially triple your performance. All game logic etc. will still process.

Here is a simple comparison of rendering every frame, rendering every 15th frame, and not rendering any frames (higher is better). See pyboy.tick for how it works. Your performance will depend on the game.

Full rendering Frame-skip 15 No rendering
x124 realtime x344 realtime x395 realtime
for _ in range(target):
    pyboy.tick()

for _ in range(target//15):
    pyboy.tick(15)

pyboy.tick(target, False)

The Game Boy was originally running at 60 frames per second, so a speed-up of 100x realtime is 6,000 frames per second. And trivially from the table above, simulating 395 hours of gameplay can be done in 1 hour with no rendering.

It's also recommended to be running multiple instances of PyBoy in parallel. On an 8-core machine, you could potentially do 3160 hours of gameplay in 1 hour.

Contributing

For development setup, testing, and pull request guidance, see the Contributing guide. You can browse open issues or discuss larger proposals on the PyBoy Discord.

cython
emulator
gameboy
gameboy-emulator
gameboy-emulator-library
pypy
python

Project health

Overall

4.2/10

Maintained

10/10

Code review

0/10
OpenSSF Scorecard

PyPI

Latest release

2.8.1 · Oct 7, 2026

Releases this year

5

Significant stargazers

(top 24 of 49)

Jared Forsyth

1,316 followers · starred Oct 2023

Benoit Daloze

491 followers · starred Feb 2024

Seth Larson

946 followers · starred Mar 2021

Sebastian Raschka

40,727 followers · starred Apr 2020