Skip to content

PHPNuts/php-terminal-gameboy-emulator

 
 

Repository files navigation

PHP Terminal GameBoy Emulator

Build Status Software License Packagist

Want to play Dr Mario or Pokémon on your server terminal? That's for you!

Table of Contents

Why

Some people will ask me: "Why you did that?"

Well, a friend asked me "What PHP can do?". I thought about that awhile and the idea came up. With PHP7's performance improvement now it's possible to emulate some systems 😄 and, come on, that's funny! 👯

It's based on the GameBoy JS Emulator.

Requirements

The following PHP versions are supported:

  • PHP 5.6
  • PHP 7
  • HHVM

You will need a good terminal! I've tested only on MacOSX and Linux. I'm sorry about that Windows guys 😞

Running

Before: Put your ROMs files (.gb or .gbc) on "roms/" folder.

$ composer install -o
$ bin/php-gameboy drmario.gb
$ bin/php-gameboy pokemon.gbc

Controls

_n_________________
|_|_______________|_|
|  ,-------------.  |
| |  .---------.  | |
| |  |         |  | |
| |  |         |  | |
| |  |         |  | |
| |  |         |  | |
| |  `---------'  | |
| `---------------' |
|   _               |
| _|W|_         ,-. |
||A   D|   ,-. "._,"|
|  |S|    "._," Dot |
|    _  _ Comma     |
|   // //           |
|  // //    \\\\\\  |
|  N  M      \\\\\\ ,
|________...______,"
  • Left = A
  • Up = W
  • Down = S
  • Right = D
  • A = Comma (,)
  • B = Dot (.)
  • Select = N
  • Start = M

Tests

You can use the following command to run the most common checks, such as php -l, phpcs:

$ ant check

TO-DO

Converting from the JS paradigm was a lot of work, and I still need to adapt somethings like:

  • Code standard - PSRs, please!
  • Array of functions - Maybe in PHP it's not the best approach
  • Pixel auxiliary array - Very CPU intersive to convert RGBA every time
  • Classes - Core is too big!
  • Profiling and otimizing - XHProf to find the most intensive functions
  • Save/Restore - I need to save my Pokémon, please!

Credits

@gabrielrcouto

Legal

The purpose of this project was to study all the capabilities of PHP.

It does not have any commercial or profitable intentions.

The user is responsible to use this code and its content in the terms of the law.

The author is completely against piracy and respects all the copyrights, trademarks and patents of Nintendo.

About

A PHP Terminal GameBoy Emulator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%