CHIP 8 emulator in Blender 3D using Python

After creating the CHIP8 emulator in Python using console or PyGame as a graphic library I wanted to make it work in Blender 3D, because it’s using Python as a native scripting language. It was interesting to find out how much work is needed to port it. Appears it was pretty easy. The core of the emulator stays of course the same. PyGame had to be striped down from the code, instead the main loop had to be converted to get called from the Blender 3D environment.

To make it work the Modal Timer Operator had to be used to run the CHIP8 chip cycle in a loop. At first I used simple bpy.ops.mesh.primitive_cube_add(), unfortunately it updates all the objects in the scene each time it’s called. Next option was to use a starting mesh, then copy it to desired locations and update later, using bpy.context.object.copy(). So here it is at the actual state. It’s not very fast, the core of the emulator works at full speed outside of the Blender 3D, so I’ll have to find a better solution after getting more familiar with Blenders API. If you know a better solution please leave a comment.

Blender Python running the emulator of CHIP 8
CHIP 8 in Blender 3D

Leave a Reply

Your email address will not be published. Required fields are marked *