Hey guys. I tried to make some rather different map mechanics for Burden on this jam. Instead of a whole, solid map, the only existent rooms are the ones the player is making eye contact with. That way, when the player closes a door and opens it again, the room on the other side changes. See below:
Player is inside Room 1
Player has closed the door to Room 1
Player has opened the door again and is now looking at Room 3!
Because of this system, I couldn't just make the monster physically chase the player, because whenever the player would enter another room, the previous room would just disappear from existence! That's where the "monster apparitions" algorithm comes!
That pink sphere you see in every picture isn't the player model. It's actually what I call the "Monster's soul". It's just that: a floating sphere that follows the player varying it's velocity (according to a perlin noise function). It also has some sort of no-clip mode, so it can go through walls, charting a straight path to the player.
It stays invisible during the gameplay. The trick here is: the monster has a greater chance of spawning if "his soul" is closer to you. However, having no idea where the monster is could be a problem. According to the lore, the monster has the ability of slowing down time, so I've implemented a mechanic where the player can look at his wristwatch and observe how fast time is going.
This is an indicator of how far the Monster's soul is. The closer, the slower the time goes. The speed of time (distance between the player and the monster) is calculated using the Pythagorean theorem:
The apparition of the monster is random but it also depends on the position of "his soul". It usually happens when the player opens a door and another room is generated. At the moment I'm writing this, these are the probabilities that seemed to work fine:
- If the soul is inside your room when you open a door, the monster has a chance of 30% of spawning in that room;
- If the soul is inside the room that just got generated when you open a door (that usually happens when you're going back), the monster has 70% of chance of spawning in that room;
- If you leave the room where the monster is, it has 10% of chance of respawning in the room you just entered. (Usually behind you. However, you get to hear a different sound when that happens so you know you can get killed by behind);
- The monster has also 5% of chance of randomly spawning anywhere.
That way you can keep track of where the monster is so you don't just get randomly jumpscared. However, these probabilities also add unpredictability to it. I also had to add some buffs to "his soul" to avoid some exploits. For example, the soul is teleported to a random radius nearby the player every 30-40 seconds (you get to hear a special sound when that happens so you know what's going on) in case the player is too far from it.
At least for now, this algorithm is working perfectly for what I needed. Now it's time to implement the actual (in-room) chasing system! Don't forget to play Burden as soon as the Jam ends so you can feel the sensation of getting scared but knowing what is happening!