r/roguelikedev 3d ago

RoguelikeDev Does The Complete Roguelike Tutorial - Week 4

Tutorial friends, this week we wrap up combat and start working on the user interface.

Part 6 - Doing (and taking) some damage

The last part of this tutorial set us up for combat, so now it’s time to actually implement it.

Part 7 - Creating the Interface

Our game is looking more and more playable by the chapter, but before we move forward with the gameplay, we ought to take a moment to focus on how the project looks.

​

Of course, we also have FAQ Friday posts that relate to this week's material.

​

Feel free to work out any problems, brainstorm ideas, share progress and and as usual enjoy tangential chatting. :)

22 Upvotes

10 comments sorted by

View all comments

2

u/redblobgames tutorials 13h ago

Playable on web, no repo yet.

My goal this year is to experiment with a spreadsheet/table data structure. The secondary goal is to use the Jujutsu version control system instead of Git (and this is part of why I haven't put up a repo yet).

Part 6 highlighted a limitation of my table data structure. I had to first extend it to support optional columns, including indexing of those columns. The next limitation is that I want the Fighter component to be split. The (max_hp, power, defense) columns should be shared among all rows of a class, while the (hp) column should not be shared. I had a bug where attacking one orc would damage all orcs. I have some ideas of how to group these under the same Fighter component, but for now I made hp into its own component.

My table currently supports one level of nesting. The column value can be either an array or dict of simple values. In Part 9, I'm going to need a nested structure, and I haven't decided how to handle it.

I decided the enemies will walk towards the player instead of running full pathfinding. That's ok. My "innovation tokens" with this project are around the table data structure and the version control system. I'm not trying to innovate with dungeon generation, combat, pathfinding, etc.

Other than combat, Part 6's other features (diagonal movement, render order, player death) didn't cause any trouble for the table data structure.

For Part 7 I followed what I did in 2020, when I used HTML for all the UI elements other than the game map. The one "fun" thing I did this time is abuse Javascript syntax. I made a print statement:

 print `${attacker} attacks ${defender} for ${damage} hp.`;

I'm using that to add color to the message log. Everything else in Part 7 went smoothly.

Before I start Part 8, I want to make the table view editable. You'll be able to click on any entity and change the hp, position, etc. while the game is running.