I don’t know if this is the right place to post this. Please feel free to correct me.
I’m stuck in a situation with my game that I don’t know how to approach. The Game I’m making is primarily a 2D side scroller that takes inspiration from Alien Isolation.
This problem can be broken up into 2 main parts:
1: if a player uses a door that’s “in the background”, they move to the next room.
2: The monster’s behaviour needs to persist from one room to the next.
What I mean:
1: The closest game-wise I can think of is Super Mario Bros. 3 (SMB3) and Super Mario bros 2. (SMB2) In SMB3, when you are inside a mini castle dungeon, you are able to enter doors by pressing up on the D-Pad, which will take you from Room-A to Room-B. In SMB2, there are doors in the “overworld”, and when you press up on the D-Pad, you can go through them, taking you from outside, to inside, and vise versa.
The problem is that, from what I can tell, things like enemies can get reset when going back and forth between them, putting them back to the games default state. I think collectables are the only thing I have seen be persistent.
2: The monster. I haven’t made the monster yet, but I don need to take it into consideration. The idea is that the player has a noise meter, and if it goes above a threshold, it “summons” the monster, at which point, it’ll look for the player, and if it spots the player, it’ll chase them down and kill the player (This is a very watered down overview of what I want to achieve). It will also store data on the player’s behaviour ext… and learn from the player. The noise mechanic needs to be persistent between rooms. How the noise mechanic is likely to work:
If the player is (for example), crouching, they might only produce a noise level of 0.2, if they are walking, they might produce a noise level of 0.5 and if they are sprinting, they might produce a noise level of 0.9. The idea is that if the player is crouching, the noise level might not ever go over the threshold to summon the monster. If they are walking, they might need to be walking for a 10 seconds before it crosses that threshold. If they sprint, they will only need to sprint for 2 seconds before it crosses the threshold. If they player stops, the meter doesn’t just cut back down to 0.0, but rather it tapers down. The higher the meter was, the longer it takes to taper off.
The other part that needs to be maintained is the monster’s behaviour. If for example, the player goes through a door while the monster has not “spotted them”, the monster should still be in it’s “searching” behaviour, even if it enters the same room as the player. If the monster has “spotted” the player, even if the player changes room, the monster should commit to the chase, even between rooms, unless the player has done something to hide or are able to lock the door behind them.
One problem I can see is that, I don’t think it’s going to be as simple as just hiding one room while you’re inside another. This is for a few reasons.
1: I want it so that when a door opens, or if a player passes a window, they can see what’s on the other side.
2: If I just hide a room’s sprite and colliders, You’ll end up with a situation where the monster will be able to kill the player before it enters the new room, this would be problematic if the rooms “overlap” (as in, if one room is directly behind another).
I also don’t know if simply having separate scenes for each room will work though for the persistence thing. I don’t think using something like “if condition A is true in room one, then it is also true in room 2” will work for something like this.
I want to be clear, When I say that rooms might be overlapping, I’m talking about it as though thinking about the layout in 3D space. So, you might be in Room A, and see elements of Room B through things like windows or open doors. But going to the new room isn’t just switching foreground/background. It’s more like, SMB3 in the since that when you go through the door, the screen fades to black, then fades into the new room. This is because in 3D space, your camera’s perspective has changed, because the player has essentially made a 90 degree turn to go through the door in the first place. So when a player is in room A, but can see Room B through a window, Room B is essentially in the background. But When they change rooms, Room B becomes the new foreground, while room A in the window is now the background. Which means if the player is in Room A, and the monster is in Room B, the player might be able to see the monster in the window and decide if they want to go into Room B.
My head is sort of at having 2 separate scenes.
In scene A, you are in Room A. You can see room B though a window or open door. You go through the door you transition to scene B
In scene B, you are in Room B, but now you can see Room A through the window or door.
But I don’t know if this will even do what I want
