Taking Pokémon On A Walk

Emulating old computers or video game systems isn’t always about recreating childhood nostalgia or playing classics on hardware that doesn’t exist anymore. A lot of the time it can be an excellent way to learn about the mechanics of programming a video game. Plenty of older titles have available source code that anyone can pour over and modify, and one of those is Pokémon Emerald. This was the first Pokémon game that [Inkbox] played, and he added a few modern features to it with this custom ROM file.

The first thing to add to this game was the ability to have one’s Pokémon follow their character around in the overworld map. This is common in later games, but wasn’t yet a feature when Emerald and Ruby first came out. [Inkbox] needed to import sprites from later games into the Emerald game file, convert their color palettes to match the game’s palette, and then get to work on the mechanics. After everything was finished, the Pokémon not only follow the player around the map but are animated, enter and exit their Pokéballs, and even jump off ledges in a believable, 32-bit way.

One of the great things about older games like these is that they’ve been around long enough to have source code or decompiled code available, they often have plenty of documentation, and the platforms they operate on are well-known by now as well. Pokémon Emerald is not alone in this regard; in fact, there is a huge Game Boy Advance homebrew scene that is not too difficult to get involved in.

Continue reading “Taking Pokémon On A Walk”

Mindblowing Graphics From An ATtiny85

[Görg Pflug] wrote in with his really nice graphics library. It’s got multiple layers, two text consoles, greyscale, internal halftoning, and sprites. It can pull off a number of classic graphics tricks and demos. Oh yeah, and did we mention it runs on a freaking ATtiny85 and an I2C OLED screen?!

This is an amazing piece of work — if you’d asked us if this was possible, we would have probably said “no”. And now it’s yours to use in your own projects. The GitHub repo is full of demos showing off everything from switching between multiple layers, extremely rapid text scrolls, animations, boing balls, and even a Wolfenstein-style raycaster. On an ATtiny85.

There’s a demo video, embedded below, that shows it all off, but honestly you have to think about what’s going to to be suitably wowed. The first demo just seems to have a graphic wave over static text, for instance. No big deal? It’s blending the greyscale layers together and dithering them out to black and white for the OLED in real time! On an ATtiny85.

While the library is written in straight C++, there are even a couple examples of how you’d integrate this with Arduino’s Wire library if you so wished. We don’t know about you, but this makes us want to whip together an ATtiny85 and SSD1306 OLED demo board just to start playing around. This isn’t just an amazing hack, but it would also be a useful way to add graphics and a nice console to any project you’re working on.

Did we mention it’s all done on an ATtiny85?  Over I2C? Kudos!

Continue reading “Mindblowing Graphics From An ATtiny85”

Snakes And Ladders: Game Boy Emulator In Python

If a Game Boy was a part of your childhood, you were probably more than once dreaming of spending your entire school day with it. Well, they had to wait a few more years for that, but eventually in 2015, [Asger], [baekalfen], and [troelsy] made that dream reality when they created a Game Boy emulator in Python for a university project. However, it didn’t stop there, and the emulator has since grown into a full-blown open source project, PyBoy, which just reached the version 1.0 release.

Since it started out as an academic project, the three of them had to do their research accordingly, so the background and theory about the Game Boy’s internal functionality and the emulator they wrote is summarized in a report published along with the source code. There is still some work to be done, and sadly there is no sound support implemented yet, but for the most part it’s fully functional and let’s you successfully play your own extracted cartridges, or any ROM file you happen to have in your possession.

Being an emulator, you can also inspect its inner life when run in debug mode, and watch the sprites, tiles, and data as you play, plus do cool things like play the emulation in reverse as shown in the clip below. Even more so, you can just load the instance in your own Python scripts, and start writing your own bots for your games — something’s we’ve seen in action for the NES before. And if you want to dive really deep into the world of the Game Boy, you should definitely watch the 33c3 talk about it.

Continue reading “Snakes And Ladders: Game Boy Emulator In Python”

Blackjack Game Plays With The Limits Of PyPortal

It’s that time of year again, when fall is quickly ushered out to make room for all things holiday-related. For many of us, this means going on trips to visit relatives, which, depending on the relatives, can mean soul-crushing boredom. [Andy] has fun relatives who frequent the casino tables, and they inspired him to brush up on his blackjack game.

Some people would just find a virtual blackjack table or bust out an actual deck of cards to practice, but this is Hackaday. [Andy] busted out his PyPortal and tried his hand at making a blackjack game. The PyPortal is an Adafruit IoT box that makes it easy to scrape and display all kinds of JSON goodness from around the web, like NASA’s image of the day. GUI building is already baked in, so he just needed some oome open source playing card images and he was off.

The real gamble here might be the code he wrote; at 500+ lines, [Andy]’s probably pushing his luck with the PyPortal. But you know what they say — you can’t win if you don’t play. And if you want to improve your odds of winning, teach a robot to count cards for you.

Thanks for the tip, [foamyguy].

Sprite Graphics Accelerator On An FPGA

A demo running on a FPGA sprite accelerator

Graphics accelerators move operations to hardware, where they can be executed much faster. This is what allows your Raspberry Pi to display high definition video decently. [Andy]’s latest build is a 2D sprite engine, featuring hardware accelerated graphics on an FPGA.

In the simplest mode, the sprite engine just passes commands through to the LCD. This allows for basic control. The fun part sprite mode, which allows for sprites to be loaded onto the FPGA. At that point, you can show, hide, and move the sprite. By overlapping many sprites, you something like the demo shown above.

The FPGA is from Xilinx, and uses their Block RAM IP to store the state of the sprites. The actual sprite data is contained on a 128 Mb external flash chip, since they require significant space.

The game logic runs on a STM32 Cortex M4 microcontroller which communicates with the FPGA and orders the sprites around. The FPGA then deals with generating frames and sending them to the LCD screen, freeing up the microcontroller.

If you’re wondering about the LCD itself, it’s 3.2″, 640 x 360, and taken from a Ericsson U5 Vivaz cellphone. [Andy] has a detailed writeup on reverse engineering it. After the break, he gives us a video overview of the whole system.

Continue reading “Sprite Graphics Accelerator On An FPGA”

Hackaday Links: October 16, 2011

Spinning DNA animation using sprites

[James Bowman] shows a way to use sprites to simulate parts of DNA moving in 3 dimensional space. The animations are driven by an Arduino board and Maple board, which allows a comparison of the processing differences between the two. [Thanks Andrew]

Tiny Pong

This Pong game is so small (translated), you’ll be fighting over who gets a closer view of the screen.

More CNC halftone pieces

[Christian] made a bunch of halftone pictures with a CNC mill. He took the concept from [Metalfusion’s] halftone projects and ran with it. He even posted some video of the machining process (turn down your sound before viewing this one).

Most useless machine

[Jumbleview’s] take on the most useless machine makes the entire lid shut off this rocker switch, instead of using a separate arm for the task.

7400 rectifier

[Noel] is using a couple of 7400 chips in an unorthodox way to form a full-wave rectifier. They’re not powered, but instead used for the internal diodes. It’s his entry in the 7400 contest.