Merchants, items and inventory

Two major things and a whole bunch of polish this week. I wrote earlier about improving procedural dungeon generation, so I won’t rehash that; the other big feature this week was getting merchants and shops into the game.

I now have the ability to add buying and selling as actions when interacting with an NPC. Each NPC merchant will (currently) buy any item, and has a list of items that they will sell to players. Heavily inspired by old console RPGs like Final Fantasy and Pokémon , there’s also a shop location. I can alter this on a case-by-case basis, to customise the merchant themselves, the products they have on display, and the crafting workstation on the left.

I think I’ve got all the bugs, exploits and edge-cases worked out (like adding an item to your sell list, then consuming it in another window, then completing the sale of the now non-existent item, for example), but it’ll be interesting to see what players come up with. Buying and selling are kind of an important, potentially economy-breaking feature if there’s any horrific item and/or currency duplicating bugs left in there, so I’ll be keeping an eye on it for a while.

Because I’d spent so much time working with merchants and therefore items, I also made some improvements there. Can you believe BotLG contains 57 different items already (and I feel like I haven’t really even started on generating item content yet)? First, I consolidated the item types into a much smaller set — With that done, I added a dedicated inventory screen, which can be filtered by these new categories. Then, as a last bit of polish, I made it so that wherever an item is displayed, it shows an icon next to the text label. I’m really happy with how it looks, and now the console looks a bit more exciting while you’re gathering resources:

So this leaves me with just two major mechanics to implement: account-wide storage and account-wide progression through character retirement, which I’m hoping to get done next week. After that it’s just bug fixes, content and polish. I really want to completely revamp the starting area, so that players can get into a dungeon much quicker — and a more exciting one than the pretty trope-heavy Rat King’s Nest. This week (and last) have introduced a lot of new stuff, and the current maps don’t really show them off to the game’s best advantage; I actually think I’m going to hold back on making these things live until I have some shiny new locations in place.

This week’s changelog

Here are the edited highlights from this week’s changelog. You can view the whole list here.

  • As usual, BotLG is a little less idle and a little more roguelike. Every type of gathering node is now a limited resource. To compensate for limited resources, lowered global action duration to 3 seconds (from 8 seconds)
  • New skills: gathering, hedge magic, mining
  • New items: plum-nose mushroom, gorgeous plum-nose mushroom, myconic essence, myconic potions, part I, rough stone, copper ore, iron ore, silver ore, lump of coal
  • New recipes: distill (gorgeous) plum-nose mushroom into myconic essence; brew small healing potion from myconic essence
  • NPCs can now buy and sell items
  • Looking at a skill’s details (click the name of a skill from the skills panel) now shows which recipes you both know and have yet to learn. Learning a recipe now grants the corresponding skill at level 1 if you do not already have it.
  • The inventory panel now only lists the most recent items received, but contains a link to browse your entire inventory, which is filterable. Players can click an empty equipment slot to open their inventory filtered for items suitable to equip there
  • Each floor of a procedurally generated dungeon now requires a randomised quest to be completed before you can descend to the next floor. Closing the page or refreshing while in a dungeon will cause you to lose some of your inventory
  • Location name and difficulty is now displayed as the minimap window title
  • Consolidated item types down to: accessory, armour, bones, component, drink, food, ingredient, junk, potion, quest, recipe, weapon
  • Wherever an item name is displayed, its icon is also shown
  • Monsters now slow down when the player is chasing them, and will pause if they end up adjacent to a stationary player

Procedurally generated dungeons

I finally got around to improving the way procedurally generated locations work. Now, locations can have a procgen tag, which causes the game to look for a default set of rules for generating the location when the player enters it. This lets me specify things like which dungeon generation algorithm to use, what tiles to use, which monsters to make present, and things like that.

Additionally, I can specify a list of overrides on a per-level basis, so I can make certain floors of a dungeon different. For example, the first few levels could be brick-and-mortar dungeons, before devolving into rock face caverns with their own colour scheme and different monsters present. Another option available to me is to specify a premade map, so I can have fixed points within a dungeon — boss chambers, alters, shops, or whatever. Within these premade locations, I can even specify which position and level within the dungeon an exit should take you to, so I can also make shortcuts around larger labyrinths. All this should let me build some more engaging dungeon locations.

Alongside this dungeon revamp, I added a couple of complimentary features: procedurally generated quests and quest-locked portals. BotLG is a little unusual in that monsters won’t attack the player; combat is only initiated by the player bumping into a monster themselves. Now, this would mean that you could carefully navigate your way to the bottom of a dungeon and never face any actual danger, which is ridiculous.

To help combat this, I implemented a flag on portals (like doors, staircases, etc., any tile that moves you to another location) that makes that portal only work if a specified quest has been completed. When you enter a dungeon floor, a quest template is picked from a list, and the conditions to complete it are adjusted based on the current difficulty level. Players can only use the stairs down to the next level once the quest is completed; if the player leaves the dungeon, the quest is abandoned.

I’m going to use this system to flesh out the Rat King’s Lair, the first procedural dungeon the player will come across, and then add in a couple more. I’m increasingly thinking I need to revamp the starting area so the player can more immediately jump into some dungeon crawling without having to find the Rat King’s Lair, which is a fair distance away from the player’s start location, and a little off the beaten track.