How to determine visibility in 2D

I am developing an AI sandbox and I would like to calculate what every living object can see.

The rule is to simply hide what's behind the edges of the shapes in terms of the object. The image clarifies everything:

alt text http://img231.imageshack.us/img231/2972/shadows.png

I need this either as an input to artificial intelligence, or graphically to show it for a specific object while it moves.

Any interesting ideas?

+3
source share
3 answers

If you use simple shapes to block an entity view, there is an easy way to do this, which I implemented:

VisionWave, , . VisionWave, , , , .

4 : , , , , , 1 -1 (.. X). (), >.

  \     /
   \   />
    \ / >
     @  >
    / \ >
   /   \>
  /     \

, . , :

  • , .
  • - , , .

​​ Roguelike, . .

, , , - .

+4

, , AI:

  • .
  • .
  • "" 360 Β°, , . , ; , .
  • . .

, , - , , , . , , ( ).

2d visibility demo

+5

Determine which vertices are visible to your eye point, then project these vertices back from the eye point in a straight line to create new vertices. Close the form and you will create a polygon representing the invisible area.

See shadow volumes for 3D equivalent.

+1
source

Source: https://habr.com/ru/post/1738832/


All Articles