The Sorcerer’s Dungeon

Download The Sorcerer’s Dungeon from

Watch Gameplay video

Last month’s theme was TUNNELS. I gave a good amount of thought to what game I would like to make, and I decided I would remake an old Commodore 64 game called Loopz. This is a puzzle game where the player gets differently shaped pieces and has to place them so they form a closed loop, disappearing and giving score. The goal of the game is to survive for as long as possible, getting as much score as possible. So, this was the basis of my game, with some small modifications. I put a little story behind the game with a cutscene at the start and the end of story mode. The apprentice calls the sorcerer “shalafi” which was a title in the Dragon Lance books, meaning master, at least as far as I can remember. This was a nod to those books as I like that world very much. Also, this mode has a timer, and after that counts down, (though I never actually said it in the story, only implied) the apprentice character’s spell finally works, and teleports the sorcerer into the dungeon level, putting him in harm’s way. The game also has monsters, that walk around, and if they happen to be inside a loop (tunnels) when it closes, they give a nice sum of points. As does the sorcerer if he’s closed in, as the story mode ends with his demise.

The game features a short timer too, it shows how long a tunnel piece can be held with magic and moved around. If time runs out before the tunnel piece is manually placed, the tunnel automatically drops. If there are no previously placed tunnels there (indicated by a tunnel icon), the one you moved around will be placed there. If there is another piece already under it (indicated by a skull), it’s game over: the sorcerer shoots at the apprentice, killing him. There is an ever-increasing target score: this shows that if you get enough points, the level resets, removing the unused tunnel pieces. I also made an infinity mode, with no timer, where is no sorcerer at the end, only the target score and your wits and luck.

Eventually, I finished the base game one week before the deadline. Not that it was easy: I struggled to make a working loop checker, I ran to it four times with three variants when finally, I was able to make it work. I wanted to make a small object that runs through the loop/half loop, and if it gets back to its original place, the loop is complete. I tried to use small spikes at the end of each tunnel piece, making them connect. Finally, I made a ds_list of every piece that was able to hit the next one, putting on the list, fidgeting around, seeing if a new connection is made, until it hits the starting object. The loop is then complete, they disappear and give score.In order for this to work, I used mask sprites that are thinner than the pieces themselves (basically the inside part of them). I also had to break down a U-shaped piece into 3 smaller ones so the loop checker would work properly. This can be seen, if you remember where you put it, when the sorcerer destroys placed tunnel pieces, and the U-shape suddenly turns out to be a small corner, a small L-corner and a small straight piece.

I also spent a lot of time with the monster AI. It seems simple enough, but it’s 600 lines of code. I didn’t use any built-in pathfinding, as I knew I had to navigate the monsters outside AND inside the tunnels. Instead, I move them around, and when not bothered by special cases, they choose a path where they don’t go back to their previous position (so if they stepped from the right, they would go only left, up or down). Special cases are the level borders and the tunnel walls, they turn around or even back away from those. And also, if they wander inside, or you deliberately trap them in tunnels, they are forced to go inside until they reach the other end – or close them in a full loop and get extra points. I hope I actually managed to cover every situation that can occur combining tunnels, level borders and tunnel insides, and that they behave accordingly. This may seem like lot of processing, but these checks and decision-makings happen only if a monster reaches the grid’s middle, so depending on its speed, every half a second or so. They need some special attention by the player, since they can step out of a tunnel as easily as they can be trapped inside. But if the player recognizes their behavior, they can be herded and trapped near almost finished loops, just like you have to do with the sorcerer.

So, as I mentioned, I finished somewhat early. I also spent some time starting to build up an asset park, with stuff I use frequently. Combined with the fact that I moved to 2.3, I see now why functions are good. I made importable assets for crawling text, some draw surface effects, sparks, save-load functions, flash shader, flying text, updated/repaired HP bars, keyboard and gamepad controls, laser effect and projectile, timer, the excellent tweens, and my old viewport camera system. I also made a text typer, arcade style, where you get a screen with a bunch of letters and characters, choose a character and “type” in a name. It works as a skipcode (I used its predecessor in The Black Lamp) or a high score name enterer. I also made a high score handler, dynamically handling the insertion of a new high score and a name.

All in all, I did a lot. Sometimes I still feel like I don’t know much in GM. And it was just yesterday, when my permanent subscription was terminated and basically converted to a 17-month free sub. I am not particularly happy with this turn of events. I was OK with the desktop export one-time-fee version, and I was thinking about a web export license. Now they combined desktop, web, mobile, uwp, and some other stuff under indie license, monthly or yearly sub. And they have a much more expensive license for consoles. The free version is also returned, as it was one month long only for a time, now it’s just free, but you cannot export to anything. We’ll see where this thing is going.