Spielerando

Line of sight

Answers whether one character can see another, on a tile grid or in open space. It also gives you the whole field of view for fog of war, and a guard's view cone for stealth games.

When you need it

For stealth games, turn-based tactics, fog of war, enemies that only notice you when they can see you, and anything that shoots in a straight line.

Say this to your AI

Use the line of sight from Spielerando so my guards only notice the player inside their view cone and with no wall in between.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP

Settings

Your AI gets the code

The finished code and math come through the Spielerando connection, so your AI can use them right away. Connect your AI

Common questions

how do i check if an enemy can see the player

Walk the straight line between them, tile by tile, and stop if a wall is in the way. For a guard, also check that the player is within range and within the angle it is looking.

how do i make fog of war

From the player's tile, sweep outwards in all directions and let each wall cast a shadow behind it. The recipe does that and gives you every tile that can be seen.

why can my enemy see me but i cannot see it

Many simple line methods give different tiles in each direction. The line here is walked exactly, so if one side can see the other, it always works both ways.