Code Monkey home page Code Monkey logo

gb-gameoflife's Introduction

GB-GameOfLife

An implementation of Conway's Game of Life for the GameBoy.

Demo in BGB emulator

Press START to pause and enter edit mode.

In edit mode:

  • use the d-pad to move the cursor
  • press A to toggle a cell's state
  • press B to trigger one step of the automata
  • press SELECT to clear all the cells

Press START again to resume animation of the automata.

Project's Backstory

I started this as my first real programming written entirely in assembly. I thought the gameboy was a good fit for that, with its not too complex instruction set. I chose Conway's Game of Life because it's quite a classic of CS exercises and I thought it would be simple enough to do.

Boy, I was wrong.

I know the gameboy is far from fast enough to update all pixels on screen in between each frame. Who would have thought it would also not be fast enough to just update its 20x18 tiles? That's only 360 bytes! In the v-blank, the time between two frames are rendered by the Picture Processing Unit or PPU, and where you have access to Video RAM, there's barely enough time to write to a quarter of the tilemap. And that's without reading from it!

But there's hope: first, the gameboy has enough video ram to hold two tilemaps, so we can double buffer. Second, the v-blank is not the only time where you can write to Video RAM, you can also write in between the PPU rendering lines! That requires synchronising code with rendering but it should be doable.

The first working version I got looked like this:

Animated GIF recorded with BGB

gb-gameoflife's People

Contributors

issotm avatar msklywenn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

resonancellc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.