JUMPSCARE Source Code and Post-Mortem
Hello everyone! I know I promised to upload the source code for the game earlier, but I twisted my ankle a while back and had to focus on some self-care. I'm feeling well enough now to talk about JUMPSCARE and the challenge of working within the limits of DungeonScript to create a unique game.

---

After having worked with DungeonScript once before in a self-imposed 4 hour challenge, I searched itch.io and the rest of the web for other examples of DS games; sadly, that turned up only a handful of results. PuzzleScript was a fairly popular engine on itch.io and had plenty of games on its page. I was confused as to why there wasn't much for DS, seeing as to how it's essentially the same programming language.

With PS games, players can view the entire level from a top-down view, making it somewhat easier to plan out your moves. DS, on the other hand, uses a default first person POV, which makes puzzle solving just a tad more difficult by forcing players to explore the area as they interact with the puzzle. I feel that the difference in perspective can really change how people approach a game. Personally, most games that use a first person POV are a lot scarier to me... With that in mind, I wanted to see if I could create a horror game in this engine. YuriJam 2018 was the perfect opportunity to do that as the deadline was close to Halloween.

The two biggest challenges for me during development was figuring out how to make clear loss conditions for the player and creating the voxel art. I tackled the latter first, as I wanted to make sure I could set up the proper atmosphere for a horror game. As one can imagine, typing out voxels is tedious as hell. To make sprites in PS, one simply needs to type in a pattern that has even dimensions (5x5 or 8x8, and so forth); meanwhile in DS, you need to layer your voxels from top-to-bottom. This means really awkward blocks of code that looks like this:

JiangShi
motionvoxel
step
red black darkgrey lightbrown
&
.......
.......
.......
...0...
.......
.......
.......
&
.......
.......
..111..
..111..
..111..
...3...
.......
&
.......
.......
..222..
..222..
..222..
...3...
.......
&
.......
.......
..222..
..222..
..222..
...3...
.......
&
.......
.......
.11111.
.11111.
.11111.
.......
.......
&
.......
.......
.11111.
.11111.
.11111.
.1...1.
.2...2.
&
.......
.......
..111..
..111..
..111..
.......
.......
&
.......
.......
..1.1..
..1.1..
..1.1..
.......
.......
&
.......
.......
..1.1..
..1.1..
..1.1..
.......
.......

It's not hard per se, but it was definitely frustrating to make sure I typed it in facing the correct direction...

Luckily, some of the other visual effects were easier to implement. DS has extra rendering settings that one can include in the Prelude of the game, of which I used view_distance and fog_power. That was key to creating a spooky environment.

As for the technical side of things, the nice thing about PS and DS is that the way code works is very human-friendly to the eyes. As an example straight from documentation, a rule of [ > Player | Crate ] -> [ > Player | > Crate ] means that when the Player moves towards the Crate, the Player will go into the tile where the Crate originally was and the Crate itself will move forward one tile. However, while it is simple to create the game logic in this way, I did have to write several lines that all accomplished the same thing.

[ > JiangShi | QingGe_STILL ] -> [ JiangShi | Corpse ] Message "AAAAAAAAAAAAAHHHHHH!!!"
[ > JiangShi | QingGe_MOVE ] -> [ JiangShi | Corpse ] Message "AAAAAAAAAAAAAHHHHHH!!!"
[ > JiangShi_UP | QingGe_STILL ] -> [ JiangShi_UP | Corpse ] Message "AAAAAAAAAAAAAHHHHHH!!!"
[ > JiangShi_UP | QingGe_MOVE ] -> [ JiangShi_UP | Corpse ] Message "AAAAAAAAAAAAAHHHHHH!!!"
[ > JiangShi_DOWN | QingGe_STILL ] -> [ JiangShi_DOWN | Corpse ] Message "AAAAAAAAAAAAAHHHHHH!!!"
[ > JiangShi_DOWN | QingGe_MOVE ] -> [ JiangShi_DOWN | Corpse ] Message "AAAAAAAAAAAAAHHHHHH!!!"
[ > JiangShi_LEFT | QingGe_STILL ] -> [ JiangShi_LEFT | Corpse ] Message "AAAAAAAAAAAAAHHHHHH!!!"
[ > JiangShi_LEFT | QingGe_MOVE ] -> [ JiangShi_LEFT | Corpse ] Message "AAAAAAAAAAAAAHHHHHH!!!"
[ > JiangShi_RIGHT | QingGe_STILL ] -> [ JiangShi_RIGHT | Corpse ] Message "AAAAAAAAAAAAAHHHHHH!!!"
[ > JiangShi_RIGHT | QingGe_MOVE ] -> [ JiangShi_RIGHT | Corpse ] Message "AAAAAAAAAAAAAHHHHHH!!!"

(That's still not as much screaming as I did myself.)

In the event any JiangShi reach QingGe before you, she will turn into a JiangShi herself, rendering you unable to win the stage.

==============
WINCONDITIONS
==============
All Player on Target
All QingGe_MOVE on Target

No QingGe_STILL
No Corpse

But that still isn't exactly losing the stage, as the player can continue to dodge the JiangShi until one catches them. The solution to this problem is rather roundabout.

[ > JiangShi | Player ] -> [ JiangShi | Death ] Message GAME OVER
[ > JiangShi_UP | Player ] -> [ JiangShi_UP | Death ] Message GAME OVER
[ > JiangShi_DOWN | Player ] -> [ JiangShi_DOWN | Death ] Message GAME OVER
[ > JiangShi_LEFT | Player ] -> [ JiangShi_LEFT | Death ] Message GAME OVER
[ > JiangShi_RIGHT | Player ] -> [ JiangShi_RIGHT | Death ] Message GAME OVER

[ Corpse | ... | Player ] -> [ randomDir Corpse | ... | Player ]
[ > Corpse | Player ] -> [ Corpse | Death ] Message GAME OVER

late [ Death ] -> [ GAMEOVER ] again
[ GAMEOVER ] -> restart

The use of late lets the engine know that we want this rule to run after the previous rule.  To clarify, [ > Corpse | Player ] -> [ Corpse | Death ] Message GAME OVER is a rule where the Player turns into Death. It is also a rule where a Message is displayed. The Message will appear first, then the effects of being Death will occur. Death then turns into GAMEOVER. You will notice that the rule in which that occurs is followed by again, which causes a short pause before another turn takes place without player input. The turn that comes afterwards is a rule that states that GAMEOVER results in a restart. restart will only take you back to the beginning of the current level, but this works well enough for our purposes.

There were certain things that I had wanted to include but couldn't find a way to implement it, such as the use of items to combat the JiangShi with. Mirrors, torches, and bags of coins to scare or distract JiangShi would have been a nice addition to the game if only I knew how to write those rules in. Another requested feature was sound effects to let players know how close the JiangShi were; unfortunately, there is no way to control the volume of any sfx so I could not add them in without the game constantly making sounds each turn.

Would I recommend PS/DS to anyone else wanting to make an HTML5 puzzle game? Probably. Would I recommend it to anyone trying to make a different genre of game? Maybe not. The engine allows developers to create a working game in minutes, but anything more complex won't be easy to accomplish. Still, I personally had fun and may return to it in the future, perhaps to make a dungeon crawler like Farbs had intended the engine for.

Thank you for taking the time to read this. Until next time!