3) Enemies awake when player sees them. In this case, the enemies only awake when they are seen by the player. It is quite ok for a simple roguelike, but I need to implement enemies with different LOS size, so this wont work.
Could work if you also check the distance to the player and don't wake up the creature if it's too far away. I would also use "sound" based approach with simple distance check and possibly how much the player is making noise. Also, I would use pathfinding only if the creature has difficulties to approach the player directly when it knows where the player is. Even then it's often questionable, because how does some simple monster know how to pathfind the player? Maybe it could just stand there or leave.
Distance checking Line of Sight is the simplest I can come up with, but the downside appears when the monster can see from a farther distance than the player.
Lets say, the enemy is only "awaken" when the player seen him. In this case, all the enemies' LOS distance = player LOS discantance.
So then, distance checking should be performed from monsters' perspective, i.e. for each monster, check if player is within that monster's LOS distance.
But the downside is, monsters would be able to see through walls, doors and any other LOS blocking map feature: (continue after Minotauro's quote):
My own design philosophy involves not to overthink whatever I can avoid. Since this mainly touches on events happening outside of the player's line of sight, I think it's okay to give one self some leeway here. I think the effect we are looking for, is two-fold: We want the player to get the feeling they are moving around in a living world, but we also don't want interesting events to play out outside of the player's line of sight. It's cool to come into a room where a knight and a bear are in the middle of a fight, for instance. It's less interesting to explore a dungeon full of already vanquished enemies.
That is a good point you have there. Afterall, with a simple "distance LOS" system we could justify it as if the enemy hears the player. And even we can implement a stealth check:
if enemy.viewDistance >= enemy.distanceToPlayer AND player.stealth < enemy.detectHidden then
enemy.seesPlayer()
else
enemy.doesNotSee()
end
We could even increase stealth based on distance.
Both my games that ever saw a release has a variant of "wake up monsters when player is at a certain distance". My first game had very strict division of the map into different rooms, and I'd simply let monsters wake up whenever a tile belonging to their home room came into the player's line of sight (including outer walls/doors, so most monsters would wake up when the player was somewhere in the room adjacent to them). My current project plays in an open landscape rather than a dungeon. Here I just divided the map into big chunks (approx. 16 x 16 points), and I make sure that all beings currently in the same map chunk as the player, or one adjacent to it, is active. As the player moves around, map chunks that are too far away are conversely put to sleep again.
As always,
Minotauros
Basically, your 1st game was based on Rogue wake system.
Whereas your 2nd game, since it is a openworld system, there are not meaningful obstacles that totally block monsters LOS.
But the problem I want to avoid as much as possible is this, directly related with dungeon-style Roguelikes:
# # # # # # # # # #
# . . . # . . . . #
# # . . . # . . . . # #
. . E . # . . @ . .
# # . . . # . . . . # #
# . . . # . . . . #
# # # # # # # # # #
In that case, lets say enemy 'E' has a LOS distance of 10. Both, the player and E are in totally unconnected rooms, but the distance from E to @ in less than 10, so E can see @ even through walls.
So, in the end I might go all the way to simple distance checking, as you suggest, it is better to do things simple. But just wondering, for dungeon roguelikes how should be the best approach that balances realism with computational speed.
Btw, I tried pathfinding system, and it is terribly slow, even for a mere 10 enemies in the map.
Then I tried a LOS calculation (LOS from each monster towards the player position), and even when it is slightly faster, it is far from comfortable for the player.
And finally, simple squared distance check, the fastest, but could lead to "monsters can see through walls" effect.
I dont know if there are other methods to approach this, that is the question I really wanted to ask.
Thanks for your answer, both of you.