Real-time Shader, Running On A Game Boy Color

[Danny Spencer] has a brilliant graphical demo that, like all great demos, flexes a deep understanding of the underlying system: a real-time 3D shader on the Game Boy Color.

If you’re not familiar with shaders, they were originally mathematical lighting models (hence the name) and are an integral part of the modern 3D graphics pipeline. One no longer draws pixels directly to a screen to represent objects. Instead, 3D object data is sent to the Graphics Processing Unit (GPU) which handles the drawing. Shaders are what control things like an object’s lighting, textures, and more.

Implementing even a basic real-time shader in software on a Game Boy Color is pretty wild. Not only is it a pixels-and-sprites (and not 3D graphics) kind of system, but the Game Boy’s SM83 CPU doesn’t even have a multiply instruction, nor does it support floats. As [Danny] puts it: given that the entire mathematical foundation of his shader rests on multiplying non-integer numbers, he had to get creative. That makes his demo a very round peg in an extremely square hole.

In the case of [Danny]’s demo, the user can manipulate the position of, and lighting around, a classic Utah teapot in real time. He explains the workflow and shows how the process can be applied to other objects. The ROM is available on GitHub and there’s a video, embedded below.

[Danny] is no stranger to performing feats of technical prowess that are as creative as they are playful, like implementing a working adding machine in a DOOM level.

Continue reading “Real-time Shader, Running On A Game Boy Color”

Running In Printf

You may or may not know, but printf is a Turing-complete language, once you exploit all the strange and wonderful format characters in it (especially %n). But who has time to write code as printf modifiers? Now, thanks to [sebsite], you can at least write in a slightly higher level assembly language and compile to printf. Practical? No. Cool? Undeniably.

As an example, the page shows fizzbuzz written in the assembler:

<pre><code>alias i, fizz, buzz

->fizz ([i] + 1) % 3 == 0
->buzz ([i] + 1) % 5 == 0
->i [i] + 1
->exit [i] == 100

[i] if !![i] & ![fizz] & ![buzz]
"Fizz" if [fizz]
"Buzz" if [buzz]
"\n" if [i]</code></pre>
<pre>

The alias keyword defines constants and, owing to default values, sets i to zero, fizz to one, and buzz to 2. The “arrow” statements store a result into a variable (so the first assignment sets the resulting value into fizz).

Continue reading “Running In Printf”

Ask Hackaday: Do You Have A Dead Man’s Switch?

During the Cold War, the specter of a nuclear “dead man’s switch” was central to the concept of Mutually Assured Destruction (MAD). In the event that one side was annihilated by the other, an automated system would be triggered to deliver a revenge strike that would ultimately destroy the attacker. It was the ultimate defense, as your enemy will never attack if they know doing so will inevitably lead to their own destruction.

The same idea has occasionally been employed by whistleblowers and journalists as well. Should the individual fail to check in regularly, a series of predetermined events will be set into motion. Again, the idea is defensive in nature. If somebody is in possession of information so damning that they could be abducted or even killed to keep it quiet, making arrangements to have that information be released to the public in the event anything should happen to them is a great way to stay safe.

A nuclear dead man’s switch is a key plot point in Dr. Strangelove.

But what about for the average person? In the past, there was no need for most people to think about something as elaborate as a dead man’s switch. But we live in interesting times, to say the least. In an information society such as ours, whistleblowers have never been more common, and the Internet has significantly blurred the definition of what it means to be a journalist.

For those living under a repressive regime or in a war zone, simply posting to social media can provide the outside world with an unfiltered look at what’s actually happening on the ground. A teenager with a cell phone has the potential to reach a wider audience than the legacy media — a powerful, but dangerous, proposition.

Even if you’re not in the middle of political upheaval, there are still reasons you might want to have previously secret information made available in the event of your death or incapacitation. Perhaps you’d like to send your loved ones a final personal message, or make sure the passwords for all your accounts get in the hands of whoever will be handling your estate.

Of course, one could argue that could be accomplished with little more than a notebook hidden in your sock drawer. But this is Hackaday, and over-engineering is the name of the game. So do you have a dead man’s switch? How is it implemented? Or is the whole idea just a bit too out there for you?

Continue reading “Ask Hackaday: Do You Have A Dead Man’s Switch?”

Sliderule Simulator Teaches You How To Do Calculations The Old Fashioned Way

Ever wanted to know how engineers made their calculations before digital calculators were on every workbench? [Richard Carpenter] and [Robert Wolf] have just the thing—a sliderule simulator that can teach you how to do a whole bunch of complex calculations the old fashioned way!

The simulator is a digital recreation of the Hemmi/Post 1460 Versalog slide rule. This was a particularly capable tool that was sold from 1951 to 1975 and is widely regarded as one of the best slide rules ever made. It can do all kinds of useful calculations for you just by sliding the scales and the cursor appropriately, from square roots to trigonometry to exponents and even multi-stage multiplication and divisions.

You can try the simulator yourself in a full-screen window here. It’s written in JavaScript and runs entirely in the browser. If you’ve never used a slide rule before, you might be lost as you drag the center slide and cursor around. Fear not, though. The simulator actually shows you how to use it. You can tap in an equation, and the simulator will both spit out a list of instructions to perform the calculation and animate it on the slide rule itself. There are even a list of “lessons” and “tests” that will teach you how to use the device and see if you’ve got the techniques down pat. It’s the sort of educational tool that would have been a great boon to budding engineers in the mid-20th century. With that said, most of them managed to figure it out with the paper manuals on their own, anyway.

We’ve featured other guides on how to use this beautiful, if archaic calculation technology, too. We love to see this sort of thing, so don’t hesitate to notify the tipsline if you’ve found a way to bring the slide rule back to relevance in the modern era!

Thanks to [Stephen Walters] for the tip!

An Open Source Client For World Of Warcraft

When World of Warcraft was launched in 2004, it became somewhat of a juggernaut in the MMORPG space. Millions of players continue to login every month. [Kelsi Davis] is one such player, but she doesn’t always log in with the regular client anymore. That’s because she put together WoWee—an open-source alternative of her very own.

WoWee is an acronym—World of Warcraft Engine Experiment. Coded in native C++, it’s a homebrewed client that uses a custom OpenGL renderer to display the game world. [Kelsi] notes that it’s strictly an “educational/research” project, built without using any official Blizzard assets, data or code. Instead, it grabs some client data from a legally-obtained install to operate and loads certain assets this way.

It’s currently compatible with the vanilla game as well as The Burning Crusade and Wrath of the Lich King expansions. It should be highlighted how much work this project has already involved—with [Kelsi] needing to recreate various functional minutae in the game, from character creation screens to weather systems and skyboxes. There’s still a lot to do, as well, like adding 3D audio support and making it more interoperable with the quest system.

It’s rare that any MMO gets an open-source client, even less so while the original game is still being actively supported by the developers. Still, we do see some creative hacks in this space.

Continue reading “An Open Source Client For World Of Warcraft

An animated set of circles and lines are drawn on a black screen. Meanwhile, in a smaller window in the lower right corner, the boot screen of a Game Boy is displayed.

Running Pokémon With A Compass And Straightedge

The ancient question of whether or not it’s possible to construct a circle with the same area as a given square using only a drawing compass and straightedge was finally answered in 1882, where it was proved that pi is a transcendental number, meaning it cannot be accurately represented in a compass-and-straightedge system. This inability to accurately represent pi is just one of the ways in which these systems resemble a computer, a similarity that [0x0mer] explored in CasNum.

The core of the program represents operations with a drawing compass and unmarked straightedge. There are only a few operations that can be used for calculation: constructing a line through two points, constructing a circle centered at one point and intersecting another point, and constructing the intersection(s) of two lines, a line and a circle, or two circles. An optional viewer visualizes these operations. Another class builds on top of this basic environment to perform arithmetic and logical operations, representing numbers as points in the Cartesian plane. To add two numbers, for example, it constructs the midpoint between them, then doubles the distance from the origin.

There are some examples available, including the RSA algorithm. [0x0mer] also altered a Game Boy emulator to implement the ALU instructions using compass and straightedge operations. In testing, it took about fifteen minutes to boot, and runs at a “totally almost playable” speed, near one FPS. This is after extensive caching has been applied to minimize computation time; the performance here is impressive, but in a more qualitative than quantitative sense.

Being virtual, this system is discrete, but a physical compass and straightedge form a simple analog computer capable of dealing with continuous values.

Bash Via Transpiler

It is no secret that we often use and abuse bash to write things that ought to be in a different language. But bash does have its attractions. In the modern world, it is practically everywhere. It can also be very expressive, but perhaps hard to read.

We’ve talked about Amber before, a language that is made to be easier to read and write, but transpiles to bash so it can run anywhere. The FOSDEM 2026 conference featured a paper by [Daniele Scasciafratte] that shows how to best use Amber. If you prefer slides to a video, you can read a copy of the presentation.

Continue reading “Bash Via Transpiler”