We've kind of reached a point in Miner Threat where almost all of the changes are behind the scenes, and thus results in very few images for the dev blogs. This applies here, because there is nothing to take a screenshot or GIF of, so I'll just give a bunch of action shots because it's ridiculous to send out a dev blog with no visual content.
So what was fixed? Well, even though you don't care about bug fixes in a game you've never played, I'll tell you anyway. There was a bug that prevented the dungeon generator from working, but, I fixed it. Because that's what I do.
Aside from non-major bug fixes, there were two changes made that were rather essential, in the fact of difficulty. There is now a chance for enemies to spawn double their normal size, and twice as powerful, just to spice things up. They do award more points, however. The other part is something I should have implemented a while ago. The enemy strength now scales with the level you're on, so that's good.
I'm really scraping the bottom of the barrel for these.
And now, I decided I would do something else to spice up this blog. I would tell you how the dungeon generation works. I tend do enjoy learning about things like this, so maybe someone else does.
There is one main concept behind it you should know before I explain it. The room is based on 16*16 chunks. The room is composed of an 8 * 8 grid of these chunks. Each chunk is actually just a 16 * 16 bitmap image with each pixel representing a different block. Here is a scaled up chunk, that would be in between 2 blocks horizontally.
You can probably tell what it means. Red is enemies, black is walls, white is nothing. There are more than that, but that is the main bit. There are more than a few types of these though. We need
- Left - right ones
- Up - down ones
- Left - up
- Right - up
So there is a whole ton of them just chalk full of little sprites that determine everything. Now that you know of the chunks, you need to know how the game decides to place them. To pick which chunk we need to make a proper path from start to finish, we need to know 3 things. For one, what the last block was, two, what the next one is, and 3, where we are. So how does it fix this? Obviously it can't predict what the next one will be, so it waits until the next 'turn' and solves for the last one. But how does it really pick it?
Well, first, we need a path for the blocks to go. So phase one of the generation is make a path. It might look something like:
I'm not going to to into how it comes up with that, but it does. So now that we have that down, this is what it looks like when it's figuring out what to place. First, it needs to know the angle between the last block and the current block. This helps figure out turns. Then, it checks what the last one was, and places a block accordingly.
Using that data, it can come up with what block it needs. In that case, we need a left - up block. So the computer would say "if the angle is 315 degrees and the last block was a right-left, and the next one is above this block, we will use a left - up block." Then anything else is given a random self-contained block, filling up the room.
Well now you can brag to all your friends you know how the Miner Threat dungeon generator works!
Anyways, remember to tune in next week, and have a great weekend m8s!