New Code Release of the Roguelike Boilerplate


Over the past few weeks I’ve been working hard on updates to the roguelike browser boilerplate. Most of these changes are new functionality I created when developing Asterogue. I’ve back-ported them into this boilerplate so they can benefit everyone who uses it.

Please note that I have not yet updated the PDF guide. I have some more features coming to the codebase in the next couple of weeks, and once those are in I will update the PDF and finish off the last few RBB screencasts.

Here is a full list of the new changes:

  1. Cleaned up the inventory code. Previously I had a callback for when inventory items are clicked, but this only makes sense if this was a library. With boilerplate code the developer can just modify the actual function. One level less abstraction makes the code a bit clearer. I also added a function to remove an item from the inventory since this is often required after the player has used an item (e.g. drank a potion, read a scroll).

  2. Put the monster into an array. Instead of having a single hardcoded monster I changed the boilerplate to use an array with one monster in it. This makes it easier for a developer to add multiple monsters. With a single hardcoded variable they’d have to go through and find all the places to change it to an array anyway, so this should save on some work.

  3. I brought over some pure functions for various tile related logic (“is there a monster on this tile?”).

  4. Items are now stored in their own hashmap instead of being stored as tiles in the map hashmap. While developing Asterogue I realized it made more sense to have layers with the floor and wall tile map on the bottom, items on top of that, and then characters and players on the top layer. As a result of this change I also refactored the drawing to become more purely functional.

  5. Backported the fixes to the on-screen message log. You can highlight words like “hit”, add multiple messages, and I fixed up the logic so the log persists correctly until the player makes their next move.

  6. Improved combat logic and messaging. Player and monster entities are now treated the same in combat (e.g. combat(player, monster) and combat(monster, player) works the same depending on who is striking who.

  7. Backported the feature for showing end-screen values like how much XP, gold, etc. the player accrued.

  8. Backported the arrows/touch/keyboard handling. During Asterogue dev it was a challenge getting consistent handling of input across all devices. On mobile devices the on-screen arrow buttons are shown, whereas desktop uses the physical keyboard. A bunch of work went into getting a nice consistent feel (e.g. when you hold down a key/button it should feel the same) regardless of the input method being used and I’ve got that working in the boilerplate now.

  9. Fixed buggy retro border image artifacts. The NES.css library has this issue where the pixelated rounded corner boxes get bad glitching and artifacts on Chrome, especially on Android. I never worked this out properly on Asterogue but now I finally found a solution that looks good and retains the rounded-pixel corners in the boilerplate.

  10. Backported a bug-fix for a bug that an occur at the end of a game when the display has disappeared but some logic might still be running.

  11. Backported the animation effects overlay system from Asterogue. Basically what this means is you can add image divs over the top of the game canvas, positioned pixel perfectly. That lets you do CSS effects like particles and stuff on top of the game. In Asterogue this is used for all kinds of game-juice like when you pick up and item or get hit.

I’ve also put the boilerplate on sale for 50% off to celebrate the start of 7DRL (seven day roguelike) 2021 today. Enjoy!

Files

roguelike-browser-boilerplate.zip 32 kB
Mar 05, 2021

Get Roguelike Browser Boiler plate

Buy Now$20.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.