pip install chipgr8
v0.1.1
Chip-Gr8 – Emulation for AI
Chip-Gr8 is a sandbox for creating artificial intelligence agents for retro video games like Pong, Breakout, and Space Invaders [1]. Chip-Gr8 lets you interactively program AI agents, easily record their behaviour, collect data, pause and play their actions, and even play against them! If you have never programmed an AI before, Chip-Gr8 is a great place to start!
Chip-Gr8 is a Python package. Use pip to install it!
pip install chipgr8
If you want to play a game using Chip-Gr8, all you have to do is start it on the command line! For example, to play Breakout you would run
python -m chipgr8 -r breakout
You will be greeted by the Chip-Gr8 display and can start playing!
Creating an AI agent is just as straightforward, just drop the following code into your favorite text editor and you are ready to go!
import chipgr8
from chipgr8.games import Breakout
vm = chipgr8.init(display=True, ROM=Breakout.ROM)
while not vm.done():
vm.act(Breakout.actions.left)
To find out more about Chip-Gr8, its API, included games, and more examples, download the Reference Manual, or head over to the docs!
The Chip-Gr8 UI harkens back to the retro games it houses, but modern conveniences are not all gone. You can play and watch your AI agent play in style with customizable themes, here are some of our favorites!
Chip-Gr8 is the capstone project for six Engineering students at the University of Victoria. Chip-Gr8's goal is to provide a high performance CHIP-8 emulator and a user friendly Python API that seamlessly integrates with modern machine learning and AI libraries. Inspiration for the Chip-Gr8 project came from similar emulation + AI combinations of the SNES [2] and Atari [3] systems.
At its core, Chip-Gr8 is an emulator of the CHIP-8 system. Developed in the 1970's by Joseph Weisbecker [4], CHIP-8 was meant to be a simple system that programmers could use for beginner video game development. Many simple games, including Pong, Space Invaders, and Breakout, were programmed for the CHIP-8 throughout the 70s and 80s.
What seperates Chip-Gr8 from similar CHIP-8 emulation projects is its focus on enabling AI agents. Chip-Gr8 provides pre-built memory maps that translate the CHIP-8's 4K RAM into relevant game data like player position, lives, and game time. Included with this data are the tools used to gather it, meaning new features can easily be added using a similar querying model used by popular gaming memory tools like Cheat Engine [5]. The CHIP-8 emulator itself is implemented in C and designed to be run in parallel, making it easy to train many AI agents at once.
Chip-Gr8 aims to scale with a user's development goals, from procedural AIs that follow the ball in pong, to a decision tree that makes a decision based off environmental features, to a neural network trained on the pixel buffer of games.
The Chip-Gr8 API is written in Python to ensure that it can interact with the best open source AI libraries available, like scikit-learn [6], PyTorch [7], and TensorFlow library [8]. Chip-Gr8 is built enitrely on top of open source software. Chip-Gr8 depends on
Primary development of Chip-Gr8 occurred over the Summer of 2019, the timeline below outlines Chip-Gr8's progress.
Idea to develop a CHIP-8 emulator with AI teaching capabilities solidified; documentation is started. Project is named "Chip-Gr8" (pronounced Chip-Great).
Python wrapper and C-based emulator programming begins. Work is focused on the C-based emulator and the CTypes integration.
Visualization is completed; CHIP-8 ROMs can be visualized with no input. Emulator bugs are fixed en masse to ensure it runs on Windows, Mac, and Linux.
C-based emulator is completed. Python integration is completed. Support for keyboard input is operational. Memory visualization milestone is started. More bugs are squashed.
Development on AI tools has begun; these will be used when developing example AIs. Memory visualization is working minimally, progress still being made and bugs being fixed.
Memory visualization module is completed. AI tools have been completed. Development on example AIs begins.
Den of Geek. (2011). The story of Breakout. [online] Available at: https://www.denofgeek.com/us/games/12171/the-story-of-breakout [Accessed Jul. 2019].
"MarI/O - Machine Learning for Video Games", YouTube, 2019. [online]. Available: https://www.youtube.com/watch?v=qv6UVOQ0F44. [Accessed: 22- Jul- 2019]
V. Mnih, K. Kavukcuoglu, D. Silver, A. Graves, I. Antonoglou, D. Wierstra and M. Riedmiller, Playing Atari with Deep Reinforcement Learning. DeepMind Technologies, 2013.
"Joseph Weisbecker", En.wikipedia.org, 2018. [online]. Available: https://en.wikipedia.org/wiki/Joseph_Weisbecker#Small_systems. [Accessed: 22- Jul- 2019]
Cheatengine.org. (2019). Cheat Engine. [online] Available at: https://www.cheatengine.org/ [Accessed Jul. 2019].
Scikit-learn.org. (2019). scikit-learn: machine learning in Python. [online] Available at: https://scikit-learn.org [Accessed Jul. 2019].
Pytorch.org. (2019). PyTorch. [online] Available at: https://pytorch.org/ [Accessed Jul. 2019].
TensorFlow. (2019). TensorFlow. [online] Available at: https://www.tensorflow.org/ [Accessed Jul. 2019].
"NumPy — NumPy", Numpy.org, 2019. [online]. Available: https://numpy.org/. [Accessed: 22- Jul- 2019]
"pygame", Pygame.org, 2019. [online]. Available: https://www.pygame.org/news. [Accessed: 22- Jul- 2019]
"lazyarray — lazyarray 0.3.2 documentation", Lazyarray.readthedocs.io, 2019. [online]. Available: https://lazyarray.readthedocs.io/en/latest/. [Accessed: 22- Jul- 2019]