3 ms·
I assume you mean for generating the shadow map before it is scaled and pixelized? I'm not familiar with techniques for doing such a thing. You could probably s
by JasonSage 14y ago
I assume you mean for generating the shadow map before it is scaled and pixelized? I'm not familiar with techniques for doing such a thing. You could probably step through each object and draw lines from the corners based on the angle between the player tile and the object. The approach I listed would actually save you from testing every single object—as soon as a black pixel is detected in an algorthm, it moves to the next line, meaning that the number of objects that may exist in that direction at a greater distance is completely irrelevant.
- 0x0 14y agoI guess I was thinking something like this: http://roguebasin.roguelikedevelopment.org/index.php/Eligloscode http://roguebasin.roguelikedevelopment.org/index.php/Eliglos... (the second example, "raycasting"). You'd work on the "native tile resolution". I.e. you just "swipe" lines starting at the player position to the edge of the map, in a circle; as soon as you hit an obstacle tile, you stop marking the tiles ("pixels") on the line as lightened. No need to do any per-object iteration (as long as the tile map contains object references in tile positions)
- JasonSage 14y agoThis works, but gives you no indication of whether the tile is partially visible or not, much less how visible. An accurate indication of this would require many more rays and a lot of processing.
- 0x0 14y agoRight. I was thinking about whether there could be a way to apply your technique, without having to do the polar + cartesian conversions.