Temple of The Roguelike Forums

Development => Programming => Topic started by: rhysmakesgames on March 21, 2016, 12:20:44 AM

Title: Monsters moving between levels
Post by: rhysmakesgames on March 21, 2016, 12:20:44 AM
I was just thinking about this and how it could be weird to program so i was wondering if there were some specific approaches that people knew of that would help?

Normally you'd just have monsters from the current floor be active in your game, so moving monsters between floors could get tricky. The only thought I had was when a monster is pathfinding to the player and the player goes down stairs, the game will register that that monster was x turns away from the stairs and once those x-turns are up it adds the monster to the new floor at the correct spot.
Title: Re: Monsters moving between levels
Post by: tuturto on March 21, 2016, 08:39:46 AM
I was just thinking about this and how it could be weird to program so i was wondering if there were some specific approaches that people knew of that would help?

Normally you'd just have monsters from the current floor be active in your game, so moving monsters between floors could get tricky. The only thought I had was when a monster is pathfinding to the player and the player goes down stairs, the game will register that that monster was x turns away from the stairs and once those x-turns are up it adds the monster to the new floor at the correct spot.

That sounds like a good solution if you don't want to have multiple levels active. You could try having the level where player is active and the levels that can be reached from that level and see how big impact it has on performance. If you aren't keeping multiple levels active, you pretty much have to abstract movement somehow and counting x turns sounds like a good plan. Of course then you have to think what to do if the monster has some active spells or status effects (poison, being on fire and such) and think how to deal with them.
Title: Re: Monsters moving between levels
Post by: wire_hall_medic on March 24, 2016, 05:11:51 PM
The only thought I had was when a monster is pathfinding to the player and the player goes down stairs, the game will register that that monster was x turns away from the stairs and once those x-turns are up it adds the monster to the new floor at the correct spot.

I believe this is how Brogue does it.
Title: Re: Monsters moving between levels
Post by: rhysmakesgames on March 29, 2016, 01:12:59 AM
Thanks for the feedback guys. I also though for an even more simplistic system you could just move monsters that are directly next to the player down the stairs with them. I think DCSS does something like this.
Title: Re: Monsters moving between levels
Post by: Gornova on March 31, 2016, 09:09:00 PM
Another solution could be, using some sort of behaviour/trait for monsters like aggressive monsters/hunter types, that follow player everywhere. So when player change level, hunter spawn from start of the level after X turns, like other mentioned