Part 1.1: Game Boy emulator
So I made a Game Boy emulator in Java somewhat recently. While it doesn't have sound (I still need to figure out a good way to program sound), it works pretty well, and it can actually run some games better than any other Java Game Boy emulator I've seen on the Internet.
Here's a video, with some lovely (read: bad, lol) music by yours truly: https://www.youtube.com/watch?v=JhX8ImUfUIc
Part 1.2: Making a Game Boy game
Inspired by the Game Boy emulator, I decided to try making a Game Boy game, purely for fun. I decided to port Celeste, the classic PICO-8 game, to it. For reference, here's a video of someone playing the official C# port of it: https://www.youtube.com/watch?v=VR3x5d8xIKk
and here's an image that I got off the Internet:
Graciously, Celeste creators Maddy and Noel released the source of the C# port on GitHub. (Link: https://github.com/NoelFB/Celeste/tree/ ... rce/PICO-8) Therefore, my approach to creating the Game Boy version is simply to look at the code and translate it line-by-line to assembly. Here's what I have so far:
screenshot of super old version (above video is newer):
Because I'm new to the Game Boy, I decided to fit the entire game within 32 KB, the size of the Game Boy's address space without bank switching.
I ran into the following technical challenges:
- Compressing each screen's graphics. I came up with an encoding scheme I'm very proud of, that can compress a 20x16 tile screen into ~160 bytes, so about 50% compression. With 32 KB, I can fit more than 3x the rooms featured in the original game (which had 31 rooms).
- Fixed point number representation. For the main character's X/Y position, I have two bytes - whole and fractional. (I bet that's standard.) For acceleration, however, at one point I had the same 2-byte representation, though with a signed whole component. But at some point I changed the acceleration code to use a 1-byte representation (1 bit sign, 3 bit whole component, and 4 bit fractional component). I semi-regret doing that now, but I feel like I'm currently too deep in to change it all back, lol.
- An object system. I am still wrestling in my head about whether I should have a bunch of indexed variables (a "structure of arrays") or regular objects (an "array of structures"). I know of the saying, "if it's hard to decide between two things, then most likely it's because they're both good choices", but I'm still afraid I'll make the bad choice. As such, the player character is still my only object right now.
Two other thoughts:
- The physics in my Game Boy version aren't the same as the original, despite my copying the code line for line... like, at all. To the point where the original game runs at 30 FPS and my Game Boy version runs at 60, and I barely noticed, lol. Darn floating point logic! lol. But I figure I will tweak the numbers later.
- I've never written anything serious in assembly before, let alone anything for Game Boy. I always worry that my code will be too slow for Game Boy, but am constantly impressed by how seemingly little CPU all the character physics and collision uses.
Part 2: Moving on to the NES
Because I wanted the same knowledge about the NES that I do of the Game Boy, I decided to try to write an NES emulator. But upon researching it, it seems like a far more complex system than the Game Boy, and that's not even including the mappers. With two different buses and some odd PPU quirks, it just didn't seem like as fun of a project. I still may do it in the future, but I can't say my research left me feeling excited and jazzed to do it.
Then, a couple days ago I decided to play with the "complete disassembly of Super Mario Bros." and made some small changes. in particular, I made it so when Mario gets hit with a Fire Flower, he goes back to Super Mario instead of straight to Small Mario. It was fun, but for some reason, I just got really annoyed with the 6502 assembly. It's nowhere as good as the Game Boy's Z80-like processor, with its many registers and more useful opcodes.
Part 3: The point of this post?
Now I know I'm on NESDev.com, but I was curious about what you thought about Game Boy development vs NES development. Do you think it's easier? Or harder? More or less fun? And why do there seem to be fewer communities centered around GB development? Do you think it would be worth pursuing the NES over the Game Boy?
(In addition, feel free to talk about anything of mine from the post.)
I don't know the purpose of this post, except that I (for some weird reason) visit specifically the General Stuff subforum on NESDev as part of my daily Internet rounds, and I kinda just wanted to talk about the Game Boy, lol. But if you read it all, thanks!