Dungeon Sweep: Knight -- devlog 003

Dungeon Sweep: Knight -- devlog 003

ยท

5 min read

tl;dr I posted Gameplay Video on Twitter. Added some graphical flair to the dungeon. Found some free sound effects. Huge Gameplay pivot to rogue-like. Save states added. Struggles with ChatGPT and Phaser. How do I promote this thing?

Gameplay Video

I posted a Gameplay video of the prototype on my Twitter.

Graphics

I added some flair to the dungeon. Some of the walls have holes in them. Some holes ooze a green slime. Random floor tiles will have cracks. Skulls scattered throughout the dungeon. I am loving how these small improvements made the dungeon feel less homogenous and more like an actual dungeon!

Audio

I added some free sounds that I found on Pixabay. It's nice to hear the game coming together. I also added some variation to the sounds, so swinging the sword can produce multiple sounds. This minor variation added a lot more to the game than I thought it would have.

Gameplay Pivot

My initial vision was to have some type of Candy Crush-style level progression, but as I am playing, I'm not 100% sold on that design. If I made a single mistake, I'd abort the level and restart so I could get 3 stars. That's not how it's meant to be played.

From the feedback, people were also confused about their goals, since you wouldn't know how well you did until the end when they received a few or a lot of stars. In Minesweeper this is clear because if you mistake a mine, the game is immediately over. In this game, you are allowed a few mistakes.

So I am thinking of going rogue-like. The plan now is to have a health bar and points system. You keep progressing through the dungeon gaining or losing health and points until you finally meet your fate. The health bar will give the player immediate feedback when they do something wrong.

The rogue-like mechanic also allows for easier integration with items such as health magic potions, and maybe vendors.

I will also include a simple version where the player can just play a single level.

Saving State

Because I plan to use Apache Cordova to launch on mobile platforms, I need to use Cordova-friendly save states. After reviewing the options in Cordova documentation, I am going with IndexDB. It's simple enough to use and compatible across web/android/iphone.

I was able to implement IndexDB save states in a few minutes, so that also makes me happy.

Struggles with ChatGPT

I thought ChatGPT was going to make this game dev 10x faster but in reality, it hasn't. ChatGPT has been giving me wrong information or bad code. ChatGPT also isn't that familiar with Phaser3. There is also a lot more code, like game play stuff, that ChatGPT just can't help with.

ChatGPT has excelled at classic algorithms. For example ChatGPT helped me create a recursive function to traverse a Tree structure to find the entrance.

/**
 * @param {TreeNode<Container>} dungeonTree
 * @returns {Room}
 */
export function findDungeonEntranceRoom(dungeonTree) {
  if (!dungeonTree) return null;

  if (dungeonTree.leaf.room?.id.startsWith("entrance_")) {
    return dungeonTree.leaf.room;
  }

  const leftLeaf = findDungeonEntranceRoom(dungeonTree.left);
  if (leftLeaf) return leftLeaf;

  return findDungeonEntranceRoom(dungeonTree.right);
}

But a lot of the time ChatGPT would give me bad code and bad advice.

ChatGPT has been hit or miss with more missing than I'd like.

Even with these issues, if I had to do it all again from the beginning, I would still use ChatGPT.

Struggles with Phaser

The Phaser documentation leaves something to be desired. The code examples are good, but I often find the perfect example for Phaser2 and then struggle to search the docs to find the same example for Phaser3. The differences between these two have given me and ChatGPT many headaches.

I have also run into small quirks that have eaten hours of my time. Here's one example that stole a few hours of my life. If that await sleep(0) statement is removed, camera.worldView won't be set and therefore heartBar.setPosition will be set incorrectly.

So in we go, the classic setTimeout fix. ๐Ÿคฆ

async function drawUi() {
  const { camera } = gameState;
  const heartBar = heartbar.getSprite().setScrollFactor(0);

  await sleep(0); // IMPORTANT: sleep allows camera.worldView to be set.

  heartBar.setPosition(
    camera.worldView.x - camera.scrollX,
    camera.worldView.y - camera.scrollY
  );

  gameState.layers.ui.add(heartBar);
}

Given my issues and struggles with Phaser, I would not only use it again but also recommend it. The good in Phaser far outweighs the bad. Phaser is an amazing framework.

Promotion

๐Ÿ˜ญ Ugg. I don't know how to promote this thing and get it in front of eyeballs.

I'm planning on setting up an itch.io page, but I don't know if I should have two pages. I want to give the beta for free, but charge for the final game so how I go about that is unclear. One page for the beta and a separate page for the full game? I'm not sure. The itch documentation says not to make a page until the game is ready. But at the same time, I need to tell people about it and get some sort of waitlist long before the game is ready. So I don't know what to do here and if you do, comment below or hit me up @joelnet because I seriously need the help.

What's Next

I need to finish the health system and then create the rogue-like play. The basic mechanics of the game are complete so I think I'm over the difficult part.

I need to finish the health system, add treasure chests, coins, points, vendors, boss fights. You know, the fun stuff! ๐Ÿ˜

Subscribe to my Newsletter to keep updated with Dungeon Sweep: Knight!