Game Boy emulator written in Python
Project description
If you have any questions, or just want to chat, join us on Discord.
Train RL agents to play Pokemon Red | Rewind any game |
|
Play the classics |
Create your own AI |
Beat world records with AI |
Getting Started
The instructions are simple:
$ pip install pyboy
For details, see installation instructions.
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 Wiki 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
Any contribution is appreciated. The currently known problems are tracked in the Issues tab. Feel free to take a swing at any one of them. If you have something original in mind, come and discuss it on on Discord.
For the more major features, there are the following that you can give a try. They are also described in more detail in the project list in the Wiki:
- Hacking games
- Link Cable
- Debugger (VSCode, GDB, terminal or otherwise)
- AI - use the
api
or game wrappers to train a neural network - Game Wrappers - make wrappers for popular games
If you want to implement something which is not on the list, feel free to do so anyway. If you want to merge it into our repo, then just send a pull request and we will have a look at it.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file pyboy-2.4.1.tar.gz
.
File metadata
- Download URL: pyboy-2.4.1.tar.gz
- Upload date:
- Size: 161.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1d1a38f8837abecd122132fa9a4ed9ce67e4535e9772a850dbb2199b16626f1 |
|
MD5 | 60853c0e82e3c92313bfa4b626fc41ae |
|
BLAKE2b-256 | 199cb5d136b2f6004301ed303ea459576302371d4d56468b57051fb4859c2bda |
File details
Details for the file pyboy-2.4.1-cp313-cp313-win_amd64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d38fd0199fa2619be6534a2b0aac400c6f2862e2c84a03b9778a1a714e9cd80f |
|
MD5 | bfdf9c3899446fd2b88da18d59bb1ac9 |
|
BLAKE2b-256 | 1892ea683ce0cdd8b1d99628f89af7ec654f90bb350c84ff3e168b7a5332e703 |
File details
Details for the file pyboy-2.4.1-cp313-cp313-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp313-cp313-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.13, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81df9ce9642abcadb0125932b702f9fdfe3765108bb9c591c0a100eb1d60deb9 |
|
MD5 | 0ed838598a5b8c3578094394031b01ff |
|
BLAKE2b-256 | caeee1b01f1e53de3d580f9bc979c64778ad755da6dac205762a28eb2d152dbd |
File details
Details for the file pyboy-2.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6a45cbba8ef1f7a1366e7c1a81244a954f3644bb6d69a34aedd178f2a56b5d4 |
|
MD5 | bdd7cc941ef4783d505d9d6027673eb5 |
|
BLAKE2b-256 | c06eb42460f8d56ee13cefcc1e364d8eed32debb1f8fb7ac9e885acc2400c39e |
File details
Details for the file pyboy-2.4.1-cp313-cp313-macosx_10_13_universal2.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp313-cp313-macosx_10_13_universal2.whl
- Upload date:
- Size: 8.1 MB
- Tags: CPython 3.13, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 692ad923ca4fc049054d7c4e527f90bde34829f314b72ea54c8114c69d15ca0a |
|
MD5 | 2aacfa04b2ff7bbffe0557ad1e16230c |
|
BLAKE2b-256 | 461be08408402b63a8e6820e349d15c3c598e6af63130e03c5b825b643ee6f1f |
File details
Details for the file pyboy-2.4.1-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 3.8 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5019c2905bdbebf1125cf2bffd6144810cb4561a84ce0c02ec4aa38d13ef26e |
|
MD5 | f7d46959359474cac6e7704427eddd88 |
|
BLAKE2b-256 | 29ad00ed24a2aae97043b5a67664a75d040801c7a1e5635292535ec711a40a4d |
File details
Details for the file pyboy-2.4.1-cp312-cp312-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp312-cp312-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.12, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48cc36df107993ae3accb233f4840c9993ecbf9431a3d2bd01a5196a807844ac |
|
MD5 | 3efd7ce4768993d7003fda43bbbf8f73 |
|
BLAKE2b-256 | 3a14f364c2b4ee707babe801b8532949361e01cebc39bd8c1dc188d4f521fa0d |
File details
Details for the file pyboy-2.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91797dd370603c5bcf4d7fcd13ef97467723499cc015a4e7c0e3d6a956529b7a |
|
MD5 | bf01067258cbcabc4732aca2d9ac6338 |
|
BLAKE2b-256 | 12b7bde94858cae540c9dcbf5bb5e2faa4856184d84ee2ceedb234c214bd7657 |
File details
Details for the file pyboy-2.4.1-cp312-cp312-macosx_10_13_universal2.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp312-cp312-macosx_10_13_universal2.whl
- Upload date:
- Size: 8.2 MB
- Tags: CPython 3.12, macOS 10.13+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f2583601fd00e4347b4dc29b074b124cf537ffbca3268c727459be64b12fbaf |
|
MD5 | 29cd6be25843646cbd95b577a2c03189 |
|
BLAKE2b-256 | 3e26bdbac86d47845c6799d58fc16caefeb4ae20d7ec6f2d889babf0517f92c6 |
File details
Details for the file pyboy-2.4.1-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 3.9 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6abd468c1f2c83c076beb2fb21330ee71d5849767fd76e03741316a67503e5f3 |
|
MD5 | b03c422efd081f86e927f8b58e12ad0c |
|
BLAKE2b-256 | 64134fa4823d2c5090473f0560bdc33847e354f60c4867c4f4393dd44482d0b5 |
File details
Details for the file pyboy-2.4.1-cp311-cp311-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp311-cp311-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.11, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce46043b7bcec6623db151f9220b8ba1b55c9f5e423b1d79f0abb0c42a16136f |
|
MD5 | f1e80d24f446a199d7927f760df1eb5e |
|
BLAKE2b-256 | 289a9d4e398a5a9180cea7c7869441ed6fe882f956709f6b49ee81266d77fd24 |
File details
Details for the file pyboy-2.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a707db7ce192be3c9fb5fc35a3292468acb643850cc411d8a38c4f0c9fd73746 |
|
MD5 | add556c8994b71c4998a3951d253632e |
|
BLAKE2b-256 | 283d033b52e1b189adc0fed06888bf6943909b9cbabb9075d1f3b63b480e4c7f |
File details
Details for the file pyboy-2.4.1-cp311-cp311-macosx_10_9_universal2.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp311-cp311-macosx_10_9_universal2.whl
- Upload date:
- Size: 8.1 MB
- Tags: CPython 3.11, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 919cebc3c43d58f11710cc1aca66b663a376659ea69281a1d2af65a557891af4 |
|
MD5 | 6601f25d259dfb31a4ee1e2139dcc2ef |
|
BLAKE2b-256 | aa7085e2c3030a921537d9dbf0ded4e7867860a7087bcf26e061e7597886a97a |
File details
Details for the file pyboy-2.4.1-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 3.9 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d08dbe9a8d00d280e1adab045ab379dd04fc43695a31e446598406c421030d57 |
|
MD5 | 8108ea95c76fd7bf342a1ae7c4d4ee2a |
|
BLAKE2b-256 | 65dc416eb0c9d263d700b3f9c5bf75a8aa0402cb0ee8576d44c46bdda50a9ce9 |
File details
Details for the file pyboy-2.4.1-cp310-cp310-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp310-cp310-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.10, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38ec94129da63684e8db052668ecb7ef64ec32428dc98662ca90fb1c7e1fcb0b |
|
MD5 | c508b78537b052e2fae8ab92f2e31ff4 |
|
BLAKE2b-256 | ece135b30acc3f66c8da8a38215dabdda81232ebb2ad51d9634d3e7277ca2b3e |
File details
Details for the file pyboy-2.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7dbb98873ffa07e5007e20d36aa65eabe29a6cbeff10c9334ab9832b2297e53 |
|
MD5 | 392ff24eba50b4be51638e74366e0b07 |
|
BLAKE2b-256 | 1d32366b3e1f0aa8d37b64d66c78b2ae51a7d740420331d2a50f2d48df94cf86 |
File details
Details for the file pyboy-2.4.1-cp310-cp310-macosx_10_9_universal2.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp310-cp310-macosx_10_9_universal2.whl
- Upload date:
- Size: 8.2 MB
- Tags: CPython 3.10, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5a91c57c6d1a694dcdd8e7c934b6b4c0d799f241857b1f7706101e978e01ec1 |
|
MD5 | 8f011a8d422639a5606a42587eabc1fa |
|
BLAKE2b-256 | 9f6410d1feaf536454e6bd3b23d04804a08d7855d7e505638b1c47b5505a4a3d |
File details
Details for the file pyboy-2.4.1-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 3.9 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98688fdb97eae3477ebd826f30665a246965227422115d5d899b63b0462f2171 |
|
MD5 | 8753d3b1d37f4d17b023db7c0328febb |
|
BLAKE2b-256 | 4a6762b2a046a57343c7bb945c5003faf93016c123c010fe6f62ef28b454c356 |
File details
Details for the file pyboy-2.4.1-cp39-cp39-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp39-cp39-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.9, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e3ab2f75e81beb3254e497173a015e4cb3e5e3ec9aed0d86cdb20a84b1c8284 |
|
MD5 | d4b715a056c078192521c72394191963 |
|
BLAKE2b-256 | 7b6b09ff272083500a94645230d3d016f070b5f5d6d6e2c5a08d6d4192f6e6ca |
File details
Details for the file pyboy-2.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4b61961d77d628face9bf0fbe34f9ec1633b0f394bd21324f5fa9675900d171 |
|
MD5 | aadcdbd3973f0b65711e499995a7e17f |
|
BLAKE2b-256 | af1ffb689e7873f5b88dd847a221b368c8976a74b1fee978d1b60756ef346c6b |
File details
Details for the file pyboy-2.4.1-cp39-cp39-macosx_10_9_universal2.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp39-cp39-macosx_10_9_universal2.whl
- Upload date:
- Size: 8.2 MB
- Tags: CPython 3.9, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e395c940fdebe843d43cdd94b64928ef29a8c6864805e983a25f16ac0276899 |
|
MD5 | 63654ebe55325d29acf5120912b519b8 |
|
BLAKE2b-256 | a3fa87a96686e978d48829234c7eee7aab322d1f69657694e116d66a45de1214 |
File details
Details for the file pyboy-2.4.1-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 3.9 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13d668dc2d98819718704e86120c3b779298962efeef39dcd0356ca160ef5860 |
|
MD5 | 4a708ed686a57511521300091662bfa1 |
|
BLAKE2b-256 | 714dbc4f675e9570219f9a172ad06b21db300695b573a7a50570c48b7a4d735f |
File details
Details for the file pyboy-2.4.1-cp38-cp38-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp38-cp38-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.8, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c800c471f9e1295541081a2e4b101065a4fb23c495a9b7387237f5b0a2ed7520 |
|
MD5 | 917c29d80aa257b93770f611a8944024 |
|
BLAKE2b-256 | 262ca41775236ff2dabc9f02e277493505396108dac74b1abd5dde4b8a474547 |
File details
Details for the file pyboy-2.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 972e25c4a5290487a8f7eb05326655e11da4ff21999ce3318a349e4d92c4e8b1 |
|
MD5 | 25f241d30ac1bb8afd0f71103aeda603 |
|
BLAKE2b-256 | f640e59234500359f60f4e6df455af8505a2bcb73991f5e2937b31a2011cd4e4 |
File details
Details for the file pyboy-2.4.1-cp38-cp38-macosx_11_0_universal2.whl
.
File metadata
- Download URL: pyboy-2.4.1-cp38-cp38-macosx_11_0_universal2.whl
- Upload date:
- Size: 8.3 MB
- Tags: CPython 3.8, macOS 11.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72767b98ed15051efa283daf29737a20bbdbcb306153a7e3c0586fdea18d9488 |
|
MD5 | 75f8512d325a820131cc4356da61cf49 |
|
BLAKE2b-256 | 80283758376f93e79501c9f691fb0c396a913633ec39c1f2d6ba6480f80276ef |