Jump to content
Sign in to follow this  
Angen

Vision Blocking by terrain [Need Performance Testing]

Recommended Posts

Step 1: Entity does not see terrain higher than its position. [done]

Step 2: Entity does not see terrain behind hills [done]

Spoiler

terrainBlockingSides.thumb.png.1541bbbc8c6a79e88de3f95534314acf.png

Step 3: Entity height influences how high can see (height from outpost's footprint allows to see what is on the hill) [maybe better to use some new parameter than footprint ? ]

Spoiler

terrainBlockingHeight.thumb.png.8fec3cee41a2da769a12417f37ebefc5.png

Step 4: Performance [maybe will not be needed]

Last build version Windows: pyrogenesis.exe  (outdated version)

Related diff: https://code.wildfiregames.com/D1905

Edited by Angen
  • Like 8
  • Thanks 1

Share this post


Link to post
Share on other sites

Thats Nice! Could it work with structures too? using height for make tall structures block vision behind them.
Example: Infantry can't see whats behind the walls unless they are in a siege tower.

Stupid question: if i garrison an archer in a outpost would it increase their FOV by Step 3 or it would just affect when entity is in a hill.

  • Like 2

Share this post


Link to post
Share on other sites
4 minutes ago, Alexandermb said:

Thats Nice! Could it work with structures too? using height for make tall structures block vision behind them.
Example: Infantry can't see whats behind the walls unless they are in a siege tower.

Stupid question: if i garrison an archer in a outpost would it increase their FOV by Step 3 or it would just affect when entity is in a hill.

For start I plan only depending on terrain height and entity height. For example: towers will have bonus and will see over hills that are lower then their height.

It could work with structures if their height would be added / substracted to terrain height in some cache to avoid obstruction checking when updating visibility.

  • Like 2

Share this post


Link to post
Share on other sites

Step 2 is basically the same as doing a 2d raycasting of the entity as if it were a light (see this).

So I'm afraid here is where you will notice you are inadvertantly doing the same as generating shadows and the performance will drop down :wacko:

 

Share this post


Link to post
Share on other sites

(here was firts compiled version - > moved to first post) 

Edited by Angen
  • Thanks 1

Share this post


Link to post
Share on other sites

Very cool, I'm actually surprised that the fps went from 60 fps to only 15 fps when i had 300 units, I expected a much higher drop :D. What technique are you using for step 2  @Angen, partial vision update?

Pic :victory::

screenshot0005.thumb.png.1fd3065b23f90676ab91f072ac115757.png

I also seem to have found a bug ... (but wip right? :P) no units but map area visible:

screenshot0004.thumb.png.40a2b5689bf7321905128a96a429e5f7.png

Edited by nani
  • Like 1

Share this post


Link to post
Share on other sites

@nani could you send me replay with bug? 

In svn los is computed in stripes from bottom of vision range to top. 

 

I changed computation to squares going from position to vision range borders.

Although I had to remove incremental update of that stripes and replace it with total remove and add as it were before it was optimised. 

 

To the current blocking I have boolean map matching los map strucute. As I said I go from entity position out. So In every iteration I check first height and if still visible then I check related tiles which could block vision from position and when I have d result I update related boolean map for next iteration and show hide tile for player. 

  • Like 1

Share this post


Link to post
Share on other sites

Gorgeous!

 

Untitled-1.jpg

screenshot0092.jpg

 

;)

 

I get this error every time I run your exe.

WARNING: Framebuffer object incomplete: 0x8CD6

ERROR: CRenderer::EndFrame: GL errors GL_OUT_OF_MEMORY (0505) occurred

Edited by wowgetoffyourcellphone
  • Haha 1

Share this post


Link to post
Share on other sites
Just now, Angen said:

hm interesting gl error, thnx. 

I tried running it with GLSL off, but that just gave me a series of error windows that I tried to suppress and got this:

screenshot0093.thumb.jpg.2062bd1275345929c7b27d2e98e1db63.jpg

 

PS: I wish we had the option to screenshot directly to JPG or some other compressed format so I wouldn't have to keep doing it manually in Photoshop™.

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, wowgetoffyourcellphone said:

WARNING: Framebuffer object incomplete: 0x8CD6

ERROR: CRenderer::EndFrame: GL errors GL_OUT_OF_MEMORY (0505) occurred

Maybe you could try with setting the shadow quality to low, or completely disabled.

  • Like 1

Share this post


Link to post
Share on other sites

Update:

Fixed behaviour of vision in water and improved detection of hills. Now unit will see up to the top of hill. So you will have not black holes unless hill is flat.

Sometimes side of hill will not be detected if there is smaller hill before it and blocks vision of unit but I am afraid further improvement would need more

complex computation and checking. 

 

Compiled version in first post.

Edited by Angen
  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, gameboy said:

This problem still exists. Can you issue a patch? Is the relevant patch code available?

What do you mean by this problem ?

  • Like 1

Share this post


Link to post
Share on other sites
On 5/17/2019 at 9:29 AM, Angen said:

Update:

Fixed behaviour of vision in water and improved detection of hills. Now unit will see up to the top of hill. So you will have not black holes unless hill is flat.

Sometimes side of hill will not be detected if there is smaller hill before it and blocks vision of unit but I am afraid further improvement would need more

complex computation and checking. 

 

Compiled version in first post.

Despite still seeing this

Untitled-1.jpg

I can still see the new vision working as advertised. Very nice. Though, it's disconcerting that I can't see atop mesas and such.

Edited by wowgetoffyourcellphone
  • Like 1

Share this post


Link to post
Share on other sites
9 minutes ago, gameboy said:

My God, how can this problem be solved? What do I see? Is this a Lego building block?

many more nights and days my friend.

  • Haha 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...