In my 2D tile game I've implemented a line-of-sight system where the client's player can see all unobstructed tiles and those tiles are remembered so as the client's player move around their LOS and view of real tiles changes and those they have previously discovered are rendered in their remembered state and are dulled to distinguish them from what is in LOS. Revisiting previous areas will update stored tiles. The algorithm for tile discovery is something I'm looking to optimise but currently works well for a single client player.
My current problem is how best to share the knowledge of the terrain across a team of players. As player A moves across the map and discovered terrain I want player B to see those tiles appear. I'll also want new clients that join to get the full discovered state of the map. Currently I see three options for this:
A: Player A does tile discovery client side and sends out discovered tile data to server. Server distributes discovered tile data to all other clients.
B: As all players are predicted in each client (until they receive a player data update) they should have fairly accurate position/velocity data for each other player. Therefore each client can run the tile discovery code for themselves and each other player. If there are 4 players on a team then this means 4 x the work for tile discovery.
C: Perform all discovery on server. Player A moves, server uses (predicted) position of player A to discover tiles and sends data for all clients (possibly including A) to memorise state of and render discovered tiles. I like this but any latency would result in a strange experience for a client as the player moved position and tiles appeared late and I think I need to rule it out on that basis.
I'm going to start going through these options here and seeing what will work out best but I'd appreciate any thoughts and ideas especially if anyone has dealt with a similar problem before. Thanks.