Page 1 of 1

Line of Sight

Posted: Wed Feb 06, 2013 8:21 pm
by Tomcat
Line of sight:

We must first define which tiles can be seen across and which tiles cannot. Currently the Walkable map layer defines which tiles can be walked on and which cannot.

Optionally, it should be relatively simple to add a third category of tiles that can be seen across but not walked across (e.g. small plants and boulders, tree stumps). I think we can skip the possibility of a tile that can be walked across but not seen across, although one can imagine special cases ... magical veils, dense spider webs... But one thing at a time.

I'll investigate the code to see if it is as simple as adding a new color code to the Walkable layer. If not, then a separate Seeable layer could be created, but that's alot more work.

Also, the actual line of sight rules need to be determined. My first cut idea is that any tile is visible from the player's position tile if the line connecting the two tile centers does not pass through a vision-blocking tile. I could code and test this rule to see if the resulting lines of sight seem realistic.

This setup could be used for:

1) Changing the map display to account for partial lighting, such as a stationary candelabra that only lights part of a room, or a player-carried torch. LOS defines which tiles are lit, within range of the light if applicable.

2) Revealing only the part of a map, based on what the player can actually see. This could attract both the display of the main screen and the world map. Tiles that have never been in the player's LOS (while lit) would remain black.

3) Implementing ranged weapons and/or spells. Only a visible tile can be targeted. Optionally, we could allow a player indoors to shoot at an unlit tile, but the projectile would only get there if the target tile would be in LOS in full light.

All of this would require some upgrades to the data structure for the maps and the map display routine, but should be doable.

Any comments?

Re: Line of Sight

Posted: Wed Feb 06, 2013 8:29 pm
by Fire7051
Tomcat wrote:
2) Revealing only the part of a map, based on what the player can actually see. This could attract both the display of the main screen and the world map. Tiles that have never been in the player's LOS (while lit) would remain black.
I love the idea and think that it would add a lot of depth to the enviroment. (I even thought up a helmet for this). :twisted:

If you were able to add it in fairly simply and it didn't make the file absolutely huge (I don't see any reason why it would) I say go for it!

Re: Line of Sight

Posted: Fri Feb 08, 2013 2:04 am
by Pyrizzle
I could see this being a neat addition to any underground or any other area that isn't very well lit.

Great suggestions, would be great for Caves, Dungeons, dark buildings, caticombs, etc.

Very interesting ideas here.