![]() He stripped down a basic emergency light to get an array of white LEDs and a handy enclosure. With the code written, then had to put the hardware together. This ended up being very easy to implement on the Arduino in just a few lines, as simply had to assign each letter in the string a numerical value between 0 and 255 using map, and then use the resulting number to set the LED brightness with analogWrite. An emergency light provided the LEDs and enclosure. 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 “. Interestingly, lighting patterns were implemented as strings, where the letters from a to z referenced how bright the light should appear. Since the Quake engine has been released under the GPLv2, it’s easy to pull up the relevant section of the code to see how the lighting was configured. In honor of this iconic example of digital buck-passing, thought he’d port the code in question over to the Arduino and recreate the effect in real-life. Even the big names do it, as evidenced by the fact that code written to govern flickering lights back in 1996 for Quake is still being used in AAA titles like 2020’s Half-Life: Alyx. ![]() If you ever feel a pang of shame because you’ve been reusing the same snippets of code in your projects for years, don’t. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |