Bring the earthquake to life with hacked light



[ad_1]

If you ever feel a pang that you have been reusing the same code snippets in your projects for years, don’t. Even the big names do, as evidenced by the fact that the code written to govern flickering lights in 1996 for earthquake is still used in AAA titles like the one of 2020 Half-life: Alyx. In honor of this iconic example of digital buck-passing, [Rodrigo Feliciano] thought he would port the code in question to the Arduino and recreate the effect in real life.

Since the Quake engine was released under GPLv2, it is easy to view the appropriate section of the code to see how the lighting has been configured. Interestingly, the lighting patterns were implemented in the form of strings, where the letters of a To With refers to the brightness of the light. So, for example, a strobe light that goes between minimum and maximum brightness would be written as “aaaaaaaazzzzzzzz”, while a flickering light could be represented with the string nmonqnmomnmomomno“.

Emergency lighting provided the LEDs and the housing.

It ended up being very easy to implement on the Arduino in a few lines, because [Rodrigo] it was enough to assign each letter in the string a numeric value between 0 and 255 using map, then use the resulting number to adjust the brightness of the LED with analogWrite.

With the code written, [Rodrigo] then had to assemble the hardware. He did away with basic emergency lighting to get a set of white LEDs and a practical housing. He also wired a simple solid-state circuit on a piece of punch board so that the Arduino Pro Mini could control all of the LEDs from a single GPIO pin. Combined with a long USB cable to power it, it has a perfect desk accessory for nighttime gaming sessions.

In the video below you can see the end result, which [Rodrigo] even synchronized footage from the classic 1996 shooter. Light is an interesting topic of conversation, but we think the next logical step is to incorporate this technique into an ambilight-like system to really make it look like you are yourself. stroll through these dimly lit corridors.

[ad_2]

Source link