Laserbrain Studios

Games Forum Blog Contact

Author Topic: Improved cover system  (Read 1808 times)

Christian Knudsen

  • Administrator
  • Ace
  • *****
  • Posts: 3018
    • View Profile
Improved cover system
« on: August 14, 2014, 12:54:49 PM »

You may or may not have seen the screenshot I posted on Twitter and Facebook last Saturday for Screenshot Saturday. But it showed the new cover system I’ve been working on.


It started when I wanted to optimize frightened AIs searching for cover to hide behind. Before, they’d check all tiles in a given radius and see if they provided cover by doing line of sight checks for each and every tile. That was quite wasteful. A simple way to improve that system was to have each tile already hold information about the cover it provided — and just fill in this information when loading a map and update it accordingly when doors are opened or closed, and so on.


It also improved performance by not having to do as many line of sight checks in the rest of the code. Because with this improved system, if I’m on a tile that is designated as providing cover in direction X and the enemy I’m checking line of sight for is also in direction X, he doesn’t have line of sight and there’s no need to go through the more performance-heavy process of tracing his eyeline and checking if it intersects with any objects.


And now that I had information for a tile’s cover on hand, it was easy to visualize this information by borrowing XCOM’s shield indicators. The small difference being that in XCOM, your soldiers automatically crouch behind low cover, while in Hidden Asset you have to do that manually, so there’s a crouch icon that shows if you have to crouch behind the cover:




Combined with the shadowcasting from all characters, these cover indicators in Tactical Mode make it a lot easier to sneak around and avoid being spotted. So not only did I improve the AI cover finding, I also made it easier for the player to understand the cover system. Two birds with one stone!



GLI

  • Hidden Asset Alpha Tester
  • Ace
  • *****
  • Posts: 1138
    • View Profile
Re: Improved cover system
« Reply #1 on: August 14, 2014, 08:40:55 PM »
You may or may not have seen the screenshot I posted on Twitter and Facebook last Saturday for Screenshot Saturday. But it showed the new cover system I’ve been working on.

IMHO it'll be better to have all in one place. I mean if/when you'll post something somewhere else then make sure it will be here too. Some people (like me) don't use Facebook/Tweeter and/or specialized sites for developers. Just my opinion... ;)
« Last Edit: August 14, 2014, 08:43:38 PM by GLI »
Genuine Lifelike Individual

Christian Knudsen

  • Administrator
  • Ace
  • *****
  • Posts: 3018
    • View Profile
Re: Improved cover system
« Reply #2 on: August 14, 2014, 09:43:46 PM »
That was the entire point of this blog post.