LandOfTheRair / core-cpp-archive

The new backend for Land of the Rair
https://rair.land
GNU Affero General Public License v3.0
3 stars 2 forks source link

map_update_response add fov #19

Open Oipo opened 5 years ago

Oipo commented 5 years ago

Add calculated fov for the clients. Current suggestion for map_update_response:

{
  "npcs": [/* list of visible npcs here */]
  "x": /* x position of player */
  "y": /* y position of player */
  "fov": [] /* a 9x9 array of 0 or 1 values. Center of array indicates player position (see above), can extend beyond map boundaries as center is always player position. */
}

Example fov of a player standing on position (0, 0) of a map without obstacles:

111110000111110000111110000111110000111110000000000000000000000000000000000000000

Array access can be determined by x + y * 9.

seiyria commented 5 years ago

FoV should have these values:

0 - visible, no darkness 1 - semi-visible, darkness (this is if you can see in the dark, and the darkness spell is cast here) 2 - reserved 3 - actual fov blocking