Legends of Rahnok: Getting started


First Step: a title screen

After releasing the pre-game jam version (just a walking simulator in a procedural-generated world) I noticed a number of issues that I decided to address straight away. The first of which was the difficulty in capturing the user's mouse in an HTML export, and the second was the fact that although the world is generated randomly, it always uses the same seed and therefore is the same every time.

By default, browsers prevent capturing the user's mouse automatically at start-up, therefore it must be captured based on some user input. The easiest solution here was to implement a title screen with a start button. Upon clicking start, the mouse is captured and the main game world is loaded.

A title screen also helps solve the second problem. By adding a text box for the user to enter a seed we can get a repeatable world or a random one. If the user leaves the box blank the random number generator is randomized before world generation, and if the user entered a seed the random number generator is seeded with said seed. This means that when entering “my cool world” in two separate game sessions, you will get the exact same world.

The title screen is still far from complete, I will make some pretty pictures for it soon!

Spawning into the world

The pre-game jam version had the player spawn at an arbitrary spot in the first town. This worked on the first release due to the above-mentioned issue of the world always being the same. Luckily the player would never spawn stuck inside one of the doorless houses. However, with the introduction of random seeds, this started to happen regularly. With a bit of code tweaking the player now spawns in the center of the main street!

On larger worlds the browser was starting to struggle and the frame rate would drop. There are a lot of optimizations that could be done here but as a starting point, limiting the number of world chunks rendered on screen made a big difference.

Enter the none player character (NPC)

It was day 2 of work on the game and time to start thinking about the implementation of NPCs. With a little help from OpenGameArt, I obtained a placeholder model to represent the citizens of Rahnok. A tiny bit of coding later and the player can press the F key to initiate an interaction with the NPC. From there I created a basic dialogue system with a placeholder conversation. Upon pressing the interact key the player will receive a greeting. If the player interacts again the NPC will continue the conversation. At any time if the player does not interact for a certain period of time, or ventures too far from the NPC, the NPC will issue a farewell and resume its activity of standing around doing nothing. This is quite different from the usual menu-based NPC interactions seen in most games, but it is simple and effective. I am quite happy with how it turned out!


Weapons for the masses

Things are starting to resemble an actual game! The player can venture around and interact with other characters. But a fantasy RPG needs swords, and that is what I implemented next. One floating sword and a basic animation player later and we have a proper RPG warrior! Next is some basic combat. It was getting late so my town NPCs ended up being the training dummies for the sword-wielding player. I do want the game to be sandbox so slaughtering innocent towns folk is allowed.


Despite it getting quite late I spent far too much time implementing changes to the NPC conversation system based on whether the player has their weapon drawn or not. With a drawn weapon, an NPC will kindly ask you to put it away before engaging in conversation.

That’s it for this update! I’m thinking the next port of call will be Dungeons. And maybe spiders!

Until next time 🙂

Get Legends of Rahnok

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.