3 ms·
Also useful is 'line of sight' algorithm so the character can 'see'. Basically, you cast out rays of light (in 8 directions or 360 if you want to be really accu
by zandorg 17y ago
Also useful is 'line of sight' algorithm so the character can 'see'. Basically, you cast out rays of light (in 8 directions or 360 if you want to be really accurate), and when the light beam hits a solid object (a wall, for instance), you stop casting the ray.
All the non-solid objects encountered (eg, grass, tiles) are noted as 'visible'.
What you get is that the character (NPC or human) can see through windows and open spaces, but not through walls. Re-scan every time they move.