The Terror of Mongolia JS13k Post-mortem (part 2)
Tags: js13k, javascript, gamedev, gamejam
Published: 2023-09-11 14:16:21

Let's continue our post from [The Terror of Mongolia JS13k Post-mortem (part 1)](https://dev.to/jacklehamster/the-terror-of-mongolia-js13k-post-mortem-part-1-33a4). I suggest you read that part first if you haven't already.

Unlike the first post-mortem, this one is more focussing on "design" than "implementation".

To recap, [The Terror of Mongolia](https://js13kgames.com/entries/the-terror-of-mongolia) is a game I've been producing for the [#js13kgames](https://js13kgames.com/entries/2023) game jam, where the entire game has to fit within 13kb. All fun stuff!

So, after submitting the game to [#js13kgames](https://js13kgames.com/entries/2023), I took a break to focus on other things in my life. I was telling me that I wouldn't let myself get distracted by this game jam, while working on more "serious" stuff. Yet, I couldn't let it go. I had to keep poking at it.

So there were a few updates that the game needed to be fully complete, with the file size sitting at ~7-8kb, there was 5kb remaining to be filled with goodies, one being the music.

# Homage to Ennio Morricone

![Ennio Morricone](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j1wtuivm3rpqhju3q8yv.png)

Somehow, I didn't even notice that Ennio Morricone passed away 3 years ago. (RIP bro). I was always a big fan of his music, and even before knowing about his passing, I was already thinking about giving him homage, with covers of his music in my game.

I was just listening to two of his lesser-known songs, overlayed on gameplay footage of "The Terror of Mongolia", and felt a sense of awe. (it mainly came from the music, really). But from there, I decided to give it a try. Let's make a cover of one of those songs, and include that in my game.

## Working with [Soundbox](https://sb.bitsnbites.eu/)

In the past, I was used to produce music with [BeepBox](https://www.beepbox.co/), but I had to look for a lighter solution to fit within the 13kb limit. I looked up the [Resources from the JS13k site](https://js13kgames.github.io/resources/) and played around with all the Sound and Music tools. Soundbox seemed like the only one that was usable enough for me to compose something. Granted it's not as friendly to use as beepbox, but apparently it was fitted for JS13k games.

I started composing a cover of [Ennio Morricone's "Fur Elise"](https://www.youtube.com/watch?v=lcJnYEIWAAI). That's not exactly the title of the song, but that's how I call it. It has a section that cover's [Beethoven's "Fur Elise"](https://www.youtube.com/watch?v=q9bU12gXUyM). So in a sense, I'm following Ennio Morricone's footstep violating his copyright with my cover. And my cover doesn't even have the "Fur Elise" part!

But at last, I got the song. The next headache was to incorporate it into the game. For the longest time, I couldn't figure out how to use the Soundbox small player. The editor was telling me that the song was ~.5kb. When saved in JavaScript, it occupied way more. The binary was pretty small but I had no idea how to play it.
Eventually, I was able to extract some code from [the soundbox Demo](https://gitlab.com/mbitsnbites/soundbox/-/blob/master/demo.html). The whole library, including the song, took a whole 2kb once compressed. And there I was, making big plans for my remaining 5kb...

At the end, I thought music was really important, and worth including. Especially, I wanted a good reason for making gameplay footage overlayed with Ennio Morricone's music. I ended up making a second cover of [Wild Horde](https://www.youtube.com/watch?v=0VHEL7XqoEg) from the movie ["My name is nobody"](https://www.imdb.com/title/tt0070215/), which turned out to be even better than the first one. Both are now in the game.

And you can listen to them separately at this link: https://jacklehamster.github.io/khan-js13k/sound/demo.html

# Gameplay progression

Next, I had to work on the game's progression. As it was, the game was just a survival style game with no end. The play style was similar to [Magic Survival](https://play.google.com/store/apps/details?id=com.vkslrzm.Zombie), but even that game had an end. As much as it was enjoyable to move the horse around and shoot at enemies, I couldn't stand having a game where you endlessly roam around shooting bad guys, until you inevitably die.

So I used "huts" to make sure the player experiences some kind of progression. Each hut has to be visited, then as soon as the player exits a hut, that one is set on fire (I wanted to show that Genghis Khan is a real terror), then the player must move on to the next hut. I added some kind of indicator, to avoid for the player from getting lost.

The huts use the same code as the "trees" explained in the [previous post-mortem](https://dev.to/jacklehamster/the-terror-of-mongolia-js13k-post-mortem-part-1-33a4). Every time we teleport a hut, we reset its state. That way, a burning hut becomes a new hut to visit. And each hut visit increases the difficulty level.

The huts are technically uncapped, but the game does officially end at around 8 huts.

# The shop system

While initially I was imagining a full fletched RPG, with our player visiting several huts, talking with NPCs, and buying equipments in a shop... that didn't materialize. I still think it's important to shoot for ambitious project, even though this one seemed completely unrealistic.
Well at least, I got the shop system part of the RPG. Each hut gives you the option to "buy" items.

I had setup a simple upgrade mechanism. Basically, all upgrades are just numbers on an object that can go from 0 to 3. Then I just had the UI to display options for increasing those number, given a certain cost.

![Shop](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ef3mbq75v2ccxtj73yg5.png)

The game itself didn't have a lot of variety for upgrades, unlike a game like [Hades](https://www.supergiantgames.com/games/hades/) where you have different flavors on a weapon like thunder, ice, protection, wine... I was also thinking along those lines, having a frost arrow, a poison arrow, bomb arrow... But the cold fact of fitting within 13kb brought me back to earth. I had to think of realistic upgrades to sell, ones that are simple to implement.

It was still pretty fun to think about shop items to fill up my shop. I started with a few obvious ones like "health upgrade", "horse speed", "shield for protection", "extra money".

For shooting, there wasn't too many options since each shot one-kills enemies except giants. But I still was able to add "giant piercing" (which just helps to kill giants). Also added "quick shot", which accelerates shooting rate, but not just at fixed interval. It allowed an immediate shot right after an enemy is hit. That's a throwback to old shooting games like [Centipede](https://en.wikipedia.org/wiki/Centipede_(video_game)), in which only one missile is shown on the screen at the time. So a missile would either hit an enemy and could be shot again, or the player would have to wait until the missile reaches offscreen. This encouraged players to not waste their shot.
Another interesting upgrade is "rickoshot"... which really should have been spelled "ricoshot". It makes the arrow ricochet off an enemy, and hit another one if lucky. That's my way of adding area-effect damage.

I then added a few fun ideas, like "gambling", which risks some money for a chance to double it (not just what you bet, "All your money"). I had to give it a pretty low chance, but I lied to the player. The UI displays the chance to win as 30%, while it's really 35% in-game. Hopefully that makes the player feel they're luckier than usual.

Now, the most interesting thing I did with upgrades, I believe, involves the first two upgrades in the shop. They are both free (since you start with no money), but you can only choose one.
- Bow and arrow
- Speed

It's pretty obvious that speed is a terrible idea, since you need bow and arrows to shoot down enemies and collect money. But I thought it was still a fun idea to add it. I pretty much used "Speed" all the time when I was testing, because it made the horse run way faster and I had to do this over and over to test higher hut levels. But choosing Speed means that the run to the first hut has to be done without firing a single arrow (thus not collecting money). Furthermore, the second hut only provides "bow and arrows" (since you still have no money at that point). So you completely miss the chance for items on the first shop. I realized though, that for someone who wanted to speed run this game, they would definitely choose the risky "speed" option.

That also opened up the idea of two playstyles. One would be to build up income by shooting down enemies, to upgrade and allow survival. The other play-style is to speed through the whole thing, dodging enemies as much as possible. I definitely bought into the speed running play-style, having to redo the same levels over and over for testing my game forced me into it.

On top of that, there's a 5 min timer for completing the game, so that also needs to be taken into account.
Anyway, I thought this was a good way to add variety into the game. The next gameplay aspect makes the idea even more interesting.

# Game Over


![GAME OVER, KHAN](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1jis585oo3jxl33bkev1.png)

So initially for testing, I had to continue immediately after dying. Just pressing ESC revives me so I can continue playing and testing. I was thinking that I would remove it eventually, otherwise death is meaningless, allowing you to just continue whenever you want. But this got me thinking... it is a bit annoying to start all over again after death, how about I just let the player continue. But this can't be done without penalty. And then it hit me: Each death would cause the player to lose one random upgrade (along with its money going to 0). Eventually, the player would have an ultimate game over if all upgrades are gone.

Admittedly, this does make the game far easier than it should be. That said, losing an upgrade is really something the player would try to avoid. 

So I just included that concept of dying and reviving minus one random upgrade. But one thing became quite interesting: It was still possible to lose the "Bow and Arrows" upgrade. So basically, you could revive in the game at a very high level, with no ability to shoot! So that would force "income building" players into adopting the "dodging the enemy" "speed running" play-style, and I just love that 😁. Of course, the player would still recover the bow and arrows on the next hut if reached, so it doesn't make the game unplayable.

The game does encourage the player to go fast. There's a timer, which can be extended with money, but it's still not easy. To make the game not completely dependent on time, the timer running out does not end the game. It does kill the player, but the revive option is still there. On top of reviving with full health, the timer is extended to be at least 1 min. So that means the game does go on, running out of time is not the end!

There is a "storyline based" reason why the player needs to hurry though.

# Börte's story

One thing that I personally love about making a game, is the chance to tell stories. While lots of game jam games focus on gameplay, I find that story is one of the most important aspect.

After deciding to make the game about Genghis Khan, I wanted to learn more. I looked up his love life, because I thought it'd be pretty interesting as a backstory for the game, and I was not disappointed.

I learned about the story of Börte, Khan's first wife who got kidnapped by a rival tribe. Khan had to go on a rescue mission and was able to save her.

That seemed like a typical damsel in distress story, but from what I learned about Börte, she was more like a warrior-like princess, who also had skills in archery and horse riding. I imagined perhaps she could be the one fighting the ultimate bad guy at the end, once Khan manages to rescue her.

With that in mind, I tried to produce that kind of story. The initial idea was to have Khan reach Börte, then suggesting her to leave, but she decides to go after her kidnapper Jamukha. My grand idea, which unfortunately didn't make it into the 13kb, was that Börte would jump off her horse and fight Jamukha "mano y mano", while Genghis Khan would have to fend off other foes from disturbing their duel, while at the same time avoid hitting Börte with his arrows.

At the end, I just chose to have Börte hop on a horse after being rescued, and both head towards the next hut to find Jamukha. (I hope in the game it's clear to the player that the rider following Khan is Börte, not an enemy that needs to be shot down).

So I did have to implement a second horse archer assisting the main player. It wasn't too hard, I just made Börte a clone of the hero sprite, changed her color, and updated the `process` function to follow our main player and auto-shoot.

```javascript
  const ddx = hero.x - sprite.x;
  const ddy = hero.y - sprite.y;
  const dd = disto(ddx, ddy);// Math.sqrt(ddx * ddx + ddy * ddy);
  if(dd > 300) {
    sprite.ax = ddx * .01;
    sprite.ay = ddy * .01;  
  } else {
    sprite.ax = 0;
    sprite.ay = 0;
  }
```
Classic way to implement follow is just to have the acceleration of the follower be directed towards the followed sprite, and stop when it's close enough.

# My thoughts on the jam

This was my second time participating in 13kb jam, my [first one being in 2016](https://js13kgames.com/entries/short-circuit), and it was much more interesting this time. I remember that my first participation was very low key. I set the bar pretty low, thinking... well, what can you do with 13kb anyway.

Then this year in 2023, I saw other entries from previous years, and was pretty much blown away. I particularly liked [Soul Jumper](https://carelesslabs.wordpress.com/2022/09/25/js13k-2022-game-jam-post-mortem-js13k/) from the [2022 jam](https://2022.js13kgames.com/), which shined by it's upbeat music and overall coolness.

That totally changed my standard. For "The Terror of Mongolia", I immediately thought about what would be impressive to fit in 13kb. The one thing that came to mind was the smooth horse animation, which turns out to fit pretty well in 3kb. The next thing was animated cutscenes for an elaborate story. Ok the cutscenes didn't make it, but that's what encouraged me to include at least a story.

I also enjoyed learning about Börte.

![Börte from the film Mongols](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sarme49m6cloq0fyz30k.jpg)

I mean I don't even know the now 853 year-old woman, but I saw  a picture from the movie Mongols which I didn't watch, and got somehow a bit obsessed about her. I imagined she must be so cool or something like that.

Well, let's not get sidetracked. That's what happens when I think about Börte...

I think one important aspect that the game jam pinpoints on, is the idea of compromise. I've done many game jams, and there's always this concept that you need to prioritize what to do, choose the important parts and remove the features that you won't be able to finish. It's hard for me to do that, so in previous jams, I sometimes worked like a mad man to get the features I wanted, or ended up failing the jam.

This jam has an extra parameter. The 13kb limit. Because of that, time is not the only reason for having to cut down on features. The space is also a constraint.

I think this is one aspect that keeps this game jam unique and manageable, and I'm pretty satisfied with the choices I made for my game in that respect.
- I limited the type of enemies to 4, giving up on the ones with projectile, or flying eagle.
- Also gave up on adding boss fight.
- I had to let go of sound effects, and visual effects (I really wanted dust and also some blood).
- I chose instead to include a story, which took a big chunk simply because of dialogs, no matter how minimal that was.
- I also included my homage to Ennio Morricone with two covered songs. (Probably will have to remove them if I ever make a Steam version of this game, but it's still worth it).
- I polished the upgrade system to allow both a grinding and a speed running play-style, hoping the player is able to play with their own style.

This helped me figure out what was important, and focus on it. A skill that's good for me as I develop future games.

# Final thoughts

Well, this was a good jam. I initially spent time on it thinking it would help me in a JavaScript interview that I totally fail, then realize participating in this jam was more important than the job I was applying for. Good thing I didn't get it!
Nice community as well. Can't wait to see where I stack among all those fun entries.
And the theme... got me to learn about Genghis Khan's history and the mongol culture. I hope though I stop fantasizing about Börte or I'll get in trouble with my partner.

Hey, try this game. It's available on the js13kgames website:
https://js13kgames.com/entries/the-terror-of-mongolia

It's also on Itch.io:
https://jacklehamster.itch.io/the-terror-of-mongolia

And it might go on Steam and Newgrounds once I add that kick-ass scene of Börte fighting Jamukha mano y mano, while Khan is covering for her.