LessNoise.Sh some signal

Roguelike Dev Day 4: Monster Chase

(2 minutes) programming, rust, game, roguelike

Monsters!

On Chapter 6 today.

I like a good variety of monsters. Dwarf Fortress and Zelda: BotW both have a bunch of monsters.

You know, I just remembered that another game I was thinking of emulating was [Populous: The Beginning]. I don't remember it having much in the way of non-human monsters, but replacing the roguelike idea of "cavern levels" with entire planets might be cool. ...and of course my brain starts wondering what geometry I'd use for modeling the planet's surface. Ugh.

Let's get going with the tutorial. Let's cook up some monsters!

Turn-based monsters?

The monster chapter is also setting up the game as a turn-based game. Roguelikes are traditionally turn-based... but I don't think that's what I want in my own game. I don't mind pausing, but I want the world to go ahead and do things even when the player character isn't doing anything.

Maybe this chapter will change my mind though. 🤷

Rude Monsters

Well, I taught the monsters to hurl insults at the player whenever they can see the player. It's not much, but I'm sure my kids would love it. If they could read...

Orc #12 shouts insults!

I feel myself being dragged through the mud by that orc's sailor mouth. 😆

Damage!

On to Chapter 7!

Yes, let's make the monsters move around and do stuff. I thought this was going to be part of chapter 6.

Blocking

I got the monsters to follow the player, but there's nothing stopping them from bunching up into the same tile as each other & the player. That's not a great experience. So the next step is to implement a way to block tiles.

We'll [accomplish] this by keeping track of what parts of the map are blocked.

First, we'll add another vector of bools to our Map

Why not use a component for this? We could tag all the blocking entities, and then when querying for blocking information we'd look at blocking entities that have positions.

That is less efficient for lookup, though. For every entity that checks blocking we'd have to loop through every entity that can block. By storing a vector of bools on the map checking if a spot is blocked is just an index lookup.

D'oh

I've read further in the tutorial, and we are using components for blocking. We're improving performance by saving the spots that are blocked in a vector on the map.

Bug?

I'm seeing a weird bug where monsters are just disappearing right out of my view. I'm not sure how to recreate it consistently.

Maybe I should clone the "official" tutorial repo instead of trying to write the code myself...

Yeah, I think I will. This is a long chapter, and I don't have time to finish it tonight. I'll pick up tomorrow with combat stats. For now I'll go clone the "official" repo to work off of.