various: implement fog of war; make enemy AI slightly more intelligent #14

Merged
NotAShelf merged 2 commits from notashelf/push-wlxxmonulyzt into main 2026-04-10 06:07:59 +00:00
Owner

One of the things that has been annoying me for a long while. Previously the entire map would be revealed immediately upon load (same for subsequent floors) and make it practically a juke the enemies while you dash for the stairs simulator. This is partially affected by the lack of map RNG (implemented, not wired up) but I think the map being loaded in its entirety was a huge downside for how engaging the game was.

This implements a Fog of War, where you have a relatively small vision distance (TODO: let items and character stats affect this) and improved the enemy AI to stop chasing you all the way from China while you are a humble fisherman in Spain. Most notably:

  • can_see_player() now uses actual LOS + range (was only adjacent check)
  • Enemies only chase when player is visible
  • When player not visible, enemies patrol randomly (30% chance to move)

This comes with changes to vision where you can only see 8 tiles in all directions (with wall occlusion) while nemies can see 6 tiles. As I said, enemies won't chase through walls but they do patrol when player is hidden. Unexplored areas are completely dark; previously seen areas remain slightly obfuscated to allow wasting screen free estate. You cannot see enemies in previously explored rooms.

The vision range is a little different for enemies. For now I've elected to make enemy vision slightly less than the player character but that might make it too easy to avoid enemies (Goblin=7, Skeleton=6, Orc=5). To combat this, I've made enemies track alert state and last known player position to "rally" nearby enemies by propagating alert to create a "search party" effect.

Signed-off-by: NotAShelf raf@notashelf.dev
Change-Id: I3e22dbc5e10690871255980c52a24c226a6a6964

One of the things that has been annoying me for a long while. Previously the entire map would be revealed immediately upon load (same for subsequent floors) and make it practically a *juke the enemies while you dash for the stairs* simulator. This is partially affected by the lack of map RNG (implemented, not wired up) but I think the map being loaded in its entirety was a huge downside for how engaging the game was. This implements a Fog of War, where you have a relatively small vision distance (TODO: let items and character stats affect this) and improved the enemy AI to stop chasing you all the way from China while you are a humble fisherman in Spain. Most notably: - `can_see_player()` now uses actual LOS + range (was only adjacent check) - Enemies only chase when player is visible - When player not visible, enemies patrol randomly (30% chance to move) This comes with changes to vision where you can only see 8 tiles in all directions (with wall occlusion) while nemies can see 6 tiles. As I said, enemies won't chase through walls but they do patrol when player is hidden. Unexplored areas are completely dark; previously seen areas remain *slightly* obfuscated to allow wasting screen free estate. You cannot see enemies in previously explored rooms. The vision range is a little different for enemies. For now I've elected to make enemy vision slightly less than the player character but that might make it too easy to avoid enemies (Goblin=7, Skeleton=6, Orc=5). To combat this, I've made enemies track alert state and last known player position to "rally" nearby enemies by propagating alert to create a "search party" effect. Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I3e22dbc5e10690871255980c52a24c226a6a6964
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I3e22dbc5e10690871255980c52a24c226a6a6964
NotAShelf requested review from amr 2026-04-09 10:13:11 +00:00
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I2f5c7cac72c8772e5871b99026d106b46a6a6964
NotAShelf force-pushed notashelf/push-wlxxmonulyzt from dbf8d4886c to 71343311eb 2026-04-09 18:28:50 +00:00 Compare
Collaborator

Dude, this is freaking awesome!!! Amazing work! Merge this biatch.

Dude, this is freaking awesome!!! Amazing work! Merge this biatch.
amr approved these changes 2026-04-09 20:59:49 +00:00
amr left a comment
Collaborator

Yeah, I approve 100%

Yeah, I approve 100%
Sign in to join this conversation.
No reviewers
amr
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
NotAShelf/rogged!14
No description provided.