The repository is currently privated and the bot is offline (project is paused), if someone still seeks access to the source code or wishes to test the features, feel free to contact me or join the discord server.

What is Disclawd?

Disclawd is a clicker game for Discord. It’s possible to “mine” blocks and ores from a pretty familiar game, doing this grants gold, xp and allows one to buy items. Besides that, watch out for spawning monsters to slay!

This idea was realized by writing a Discord bot in Java using the Java Discord API (JDA).

Not a Stick Not a Stick Not a Stick Magic Stone Reduvia

Details

Architecture

Items, blocks, and mobs are defined in JSON config files, making the game modular and extendable, e.g., removal/addition of blocks, mobs or items.

Contradictory to the familiar game, biomes are simplified into three categories: Overworld, Nether and the End. With each biome having it's own "buffs" or "debuffs" (not implemented yet). The type property defines the actual block occurring in the biome. A block has a base number of hp and either generates or not xp upon destruction. The mob array describes which mob sub-type is able to spawn while the block is active.

{
  "blocks": [
    {
      "biome": "Overworld",
      "type": "COAL",
      "hp": 10.0,
      "fileName": "coal.png",
      "xpEnabled": true,
      "mobs": ["ZOMBIE", "SKELETON", "CREEPER"]
    }
  ]
}

Mobs are mainly grouped by their mobType and mobSubType, where mobType is defined as: NORMAL | BOSS | TRADER. NORMAL mobs are the usual encounter, which have a spawnChance and drop xpDropAmount / goldDropAmount if beaten. `BOSS` mobs are server-wide encounters, with an additional `hp` and `specialDrop` property. `TRADER` mobs allow players to convert resources into other resources or even trade for rare non-shop items (not implemented yet). The mobSubType is used to define where mobs spawn, including their variants, within the biomes.json. Variants? If two mobs share the same mobType and mobSubType they are called variants, like the Baby Zombie and the Zombie. They share the same spawn block, but might have different stats or appearance, which is quite nice for - you guessed it - variation :D

{
  "mobs": [
    {
      "content": {
        "name": "Baby Zombie",
        "description": "Appears in the overworld!",
        "fileName": "baby_zombie.png",
      }
      "mobType": "NORMAL",
      "mobSubType": "ZOMBIE",
      "spawnChance": 0.15,
      "xpDropAmount": 1.0,
      "goldDropAmount": 1
    }
  ]
}

Items can be bought from the shop, traded for or dropped by special mobs (not implemented yet). They all require a specific player level to be wielded and are assigned to an itemType. The itemType defines how player stats are affected.

  • UTILITY items affect xp and gold dropped by mobs/blocks
  • WEAPON items affect xp dropped by mobs/blocks and damage dealt to mobs/blocks
{
  "items": [
    {
      "content": {
        "name": "Magic Stone",
        "emoji": ":gem:",
        "description": "More than a shiny stone!",
        "imgPath": "magic_stone.png",
      },
      "reqLvl": 0,
      "itemType": "UTILITY",
      "dropChance": 0,
      "xpMultiplier": 1.0,
      "goldMultiplier": 1.1
    }
  ]
}

Server-specific world instances, each Discord guild interacting with the bot through the /block command or a block-message creates its own world instance, whose lifetime is tied to the bot’s (or cache-cleanup after a period of inactivity). This allows for isolated world states per Discord guild, supporting multiple active servers simultaneously, without interference. What happens if a world instance is deleted? The current block is replaced by a randomly chosen one, as if it would have been destroyed.

Not only are world instances cached, but also inventories. Inventories are frequently accessed objects, as they provide a stat, xp and item overview. These are displayed using paginated messages. Hence, to minimize redundant computation and database hits caching is used.

Player stats and inventories are stored using persistent storage, exceeding the lifetime of a running bot instance. My choice was a SQL database.

For Discord Users

  • Randomized block and block-specific mob spawning.
  • Per guild scaling, the more players interact, the harder are blocks to break.

Commands:

  • /help – Shows an ephemeral message explaining the game concept.
  • /rank [category] – Shows the Top 10 players (globally) by category. If you aren’t in the top 10, your global position is also displayed. Supports autocomplete.
  • /block – Displays the current block, its HP, and active users. Includes a hit button.
  • /shop – Opens a paginated shop interface (see pixel art above).
  • /item [item name] – Shows item info with buy/equip buttons. Supports autocomplete.
  • /inventory – Displays a paginated inventory, main stats are shown on the first page and collected items on further.