Unlike Wolfenstein 3D which is really processed in 2D and needs a single pass per vertical line on the screen, Wolfesteiny operates fully in 3D. Here we use some good old brute force: A fixed step raymarcher. Adding 8 to the angle gives a decent approximation of Math.sin. In order to save 4 bytes with the trigonometry code where two s and Math.sin are needed, an alias is created for s alone. T=300 fo -> ░░░░░░░░ ░█░░░░░█ clear pathĪs mentioned above, the camera moves on a straight line, from left to right, indefinitely and looks alternatively left and right by as much as 0.125 radians as time goes by. Choosing this specific character cleared a straight line in the map which allowed to have a simple camera path. In other words any of the following characters !"#$%&'()*+,. Looking at the ASCII codes used in that string, I decided to place a building for each character that is or comes before the character. Since the source code is quite short, it was only possible to have an 8 by 8 grid which maps to the first 64 characters of the main loop. Indeed, placing the source code of the main loop into a variable allows us to compare the characters of that string and use it as a map of the empty/solid cell on a grid. So how on Earth does it work ? Tiny castleĪt such small size, there is no space to store or generate a map, so we are left with using the only data we have: The source code. You have to think out the box and use some less than subtle techniques. With only 251 bytes there is no space to store data, change many properties, generate things procedurally. That's it: 251 bytes of dungeon horror! How does it work ? Since you are here, chances are you will appreciate watching the development version of wolfensteiny which shows the map with the position of the camera and its view cone, along the time to render the frame. Rendering some sort of axis aligned dungeons like the ones from Wolfenstein 3D should be a breeze, and it was. Looking back at the code of TEA STORM and MINI DISTRICT, I realized that the setup I got there had a lot more potential. 1109 words ~ 5-10 mins - Mathieu 'p01' Henri on October 15th, 2013 WOLFENSTEINYĪn homage to Wolfenstein 3D in 251 bytes of HTML5
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |