Programmer / Web Developer
San Antonio, TX
January 1996
Derp Derp Code
For Love of Pinball
Learn Unity/C#
Awesome Thoery Idle
Many years ago, 2008 if my guess is right, I had the idea to write a random dungeon generator. I succeeded but left it somewhat unfinished. I picked that little project back up in mid/late 2018 as part of my Awesome Theory 2.0 project. I am going to deconstruct it piece by piece in order to better understand what the heck I did 10+ years ago. I won't lie, some of the code is brilliant in my opinion, but some of my past decisions are hard to understand. Note that this is one way to accomplish this - there are probably many other better ways. This is just what I came up with to solve the problem.
First things first, the actual construction of a dungeon should be a function, and so...(more)
Alright, please check out Part 1 if you haven't yet. Cool? Now we start moving on to an area where I am not 100% sure what I was thinking, but it works. It the previous article, we set up the dungeon and its parameters, so now it is time to actually build the thing one square at a time. I do this in a wonky way, probably quite suboptimal, but that is why there are two derps before I get to the code. I remember struggling with all of this quite a bit when I was originally writing it - some things just took a while to figure out.
for ($x = 1; $x <= 15; $x++) {
start_snake();
}
...(more)Tags: Awesome Theory code dungeon generator functions globals random
Known Bugs
Tags list: top margin errors when only one item on a line