Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: LemonDrop on November 15, 2013, 10:55:08 pm

Title: Tilemap dynamic lighting (fog of war) help
Post by: LemonDrop on November 15, 2013, 10:55:08 pm
So I was trying to think of a system to do a sort of fog of war system based on tiles that can be seen by the player (not relatively complex), but was having a hard time doing so. The first idea I had involved having a sort of nested for loop x/y system which would check all the sprites in a diamond shaped area (in a certain order of course) and if it hit a solid tile, abort that row. Sadly mid-coding it I realized it would only work on one axis so I decided the only other way would be to do actual raycasting checks to see if anything is in the way of each "light beam" to a tile (in a diamond area pattern again). I planned it to go something like:


As fast as axe is at math however I feel like this many calculations may slow down my frame times too much, so I was wondering if there's some crazy optimized calculator method of "dynamic lighting" or whatever for tile-based games.